michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsXPathExpression_h__ michael@0: #define nsXPathExpression_h__ michael@0: michael@0: #include "nsIDOMXPathExpression.h" michael@0: #include "nsIDOMNSXPathExpression.h" michael@0: #include "txIXPathContext.h" michael@0: #include "txResultRecycler.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: class Expr; michael@0: class txXPathNode; michael@0: michael@0: /** michael@0: * A class for evaluating an XPath expression string michael@0: */ michael@0: class nsXPathExpression MOZ_FINAL : public nsIDOMXPathExpression, michael@0: public nsIDOMNSXPathExpression michael@0: { michael@0: public: michael@0: nsXPathExpression(nsAutoPtr& aExpression, txResultRecycler* aRecycler, michael@0: nsIDOMDocument *aDocument); michael@0: michael@0: // nsISupports interface michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXPathExpression, michael@0: nsIDOMXPathExpression) michael@0: michael@0: // nsIDOMXPathExpression interface michael@0: NS_DECL_NSIDOMXPATHEXPRESSION michael@0: michael@0: // nsIDOMNSXPathExpression interface michael@0: NS_DECL_NSIDOMNSXPATHEXPRESSION michael@0: michael@0: private: michael@0: nsAutoPtr mExpression; michael@0: nsRefPtr mRecycler; michael@0: nsCOMPtr mDocument; michael@0: michael@0: class EvalContextImpl : public txIEvalContext michael@0: { michael@0: public: michael@0: EvalContextImpl(const txXPathNode& aContextNode, michael@0: uint32_t aContextPosition, uint32_t aContextSize, michael@0: txResultRecycler* aRecycler) michael@0: : mContextNode(aContextNode), michael@0: mContextPosition(aContextPosition), michael@0: mContextSize(aContextSize), michael@0: mLastError(NS_OK), michael@0: mRecycler(aRecycler) michael@0: { michael@0: } michael@0: michael@0: nsresult getError() michael@0: { michael@0: return mLastError; michael@0: } michael@0: michael@0: TX_DECL_EVAL_CONTEXT; michael@0: michael@0: private: michael@0: const txXPathNode& mContextNode; michael@0: uint32_t mContextPosition; michael@0: uint32_t mContextSize; michael@0: nsresult mLastError; michael@0: nsRefPtr mRecycler; michael@0: }; michael@0: }; michael@0: michael@0: #endif