txNodeSetContext.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #include "txNodeSetContext.h"
  6. #include "txNodeSet.h"
  7. const txXPathNode& txNodeSetContext::getContextNode()
  8. {
  9. return mContextSet->get(mPosition - 1);
  10. }
  11. uint32_t txNodeSetContext::size()
  12. {
  13. return (uint32_t)mContextSet->size();
  14. }
  15. uint32_t txNodeSetContext::position()
  16. {
  17. NS_ASSERTION(mPosition, "Should have called next() at least once");
  18. return mPosition;
  19. }
  20. nsresult txNodeSetContext::getVariable(int32_t aNamespace, nsIAtom* aLName,
  21. txAExprResult*& aResult)
  22. {
  23. NS_ASSERTION(mInner, "mInner is null!!!");
  24. return mInner->getVariable(aNamespace, aLName, aResult);
  25. }
  26. bool txNodeSetContext::isStripSpaceAllowed(const txXPathNode& aNode)
  27. {
  28. NS_ASSERTION(mInner, "mInner is null!!!");
  29. return mInner->isStripSpaceAllowed(aNode);
  30. }
  31. void* txNodeSetContext::getPrivateContext()
  32. {
  33. NS_ASSERTION(mInner, "mInner is null!!!");
  34. return mInner->getPrivateContext();
  35. }
  36. txResultRecycler* txNodeSetContext::recycler()
  37. {
  38. NS_ASSERTION(mInner, "mInner is null!!!");
  39. return mInner->recycler();
  40. }
  41. void txNodeSetContext::receiveError(const nsAString& aMsg, nsresult aRes)
  42. {
  43. NS_ASSERTION(mInner, "mInner is null!!!");
  44. #ifdef DEBUG
  45. nsAutoString error(NS_LITERAL_STRING("forwarded error: "));
  46. error.Append(aMsg);
  47. mInner->receiveError(error, aRes);
  48. #else
  49. mInner->receiveError(aMsg, aRes);
  50. #endif
  51. }