Back to index

lightning-sunbird  0.9+nobinonly
Classes | Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
PathExpr Class Reference

Represents a PathExpr. More...

#include <Expr.h>

Inheritance diagram for PathExpr:
Inheritance graph
[legend]
Collaboration diagram for PathExpr:
Collaboration graph
[legend]

List of all members.

Classes

class  PathExprItem

Public Types

enum  PathOperator { RELATIVE_OP, DESCENDANT_OP }

Public Member Functions

 PathExpr ()
 Creates a new PathExpr.
virtual ~PathExpr ()
 Destructor, will delete all Expressions.
nsresult addExpr (Expr *aExpr, PathOperator pathOp)
 Adds the Expr to this PathExpr The ownership of the given Expr is passed over the PathExpr, even on failure.
virtual nsresult evaluate (txIEvalContext *aContext, txAExprResult **aResult)=0
 Evaluates this Expr based on the given context node and processor state.

Public Attributes

 TX_DECL_EXPR
u8 op
char affinity
u8 flags
CollSeqpColl
ExprpLeft
ExprpRight
ExprListpList
Token token
Token span
int iTable
int iColumn
AggInfopAggInfo
int iAgg
int iRightJoinTable
SelectpSelect
TablepTab
SchemapSchema

Private Member Functions

nsresult evalDescendants (Expr *aStep, const txXPathNode &aNode, txIMatchContext *aContext, txNodeSet *resNodes)
 Selects from the descendants of the context node all nodes that match the Expr.

Private Attributes

List expressions

Detailed Description

Represents a PathExpr.

Definition at line 604 of file Expr.h.


Member Enumeration Documentation

Enumerator:
RELATIVE_OP 
DESCENDANT_OP 

Definition at line 611 of file Expr.h.


Constructor & Destructor Documentation

Creates a new PathExpr.

Definition at line 52 of file PathExpr.cpp.

{
    //-- do nothing
}
PathExpr::~PathExpr ( ) [virtual]

Destructor, will delete all Expressions.

Definition at line 60 of file PathExpr.cpp.

{
    txListIterator iter(&expressions);
    while (iter.hasNext()) {
         delete NS_STATIC_CAST(PathExprItem*, iter.next());
    }
} //-- ~PathExpr

Here is the call graph for this function:


Member Function Documentation

nsresult PathExpr::addExpr ( Expr aExpr,
PathOperator  pathOp 
)

Adds the Expr to this PathExpr The ownership of the given Expr is passed over the PathExpr, even on failure.

Adds the Expr to this PathExpr.

Parameters:
aExprthe Expr to add to this PathExpr
Returns:
nsresult indicating out of memory
Parameters:
exprthe Expr to add to this PathExpr

Definition at line 73 of file PathExpr.cpp.

{
    NS_ASSERTION(expressions.getLength() > 0 || pathOp == RELATIVE_OP,
                 "First step has to be relative in PathExpr");
    PathExprItem* pxi = new PathExprItem(aExpr, pathOp);
    if (!pxi) {
        delete aExpr;
        return NS_ERROR_OUT_OF_MEMORY;
    }
    nsresult rv = expressions.add(pxi);
    if (NS_FAILED(rv)) {
        delete pxi;
    }
    return rv;
} //-- addExpr

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult PathExpr::evalDescendants ( Expr aStep,
const txXPathNode aNode,
txIMatchContext aContext,
txNodeSet resNodes 
) [private]

Selects from the descendants of the context node all nodes that match the Expr.

Definition at line 178 of file PathExpr.cpp.

{
    txSingleNodeContext eContext(aNode, aContext);
    nsRefPtr<txAExprResult> res;
    nsresult rv = aStep->evaluate(&eContext, getter_AddRefs(res));
    NS_ENSURE_SUCCESS(rv, rv);

    if (res->getResultType() != txAExprResult::NODESET) {
        //XXX ErrorReport: report nonnodeset error
        return NS_ERROR_XSLT_NODESET_EXPECTED;
    }

    txNodeSet* oldSet = NS_STATIC_CAST(txNodeSet*,
                                       NS_STATIC_CAST(txAExprResult*, res));
    nsRefPtr<txNodeSet> newSet;
    rv = aContext->recycler()->getNonSharedNodeSet(oldSet,
                                                   getter_AddRefs(newSet));
    NS_ENSURE_SUCCESS(rv, rv);

    resNodes->addAndTransfer(newSet);

    MBool filterWS = aContext->isStripSpaceAllowed(aNode);

    txXPathTreeWalker walker(aNode);
    if (!walker.moveToFirstChild()) {
        return NS_OK;
    }

    do {
        const txXPathNode& node = walker.getCurrentPosition();
        if (!(filterWS && txXPathNodeUtils::isText(node) &&
              txXPathNodeUtils::isWhitespace(node))) {
            rv = evalDescendants(aStep, node, aContext, resNodes);
            NS_ENSURE_SUCCESS(rv, rv);
        }
    } while (walker.moveToNextSibling());

    return NS_OK;
} //-- evalDescendants

Here is the call graph for this function:

virtual nsresult Expr::evaluate ( txIEvalContext aContext,
txAExprResult **  aResult 
) [pure virtual, inherited]

Evaluates this Expr based on the given context node and processor state.

Parameters:
contextthe context node for evaluation of this Expr
psthe ContextState containing the stack information needed for evaluation
Returns:
the result of the evaluation

Here is the caller graph for this function:


Member Data Documentation

char Expr::affinity [inherited]

Definition at line 951 of file sqliteInt.h.

Definition at line 645 of file Expr.h.

u8 Expr::flags [inherited]

Definition at line 952 of file sqliteInt.h.

int Expr::iAgg [inherited]

Definition at line 962 of file sqliteInt.h.

int Expr::iColumn [inherited]

Definition at line 959 of file sqliteInt.h.

Definition at line 963 of file sqliteInt.h.

int Expr::iTable [inherited]

Definition at line 959 of file sqliteInt.h.

u8 Expr::op [inherited]

Reimplemented in MultiplicativeExpr, BooleanExpr, and AdditiveExpr.

Definition at line 950 of file sqliteInt.h.

AggInfo* Expr::pAggInfo [inherited]

Definition at line 961 of file sqliteInt.h.

CollSeq* Expr::pColl [inherited]

Definition at line 953 of file sqliteInt.h.

Expr* Expr::pLeft [inherited]

Definition at line 954 of file sqliteInt.h.

ExprList* Expr::pList [inherited]

Definition at line 955 of file sqliteInt.h.

Expr * Expr::pRight [inherited]

Definition at line 954 of file sqliteInt.h.

Schema* Expr::pSchema [inherited]

Definition at line 967 of file sqliteInt.h.

Select* Expr::pSelect [inherited]

Definition at line 964 of file sqliteInt.h.

Table* Expr::pTab [inherited]

Definition at line 966 of file sqliteInt.h.

Token Expr::span [inherited]

Definition at line 958 of file sqliteInt.h.

Token Expr::token [inherited]

Definition at line 957 of file sqliteInt.h.

Definition at line 632 of file Expr.h.


The documentation for this class was generated from the following files: