2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-08-23 14:11:30 -07:00
|
|
|
#ifndef mozilla_dom_XPathEvaluator_h
|
|
|
|
#define mozilla_dom_XPathEvaluator_h
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "nsIDOMXPathEvaluator.h"
|
|
|
|
#include "nsIWeakReference.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsString.h"
|
2012-06-18 19:30:09 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-12-14 11:10:49 -08:00
|
|
|
#include "mozilla/ErrorResult.h"
|
2013-07-04 08:39:24 -07:00
|
|
|
#include "nsIDocument.h"
|
2012-12-14 11:10:49 -08:00
|
|
|
|
2013-08-23 14:11:30 -07:00
|
|
|
class nsINode;
|
2013-07-04 08:39:24 -07:00
|
|
|
class txResultRecycler;
|
2013-08-23 14:11:30 -07:00
|
|
|
|
2012-12-03 08:07:49 -08:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2013-08-23 14:11:30 -07:00
|
|
|
|
2012-12-03 08:07:49 -08:00
|
|
|
class GlobalObject;
|
2014-06-27 12:39:50 -07:00
|
|
|
class XPathExpression;
|
2013-07-04 08:40:06 -07:00
|
|
|
class XPathResult;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A class for evaluating an XPath expression string
|
|
|
|
*/
|
2013-07-04 08:29:29 -07:00
|
|
|
class XPathEvaluator MOZ_FINAL : public nsIDOMXPathEvaluator
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2014-06-23 12:56:07 -07:00
|
|
|
~XPathEvaluator();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
public:
|
2013-07-04 08:39:24 -07:00
|
|
|
XPathEvaluator(nsIDocument* aDocument = nullptr);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-07-04 08:39:24 -07:00
|
|
|
NS_DECL_ISUPPORTS
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIDOMXPathEvaluator interface
|
|
|
|
NS_DECL_NSIDOMXPATHEVALUATOR
|
|
|
|
|
2012-12-14 11:10:49 -08:00
|
|
|
// WebIDL API
|
2014-04-08 15:27:18 -07:00
|
|
|
JSObject* WrapObject(JSContext* aCx);
|
2014-03-15 12:00:15 -07:00
|
|
|
nsIDocument* GetParentObject()
|
2013-07-04 08:39:24 -07:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
|
2014-03-15 12:00:15 -07:00
|
|
|
return doc;
|
2013-07-04 08:39:24 -07:00
|
|
|
}
|
2013-08-23 14:11:30 -07:00
|
|
|
static already_AddRefed<XPathEvaluator>
|
|
|
|
Constructor(const GlobalObject& aGlobal, ErrorResult& rv);
|
2014-06-27 12:39:50 -07:00
|
|
|
XPathExpression*
|
2012-12-14 11:10:49 -08:00
|
|
|
CreateExpression(const nsAString& aExpression,
|
|
|
|
nsIDOMXPathNSResolver* aResolver,
|
2013-08-23 14:11:30 -07:00
|
|
|
ErrorResult& rv);
|
2012-12-14 11:10:49 -08:00
|
|
|
already_AddRefed<nsIDOMXPathNSResolver>
|
2013-08-23 14:11:30 -07:00
|
|
|
CreateNSResolver(nsINode* aNodeResolver, ErrorResult& rv);
|
2013-07-04 08:40:06 -07:00
|
|
|
already_AddRefed<XPathResult>
|
|
|
|
Evaluate(JSContext* aCx, const nsAString& aExpression,
|
|
|
|
nsINode* aContextNode, nsIDOMXPathNSResolver* aResolver,
|
|
|
|
uint16_t aType, JS::Handle<JSObject*> aResult,
|
|
|
|
ErrorResult& rv);
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
|
|
|
nsWeakPtr mDocument;
|
|
|
|
nsRefPtr<txResultRecycler> mRecycler;
|
|
|
|
};
|
|
|
|
|
2013-04-08 14:04:21 -07:00
|
|
|
inline nsISupports*
|
2013-08-23 14:11:30 -07:00
|
|
|
ToSupports(XPathEvaluator* e)
|
2013-04-08 14:04:21 -07:00
|
|
|
{
|
|
|
|
return static_cast<nsIDOMXPathEvaluator*>(e);
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/* d0a75e02-b5e7-11d5-a7f2-df109fb8a1fc */
|
|
|
|
#define TRANSFORMIIX_XPATH_EVALUATOR_CID \
|
|
|
|
{ 0xd0a75e02, 0xb5e7, 0x11d5, { 0xa7, 0xf2, 0xdf, 0x10, 0x9f, 0xb8, 0xa1, 0xfc } }
|
|
|
|
|
2013-08-23 14:11:30 -07:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* mozilla_dom_XPathEvaluator_h */
|