dom/xslt/xpath/XPathEvaluator.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/xslt/xpath/XPathEvaluator.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,75 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef mozilla_dom_XPathEvaluator_h
    1.10 +#define mozilla_dom_XPathEvaluator_h
    1.11 +
    1.12 +#include "nsIDOMXPathEvaluator.h"
    1.13 +#include "nsIWeakReference.h"
    1.14 +#include "nsAutoPtr.h"
    1.15 +#include "nsString.h"
    1.16 +#include "mozilla/Attributes.h"
    1.17 +#include "mozilla/ErrorResult.h"
    1.18 +#include "nsIDocument.h"
    1.19 +
    1.20 +class nsINode;
    1.21 +class txResultRecycler;
    1.22 +
    1.23 +namespace mozilla {
    1.24 +namespace dom {
    1.25 +
    1.26 +class GlobalObject;
    1.27 +
    1.28 +/**
    1.29 + * A class for evaluating an XPath expression string
    1.30 + */
    1.31 +class XPathEvaluator MOZ_FINAL : public nsIDOMXPathEvaluator
    1.32 +{
    1.33 +public:
    1.34 +    XPathEvaluator(nsIDocument* aDocument = nullptr);
    1.35 +
    1.36 +    NS_DECL_ISUPPORTS
    1.37 +
    1.38 +    // nsIDOMXPathEvaluator interface
    1.39 +    NS_DECL_NSIDOMXPATHEVALUATOR
    1.40 +
    1.41 +    // WebIDL API
    1.42 +    JSObject* WrapObject(JSContext* aCx);
    1.43 +    nsIDocument* GetParentObject()
    1.44 +    {
    1.45 +        nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
    1.46 +        return doc;
    1.47 +    }
    1.48 +    static already_AddRefed<XPathEvaluator>
    1.49 +        Constructor(const GlobalObject& aGlobal, ErrorResult& rv);
    1.50 +    already_AddRefed<nsIDOMXPathExpression>
    1.51 +        CreateExpression(const nsAString& aExpression,
    1.52 +                         nsIDOMXPathNSResolver* aResolver,
    1.53 +                         ErrorResult& rv);
    1.54 +    already_AddRefed<nsIDOMXPathNSResolver>
    1.55 +        CreateNSResolver(nsINode* aNodeResolver, ErrorResult& rv);
    1.56 +    already_AddRefed<nsISupports>
    1.57 +        Evaluate(const nsAString& aExpression, nsINode* aContextNode,
    1.58 +                 nsIDOMXPathNSResolver* aResolver, uint16_t aType,
    1.59 +                 nsISupports* aResult, ErrorResult& rv);
    1.60 +private:
    1.61 +    nsWeakPtr mDocument;
    1.62 +    nsRefPtr<txResultRecycler> mRecycler;
    1.63 +};
    1.64 +
    1.65 +inline nsISupports*
    1.66 +ToSupports(XPathEvaluator* e)
    1.67 +{
    1.68 +    return static_cast<nsIDOMXPathEvaluator*>(e);
    1.69 +}
    1.70 +
    1.71 +/* d0a75e02-b5e7-11d5-a7f2-df109fb8a1fc */
    1.72 +#define TRANSFORMIIX_XPATH_EVALUATOR_CID   \
    1.73 +{ 0xd0a75e02, 0xb5e7, 0x11d5, { 0xa7, 0xf2, 0xdf, 0x10, 0x9f, 0xb8, 0xa1, 0xfc } }
    1.74 +
    1.75 +} // namespace dom
    1.76 +} // namespace mozilla
    1.77 +
    1.78 +#endif /* mozilla_dom_XPathEvaluator_h */

mercurial