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