michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "txExpr.h" michael@0: #include "txNodeSet.h" michael@0: #include "txIXPathContext.h" michael@0: #include "txXPathTreeWalker.h" michael@0: michael@0: /** michael@0: * Evaluates this Expr based on the given context node and processor state michael@0: * @param context the context node for evaluation of this Expr michael@0: * @param ps the ContextState containing the stack information needed michael@0: * for evaluation michael@0: * @return the result of the evaluation michael@0: **/ michael@0: nsresult michael@0: RootExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult) michael@0: { michael@0: txXPathTreeWalker walker(aContext->getContextNode()); michael@0: walker.moveToRoot(); michael@0: michael@0: return aContext->recycler()->getNodeSet(walker.getCurrentPosition(), michael@0: aResult); michael@0: } michael@0: michael@0: TX_IMPL_EXPR_STUBS_0(RootExpr, NODESET_RESULT) michael@0: michael@0: bool michael@0: RootExpr::isSensitiveTo(ContextSensitivity aContext) michael@0: { michael@0: return !!(aContext & NODE_CONTEXT); michael@0: } michael@0: michael@0: #ifdef TX_TO_STRING michael@0: void michael@0: RootExpr::toString(nsAString& dest) michael@0: { michael@0: if (mSerialize) michael@0: dest.Append(char16_t('/')); michael@0: } michael@0: #endif