Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | Private Attributes
LocationStep Class Reference

#include <Expr.h>

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

List of all members.

Public Types

enum  LocationStepType {
  ANCESTOR_AXIS = 0, ANCESTOR_OR_SELF_AXIS, ATTRIBUTE_AXIS, CHILD_AXIS,
  DESCENDANT_AXIS, DESCENDANT_OR_SELF_AXIS, FOLLOWING_AXIS, FOLLOWING_SIBLING_AXIS,
  NAMESPACE_AXIS, PARENT_AXIS, PRECEDING_AXIS, PRECEDING_SIBLING_AXIS,
  SELF_AXIS
}

Public Member Functions

 LocationStep (nsAutoPtr< txNodeTest > &aNodeTest, LocationStepType aAxisIdentifier)
 Creates a new LocationStep using the given NodeExpr and Axis Identifier.
nsresult add (Expr *aExpr)
 Adds the given Expr to the list.
nsresult evaluatePredicates (txNodeSet *aNodes, txIMatchContext *aContext)
MBool isEmpty ()
 returns true if this predicate list is empty
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

Protected Attributes

List predicates

Private Member Functions

void fromDescendants (const txXPathNode &aNode, txIMatchContext *aCs, txNodeSet *aNodes)
void fromDescendantsRev (const txXPathNode &aNode, txIMatchContext *aCs, txNodeSet *aNodes)

Private Attributes

nsAutoPtr< txNodeTestmNodeTest
LocationStepType mAxisIdentifier

Detailed Description

Definition at line 359 of file Expr.h.


Member Enumeration Documentation

Enumerator:
ANCESTOR_AXIS 
ANCESTOR_OR_SELF_AXIS 
ATTRIBUTE_AXIS 
CHILD_AXIS 
DESCENDANT_AXIS 
DESCENDANT_OR_SELF_AXIS 
FOLLOWING_AXIS 
FOLLOWING_SIBLING_AXIS 
NAMESPACE_AXIS 
PARENT_AXIS 
PRECEDING_AXIS 
PRECEDING_SIBLING_AXIS 
SELF_AXIS 

Definition at line 363 of file Expr.h.


Constructor & Destructor Documentation

LocationStep::LocationStep ( nsAutoPtr< txNodeTest > &  aNodeTest,
LocationStepType  aAxisIdentifier 
) [inline]

Creates a new LocationStep using the given NodeExpr and Axis Identifier.

Parameters:
nodeExprthe NodeExpr to use when matching Nodes
axisIdentifierthe Axis Identifier in which to search for nodes

Definition at line 384 of file Expr.h.

        : mNodeTest(aNodeTest),
          mAxisIdentifier(aAxisIdentifier)
    {
    }

Member Function Documentation

nsresult PredicateList::add ( Expr aExpr) [inherited]

Adds the given Expr to the list.

The ownership of the given Expr is passed over the PredicateList, even on failure.

Parameters:
aExprthe Expr to add to the list
Returns:
nsresult indicating out of memory

Definition at line 68 of file PredicateList.cpp.

{
    NS_ASSERTION(aExpr, "missing expression");
    nsresult rv = predicates.add(aExpr);
    if (NS_FAILED(rv)) {
        delete aExpr;
    }
    return rv;
} // add

Here is the call graph for this function:

Here is the caller 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:

nsresult PredicateList::evaluatePredicates ( txNodeSet aNodes,
txIMatchContext aContext 
) [inherited]

Definition at line 79 of file PredicateList.cpp.

{
    NS_ASSERTION(nodes, "called evaluatePredicates with NULL NodeSet");
    nsresult rv = NS_OK;

    txListIterator iter(&predicates);
    while (iter.hasNext() && !nodes->isEmpty()) {
        Expr* expr = (Expr*)iter.next();
        txNodeSetContext predContext(nodes, aContext);
        /*
         * add nodes to newNodes that match the expression
         * or, if the result is a number, add the node with the right
         * position
         */
        PRInt32 index = 0;
        while (predContext.hasNext()) {
            predContext.next();
            nsRefPtr<txAExprResult> exprResult;
            rv = expr->evaluate(&predContext, getter_AddRefs(exprResult));
            NS_ENSURE_SUCCESS(rv, rv);

            // handle default, [position() == numberValue()]
            if (exprResult->getResultType() == txAExprResult::NUMBER) {
                if ((double)predContext.position() == exprResult->numberValue()) {
                    nodes->mark(index);
                }
            }
            else if (exprResult->booleanValue()) {
                nodes->mark(index);
            }
            ++index;
        }
        // sweep the non-marked nodes
        nodes->sweep();
    }

    return NS_OK;
}

Here is the call graph for this function:

void LocationStep::fromDescendants ( const txXPathNode aNode,
txIMatchContext aCs,
txNodeSet aNodes 
) [private]

Definition at line 241 of file LocationStep.cpp.

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

    do {
        const txXPathNode& child = walker.getCurrentPosition();
        if (mNodeTest->matches(child, aCs)) {
            aNodes->append(child);
        }
        fromDescendants(child, aCs, aNodes);
    } while (walker.moveToNextSibling());
}

Here is the call graph for this function:

void LocationStep::fromDescendantsRev ( const txXPathNode aNode,
txIMatchContext aCs,
txNodeSet aNodes 
) [private]

Definition at line 259 of file LocationStep.cpp.

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

    do {
        const txXPathNode& child = walker.getCurrentPosition();
        fromDescendantsRev(child, aCs, aNodes);

        if (mNodeTest->matches(child, aCs)) {
            aNodes->append(child);
        }

    } while (walker.moveToPreviousSibling());
}

Here is the call graph for this function:

MBool PredicateList::isEmpty ( ) [inherited]

returns true if this predicate list is empty

Definition at line 122 of file PredicateList.cpp.

{
    return (MBool)(predicates.getLength() == 0);
} // isEmpty

Here is the call graph for this function:


Member Data Documentation

char Expr::affinity [inherited]

Definition at line 951 of file sqliteInt.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.

Definition at line 400 of file Expr.h.

Definition at line 399 of file Expr.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.

List PredicateList::predicates [protected, inherited]

Definition at line 356 of file Expr.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 391 of file Expr.h.


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