tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

XPathEvaluator.h (2331B)


      1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      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/. */
      5 
      6 #ifndef mozilla_dom_XPathEvaluator_h
      7 #define mozilla_dom_XPathEvaluator_h
      8 
      9 #include "mozilla/dom/Document.h"
     10 #include "mozilla/dom/NonRefcountedDOMObject.h"
     11 #include "nsString.h"
     12 
     13 class nsINode;
     14 class txIParseContext;
     15 class txResultRecycler;
     16 
     17 namespace mozilla {
     18 class ErrorResult;
     19 
     20 namespace dom {
     21 
     22 class GlobalObject;
     23 class XPathExpression;
     24 class XPathNSResolver;
     25 class XPathResult;
     26 
     27 /**
     28 * A class for evaluating an XPath expression string
     29 */
     30 class XPathEvaluator final : public NonRefcountedDOMObject {
     31 public:
     32  explicit XPathEvaluator(Document* aDocument = nullptr);
     33  ~XPathEvaluator();
     34 
     35  // WebIDL API
     36  bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
     37                  JS::MutableHandle<JSObject*> aReflector);
     38  Document* GetParentObject() { return mDocument; }
     39  static UniquePtr<XPathEvaluator> Constructor(const GlobalObject& aGlobal);
     40  UniquePtr<XPathExpression> CreateExpression(const nsAString& aExpression,
     41                                              XPathNSResolver* aResolver,
     42                                              ErrorResult& rv);
     43  UniquePtr<XPathExpression> CreateExpression(const nsAString& aExpression,
     44                                              nsINode* aResolver,
     45                                              ErrorResult& aRv);
     46  UniquePtr<XPathExpression> CreateExpression(const nsAString& aExpression,
     47                                              txIParseContext* aContext,
     48                                              Document* aDocument,
     49                                              ErrorResult& aRv);
     50  nsINode* CreateNSResolver(nsINode& aNodeResolver) { return &aNodeResolver; }
     51  already_AddRefed<XPathResult> Evaluate(
     52      JSContext* aCx, const nsAString& aExpression, nsINode& aContextNode,
     53      XPathNSResolver* aResolver, uint16_t aType, JS::Handle<JSObject*> aResult,
     54      ErrorResult& rv);
     55 
     56 private:
     57  WeakPtr<Document> mDocument;
     58  RefPtr<txResultRecycler> mRecycler;
     59 };
     60 
     61 }  // namespace dom
     62 }  // namespace mozilla
     63 
     64 #endif /* mozilla_dom_XPathEvaluator_h */