txForwardContext.cpp 1.7 KB

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