Bug 1935611 - Fix libyuv/libpng link failed for loongarch64. r=glandium,tnikkel,ng
[gecko.git] / dom / xslt / xpath / XPathEvaluator.h
blobdbf79373b91bac5c455d878054b6a01b654a22b9
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/. */
6 #ifndef mozilla_dom_XPathEvaluator_h
7 #define mozilla_dom_XPathEvaluator_h
9 #include "mozilla/dom/NonRefcountedDOMObject.h"
10 #include "nsString.h"
11 #include "mozilla/Attributes.h"
12 #include "mozilla/dom/Document.h"
14 class nsINode;
15 class txIParseContext;
16 class txResultRecycler;
18 namespace mozilla {
19 class ErrorResult;
21 namespace dom {
23 class GlobalObject;
24 class XPathExpression;
25 class XPathNSResolver;
26 class XPathResult;
28 /**
29 * A class for evaluating an XPath expression string
31 class XPathEvaluator final : public NonRefcountedDOMObject {
32 public:
33 explicit XPathEvaluator(Document* aDocument = nullptr);
34 ~XPathEvaluator();
36 // WebIDL API
37 bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
38 JS::MutableHandle<JSObject*> aReflector);
39 Document* GetParentObject() { return mDocument; }
40 static UniquePtr<XPathEvaluator> Constructor(const GlobalObject& aGlobal);
41 UniquePtr<XPathExpression> CreateExpression(const nsAString& aExpression,
42 XPathNSResolver* aResolver,
43 ErrorResult& rv);
44 UniquePtr<XPathExpression> CreateExpression(const nsAString& aExpression,
45 nsINode* aResolver,
46 ErrorResult& aRv);
47 UniquePtr<XPathExpression> CreateExpression(const nsAString& aExpression,
48 txIParseContext* aContext,
49 Document* aDocument,
50 ErrorResult& aRv);
51 nsINode* CreateNSResolver(nsINode& aNodeResolver) { return &aNodeResolver; }
52 already_AddRefed<XPathResult> Evaluate(
53 JSContext* aCx, const nsAString& aExpression, nsINode& aContextNode,
54 XPathNSResolver* aResolver, uint16_t aType, JS::Handle<JSObject*> aResult,
55 ErrorResult& rv);
57 private:
58 WeakPtr<Document> mDocument;
59 RefPtr<txResultRecycler> mRecycler;
62 } // namespace dom
63 } // namespace mozilla
65 #endif /* mozilla_dom_XPathEvaluator_h */