Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

int org::w3c::dom::xpath::TokenExecutor::execute ( std::vector< Token > &  tokens,
int  position,
const NodePtr  node,
NodeList result 
)

Execute a list upon a given node. For each Axis encountered, get the nodes encountered so far, and execute the rest of the list of tokens upon each of the nodes.

Definition at line 988 of file xpathtoken.cpp.

References org::w3c::dom::xpath::Token::execute(), org::w3c::dom::NodeList::getLength(), org::w3c::dom::xpath::Token::isAxis(), and org::w3c::dom::NodeList::item().

Referenced by execute().

{
    Stack stack(*this);

    NodeList contextNodes;

    int length = (int) tokens.size();

    for ( ; position < length ; position ++)
        {
        Token tok = tokens[position];
        if (tok.isAxis())
            {
            int pos2 = 0;
            //Do rest of tokens with the nodes we have found so far
            for (unsigned int i = 0 ; i<contextNodes.getLength() ; i++)
                {
                NodePtr contextNode = contextNodes.item(i);
                pos2 = execute(tokens, position, contextNode, result);
                if (pos2 < 0)
                    {
                    return -1;
                    }
                }
            position = pos2;
            }
        else
            {
            if (!tok.execute(stack))
                {
                return -1;
                } 
            }

        }//for

    return position;
}


Generated by  Doxygen 1.6.0   Back to index