2005-11-02 10:42:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2005-11-02 10:34:13 +03:00
|
|
|
|
2005-11-02 20:34:14 +03:00
|
|
|
#include "txExpr.h"
|
2005-11-02 10:41:38 +03:00
|
|
|
#include "txNodeSet.h"
|
2005-11-02 10:37:50 +03:00
|
|
|
#include "txIXPathContext.h"
|
2006-04-01 06:12:15 +04:00
|
|
|
#include "txXPathTreeWalker.h"
|
2005-11-02 10:34:13 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Evaluates this Expr based on the given context node and processor state
|
|
|
|
* @param context the context node for evaluation of this Expr
|
|
|
|
* @param ps the ContextState containing the stack information needed
|
|
|
|
* for evaluation
|
|
|
|
* @return the result of the evaluation
|
|
|
|
**/
|
2005-11-02 10:40:48 +03:00
|
|
|
nsresult
|
|
|
|
RootExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
2005-11-02 10:37:48 +03:00
|
|
|
{
|
2006-09-26 04:04:14 +04:00
|
|
|
txXPathTreeWalker walker(aContext->getContextNode());
|
|
|
|
walker.moveToRoot();
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2006-09-26 04:04:14 +04:00
|
|
|
return aContext->recycler()->getNodeSet(walker.getCurrentPosition(),
|
|
|
|
aResult);
|
|
|
|
}
|
2005-11-02 10:34:13 +03:00
|
|
|
|
2006-01-26 04:50:30 +03:00
|
|
|
TX_IMPL_EXPR_STUBS_0(RootExpr, NODESET_RESULT)
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2006-01-26 04:50:30 +03:00
|
|
|
RootExpr::isSensitiveTo(ContextSensitivity aContext)
|
|
|
|
{
|
2006-09-26 04:04:14 +04:00
|
|
|
return !!(aContext & NODE_CONTEXT);
|
2006-01-26 04:50:30 +03:00
|
|
|
}
|
|
|
|
|
2005-11-02 10:42:10 +03:00
|
|
|
#ifdef TX_TO_STRING
|
|
|
|
void
|
|
|
|
RootExpr::toString(nsAString& dest)
|
|
|
|
{
|
2005-11-02 10:36:59 +03:00
|
|
|
if (mSerialize)
|
2014-01-04 19:02:17 +04:00
|
|
|
dest.Append(char16_t('/'));
|
2005-11-02 10:42:10 +03:00
|
|
|
}
|
|
|
|
#endif
|