dom/xslt/xpath/nsXPathExpression.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef nsXPathExpression_h__
     7 #define nsXPathExpression_h__
     9 #include "nsIDOMXPathExpression.h"
    10 #include "nsIDOMNSXPathExpression.h"
    11 #include "txIXPathContext.h"
    12 #include "txResultRecycler.h"
    13 #include "nsAutoPtr.h"
    14 #include "nsCycleCollectionParticipant.h"
    15 #include "mozilla/Attributes.h"
    17 class Expr;
    18 class txXPathNode;
    20 /**
    21  * A class for evaluating an XPath expression string
    22  */
    23 class nsXPathExpression MOZ_FINAL : public nsIDOMXPathExpression,
    24                                     public nsIDOMNSXPathExpression
    25 {
    26 public:
    27     nsXPathExpression(nsAutoPtr<Expr>& aExpression, txResultRecycler* aRecycler,
    28                       nsIDOMDocument *aDocument);
    30     // nsISupports interface
    31     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    32     NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXPathExpression,
    33                                              nsIDOMXPathExpression)
    35     // nsIDOMXPathExpression interface
    36     NS_DECL_NSIDOMXPATHEXPRESSION
    38     // nsIDOMNSXPathExpression interface
    39     NS_DECL_NSIDOMNSXPATHEXPRESSION
    41 private:
    42     nsAutoPtr<Expr> mExpression;
    43     nsRefPtr<txResultRecycler> mRecycler;
    44     nsCOMPtr<nsIDOMDocument> mDocument;
    46     class EvalContextImpl : public txIEvalContext
    47     {
    48     public:
    49         EvalContextImpl(const txXPathNode& aContextNode,
    50                         uint32_t aContextPosition, uint32_t aContextSize,
    51                         txResultRecycler* aRecycler)
    52             : mContextNode(aContextNode),
    53               mContextPosition(aContextPosition),
    54               mContextSize(aContextSize),
    55               mLastError(NS_OK),
    56               mRecycler(aRecycler)
    57         {
    58         }
    60         nsresult getError()
    61         {
    62             return mLastError;
    63         }
    65         TX_DECL_EVAL_CONTEXT;
    67     private:
    68         const txXPathNode& mContextNode;
    69         uint32_t mContextPosition;
    70         uint32_t mContextSize;
    71         nsresult mLastError;
    72         nsRefPtr<txResultRecycler> mRecycler;
    73     };
    74 };
    76 #endif

mercurial