txXPathObjectAdaptor.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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/. */
  5. #ifndef txXPathObjectAdaptor_h__
  6. #define txXPathObjectAdaptor_h__
  7. #include "txExprResult.h"
  8. #include "txINodeSet.h"
  9. #include "txIXPathObject.h"
  10. /**
  11. * Implements an XPCOM wrapper around XPath data types boolean, number, string,
  12. * or nodeset.
  13. */
  14. class txXPathObjectAdaptor : public txIXPathObject
  15. {
  16. public:
  17. explicit txXPathObjectAdaptor(txAExprResult* aValue) : mValue(aValue)
  18. {
  19. NS_ASSERTION(aValue,
  20. "Don't create a txXPathObjectAdaptor if you don't have a "
  21. "txAExprResult");
  22. }
  23. NS_DECL_ISUPPORTS
  24. NS_IMETHOD_(txAExprResult*) GetResult() override
  25. {
  26. return mValue;
  27. }
  28. protected:
  29. txXPathObjectAdaptor() : mValue(nullptr)
  30. {
  31. }
  32. virtual ~txXPathObjectAdaptor() {}
  33. RefPtr<txAExprResult> mValue;
  34. };
  35. #endif // txXPathObjectAdaptor_h__