Xalan-C++ API Documentation

The Xalan-C++ XSL Transformer Version 1.0

Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

XPathExpression Class Reference

#include <XPathExpression.hpp>

List of all members.

Public Types

Public Methods

Public Attributes

Static Public Methods


Detailed Description


Member Typedef Documentation

typedef std::set<OpCodeMapValueType> XPathExpression::NodeTestSetType

typedef std::map<int, int> XPathExpression::OpCodeLengthMapType

typedef OpCodeMapType::size_type XPathExpression::OpCodeMapSizeType

typedef std::vector<int> XPathExpression::OpCodeMapType

typedef OpCodeMapType::value_type XPathExpression::OpCodeMapValueType

typedef std::vector<OpCodeMapValueType> XPathExpression::OpCodeMapValueVectorType

typedef PatternMapType::size_type XPathExpression::PatternMapSizeType

typedef std::vector<int> XPathExpression::PatternMapType

typedef PatternMapType::value_type XPathExpression::PatternMapValueType

typedef TokenQueueType::size_type XPathExpression::TokenQueueSizeType

typedef std::deque<XToken> XPathExpression::TokenQueueType

typedef TokenQueueType::value_type XPathExpression::TokenQueueValueType


Member Enumeration Documentation

enum XPathExpression::eDummy

The length is always the opcode position + 1.

Length is always expressed as the opcode+length bytes, so it is always 2 or greater. This is the offset from the op code where the length is stored. It will always remain one.

Enumeration values:
s__opCodeMapLengthIndex  

enum XPathExpression::eOpCodes

List of operations codes.

Code for the descriptions of the operations codes: [UPPER CASE] indicates a literal value, [lower case] is a description of a value, ([length] always indicates the length of the operation, including the operations code and the length integer.) {UPPER CASE} indicates the given production, {description} is the description of a new production, (For instance, {boolean expression} means some expression that should be resolved to a boolean.) * means that it occurs zero or more times, + means that it occurs one or more times, ? means that it is optional.

returns: indicates what the production should return.

Enumeration values:
eENDOP   [ENDOP] Some operators may like to have a terminator.
eEMPTY   [EMPTY] Empty slot to indicate NULL.
eELEMWILDCARD   [ELEMWILDCARD] Means ELEMWILDCARD ("*"), used instead of string index in some places.
eOP_XPATH   [OP_XPATH] [length] {expression}.

returns: XNodeSet XNumber XString XBoolean XRTree XObject

eOP_OR   [OP_OR] [length] {boolean expression} {boolean expression}.

returns: XBoolean

eOP_AND   [OP_AND] [length] {boolean expression} {boolean expression}.

returns: XBoolean

eOP_NOTEQUALS   [OP_NOTEQUALS] [length] {expression} {expression}.

returns: XBoolean

eOP_EQUALS   [OP_EQUALS] [length] {expression} {expression}.

returns: XBoolean

eOP_LTE   [OP_LTE] (less-than-or-equals) [length] {number expression} {number expression}.

returns: XBoolean

eOP_LT   [OP_LT] (less-than) [length] {number expression} {number expression}.

returns: XBoolean

eOP_GTE   [OP_GTE] (greater-than-or-equals) [length] {number expression} {number expression}.

returns: XBoolean

eOP_GT   [OP_GT] (greater-than) [length] {number expression} {number expression}.

returns: XBoolean

eOP_PLUS   [OP_PLUS] [length] {number expression} {number expression}.

returns: XNumber

eOP_MINUS   [OP_MINUS] [length] {number expression} {number expression}.

returns: XNumber

eOP_MULT   [OP_MULT] [length] {number expression} {number expression}.

returns: XNumber

eOP_DIV   [OP_DIV] [length] {number expression} {number expression}.

returns: XNumber

eOP_MOD   [OP_MOD] [length] {number expression} {number expression}.

returns: XNumber

eOP_QUO   [OP_QUO] [length] {number expression} {number expression}.

returns: XNumber

eOP_NEG   [OP_NEG] [length] {number expression}.

returns: XNumber

eOP_STRING   [OP_STRING] (cast operation) [length] {expression}.

returns: XString

eOP_BOOL   [OP_BOOL] (cast operation) [length] {expression}.

returns: XBoolean

eOP_NUMBER   [OP_NUMBER] (cast operation) [length] {expression}.

returns: XBoolean

eOP_UNION   [OP_UNION] [length] {PathExpr}+.

returns: XNodeSet

eOP_LITERAL   [OP_LITERAL] [3] [index to token].

returns: XString

eOP_VARIABLE   [OP_VARIABLE] [3] [index to token].

returns: XString

eOP_GROUP   [OP_GROUP] [length] {expression}.

returns: XNodeSet XNumber XString XBoolean XRTree XObject

eOP_NUMBERLIT   [OP_NUMBERLIT] (Number literal.) [3] [index to token].

returns: XString

eOP_ARGUMENT   [OP_ARGUMENT] (Function argument.) [length] {expression}.

returns: XNodeSet XNumber XString XBoolean XRTree XObject

eOP_EXTFUNCTION   [OP_EXTFUNCTION] (Extension function.) [length] [index to namespace token] [index to function name token] {OP_ARGUMENT}*.

returns: XNodeSet XNumber XString XBoolean XRTree XObject

eOP_FUNCTION   [OP_FUNCTION] [length] [FUNC_name] {OP_ARGUMENT}* [ENDOP].

returns: XNodeSet XNumber XString XBoolean XRTree XObject

eOP_LOCATIONPATH   [OP_LOCATIONPATH] [length] {FROM_stepType} | {function}{predicate}* [ENDOP].

(Note that element and attribute namespaces and names can be wildcarded '*'.)

returns: XNodeSet

eOP_PREDICATE   [OP_PREDICATE] [length] {expression} [ENDOP] (For safety).

returns: XBoolean or XNumber

eNODETYPE_COMMENT   [NODETYPE_COMMENT] No size or arguments.

returns: XBoolean

eNODETYPE_TEXT   [NODETYPE_TEXT] No size or arguments.

returns: XBoolean

eNODETYPE_PI   [NODETYPE_PI] [index to token].

returns: XBoolean

eNODETYPE_NODE   [NODETYPE_NODE] No size or arguments.

returns: XBoolean

eNODENAME   [NODENAME] [index to ns token or EMPTY] [index to name token].

returns: XBoolean

eNODETYPE_ROOT   [NODETYPE_ROOT] No size or arguments.

returns: XBoolean

eNODETYPE_ANYELEMENT   [NODETYPE_ANY] No size or arguments.

returns: XBoolean

eFROM_ANCESTORS   [FROM_stepType] [length, including predicates] [length of just the step, without the predicates] {node test} {predicates}?

returns: XBoolean

eFROM_ANCESTORS_OR_SELF  
eFROM_ATTRIBUTES  
eFROM_CHILDREN  
eFROM_DESCENDANTS  
eFROM_DESCENDANTS_OR_SELF  
eFROM_FOLLOWING  
eFROM_FOLLOWING_SIBLINGS  
eFROM_PARENT  
eFROM_PRECEDING  
eFROM_PRECEDING_SIBLINGS  
eFROM_SELF  
eFROM_NAMESPACE  
eFROM_ROOT  
eOP_MATCHPATTERN   [OP_UNION] [length] {PathExpr}+.

returns: XNodeSet

eOP_LOCATIONPATHPATTERN   [OP_UNION] [length] {PathExpr}+.

returns: XNodeSet

eMATCH_ATTRIBUTE  
eMATCH_ANY_ANCESTOR  
eMATCH_IMMEDIATE_ANCESTOR  
eMATCH_ANY_ANCESTOR_WITH_PREDICATE  
eOpCodeNextAvailable  

Constructor & Destructor Documentation

explicit XPathExpression::XPathExpression ()

XPathExpression::~XPathExpression ()


Member Function Documentation

void XPathExpression::adjustPattern ( OpCodeMapSizeType theIndex,
PatternMapValueType theAdjustment)

Adjust the value of a pattern at a specified index in the pattern map.

Parameters:
theIndex   index in map
theAdjustment   value of adjustment to add

void XPathExpression::appendOpCode ( eOpCodes theOpCode,
const OpCodeMapValueVectorType & theArgs)

Add an operation code with supplied arguments to the list.

Parameters:
theOpCode   operation code
theArgs   vector or arguments to supply

void XPathExpression::appendOpCode ( eOpCodes theOpCode)

Add an operation code to the list.

Parameters:
theOpCode   operation code

void XPathExpression::dumpOpCodeMap ( PrintWriter & thePrintWriter,
OpCodeMapSizeType theStartPosition = 0) const

Diagnostic function to output the operation code map.

Parameters:
thePrintWriter   output device
theStartPosition   starting position in map

void XPathExpression::dumpRemainingTokenQueue ( PrintWriter & thePrintWriter) const

Diagnostic function to output the remaining tokens in the token queue.

Parameters:
thePrintWriter   output device

void XPathExpression::dumpTokenQueue ( PrintWriter & thePrintWriter,
TokenQueueSizeType theStartPosition = 0) const

Diagnostic function to output the token queue.

Parameters:
thePrintWriter   output device
theStartPosition   starting position in token queue

const XalanDOMString & XPathExpression::getCurrentPattern () const

Retrieve the current pattern in the pattern map.

Returns:
string for current match pattern

OpCodeMapValueType XPathExpression::getNextOpCodePosition ( OpCodeMapSizeType opPos) const

Retrieve the position of the next operation code at a specified position in the list.

Parameters:
opPos   position in list
Returns:
position of next operation code

const XObject * XPathExpression::getNextToken ()

Retrieve the next token in the token queue.

Returns:
pointer to XObject token

OpCodeMapValueType XPathExpression::getOpCodeLength ( OpCodeMapSizeType opPos) const

Retrieve the length of an operation code at a specified position in the list.

Parameters:
opPos   position in list
Returns:
length of operation code

OpCodeMapValueType XPathExpression::getOpCodeMapValue ( OpCodeMapSizeType opPos) const

Retrieve the value of an operation code at a specified position in the list.

Parameters:
opPos   position in list
Returns:
value of operation code

PatternMapValueType XPathExpression::getPattern ( PatternMapSizeType thePatternPosition) const

Retrieve a pattern in the pattern map at the specified position.

position in the token queue.

Parameters:
thePatternPosition   position in pattern map
Returns:
match pattern

PatternMapValueType XPathExpression::getPattern ( int thePatternPosition) const

Retrieve a pattern in the pattern map at the specified position.

position in the token queue.

Parameters:
thePatternPosition   position in pattern map
Returns:
match pattern

const XObject * XPathExpression::getPreviousToken ()

Retrieve the previous token in the token queue.

Returns:
pointer to XObject token

const XObject * XPathExpression::getRelativeToken ( int theOffset) const

Retrieve a token at the specified offset relative to the current position in the token queue.

Parameters:
theOffset   offset from current position
Returns:
pointer to XObject token

const XObject * XPathExpression::getToken ( TokenQueueSizeType thePosition) const

Retrieve a token at the specified position in the token queue.

Parameters:
thePosition   position in queue
Returns:
pointer to XObject token

TokenQueueSizeType XPathExpression::getTokenPosition () const

Retrieve the current position in the token queue.

Returns:
position in queue

bool XPathExpression::hasMoreTokens () const

Whether there are any more tokens in the token queue.

Returns:
true if there are more tokens

OpCodeMapValueType XPathExpression::insertOpCode ( eOpCodes theOpCode,
OpCodeMapSizeType theIndex)

Insert an operation code at a specified index in the list.

Parameters:
theOpCode   operation code
theIndex   index in list

void XPathExpression::insertToken ( double theToken)

Insert a token onto the token queue at the current position.

Parameters:
theToken   the string value to push

void XPathExpression::insertToken ( const XalanDOMString & theToken)

Insert a token onto the token queue at the current position.

Parameters:
theToken   the string value to push

bool XPathExpression::isNodeTestOpCode ( OpCodeMapValueType theOpCode) [static]

Whether the operation code is one of the node test types, for example, "ancestor::" or "child::".

Parameters:
theOpCode   operation code
Returns:
true if code represents a node test

OpCodeMapValueType XPathExpression::opCodeMapLength () const

Retrieve length of the operations code map stored in the map.

The length of the entire map is stored after the first op code. That offset is determined by this const static member. Note that as expressions are defined recursively, this is really just the length of the first expression in the map, which is the top of the parse tree. Any subexpression will also have a length entry at the same offset from the beginning of the subexpression.

Returns:
length of operations code map

OpCodeMapSizeType XPathExpression::opCodeMapSize () const

Retrieve number of elements in the operations code map.

Returns:
size of operations code map

PatternMapSizeType XPathExpression::patternMapSize () const

Retrieve number of elements in the pattern map.

Returns:
size of pattern map

void XPathExpression::pushArgumentOnOpCodeMap ( double theToken)

Push a token onto the token queue and its index onto the operations code map.

Parameters:
theToken   number value of the token to push

void XPathExpression::pushArgumentOnOpCodeMap ( const XalanDOMString & theToken)

Push a token onto the token queue and its index onto the operations code map.

Parameters:
theToken   string value of the token to push

void XPathExpression::pushCurrentTokenOnOpCodeMap ()

Push the current position in the token queue onto the operations code map.

void XPathExpression::pushPattern ( PatternMapValueType thePattern)

Push a pattern onto the pattern map.

Parameters:
thePattern   match pattern to push

void XPathExpression::pushToken ( double theToken)

Push a token onto the token queue.

Parameters:
theToken   the number value to push

void XPathExpression::pushToken ( const XalanDOMString & theToken)

Push a token onto the token queue.

Parameters:
theToken   the string value to push

void XPathExpression::replaceRelativeToken ( int theOffset,
double theToken)

Replace a token in the token queue.

Parameters:
theOffset   the offset at which to replace the token.
theToken   double value for the new token

void XPathExpression::replaceRelativeToken ( int theOffset,
const XalanDOMString & theToken)

Replace a token in the token queue.

Parameters:
theOffset   the offset at which to replace the token.
theToken   string value for the new token

void XPathExpression::reset ()

Reset the expression.

void XPathExpression::resetTokenPosition ()

Set the current position in the token queue to zero.

void XPathExpression::setCurrentPattern ( const XalanDOMString & thePattern)

Change the current pattern in the pattern map.

Parameters:
thePattern   match pattern to make current

void XPathExpression::setOpCodeArgs ( eOpCodes theOpCode,
OpCodeMapSizeType theIndex,
const OpCodeMapValueVectorType & theArgs)

Set the arguments for an operation code at a specified index in the list.

Parameters:
opPos   position in list
theOpCode   operation code
theIndex   index in list
theArgs   vector or arguments to supply

void XPathExpression::setTokenPosition ( int thePosition)

Set the current position in the token queue to a specified value.

Parameters:
thePosition   value of position to set

void XPathExpression::setTokenPosition ( TokenQueueSizeType thePosition)

Set the current position in the token queue to a specified value.

Parameters:
thePosition   value of position to set

void XPathExpression::shrink ()

Shrink internal tables.

TokenQueueSizeType XPathExpression::tokenQueueSize () const

Retrieve number of elements in the token queue.

Returns:
size of token queue

void XPathExpression::updateOpCodeLength ( OpCodeMapValueType theOpCode,
OpCodeMapSizeType theIndex)

Update the length of an operation code at a specified index in the list.

This presumes that the other opcodes have been appended to the expression, and that the specified op code's length needs to be set. The size includes the normal length of the opcode, plus the length of its subexpressions.

Parameters:
theOpCode   operation code at specified index
theIndex   index in list

void XPathExpression::updateOpCodeLength ( OpCodeMapSizeType theIndex)

Update the length of an operation code at a specified index in the list.

This presumes that the other opcodes have been appended to the expression, and that the specified op code's length needs to be set. The size includes the normal length of the opcode, plus the length of its subexpressions.

Parameters:
theIndex   index in list

void XPathExpression::updateOpCodeLengthAfterNodeTest ( OpCodeMapSizeType theIndex)

Update the length of an operation code after a node test code.

Parameters:
theIndex   index in list

void XPathExpression::updateShiftedOpCodeLength ( OpCodeMapValueType theOpCode,
OpCodeMapSizeType theOriginalIndex,
OpCodeMapSizeType theNewIndex)

Update the length of an operation code that has moved to a new index in the list.

Parameters:
theOpCode   operation code
theOriginalIndex   original index in list
theNewIndex   new index in list

Member Data Documentation

XalanDOMString XPathExpression::m_currentPattern

The current pattern string, for diagnostics purposes.

TokenQueueSizeType XPathExpression::m_currentPosition

The current position in the token queue.

OpCodeMapSizeType XPathExpression::m_lastOpCodeIndex

The index of the last opcode that was appended or inserted.

OpCodeMapType XPathExpression::m_opMap

An operations map is used instead of a proper parse tree.

It contains operations codes and indexes into the m_tokenQueue. We use an array instead of a full parse tree in order to cut down on the number of objects created.

PatternMapType XPathExpression::m_patternMap

This holds a map to the m_tokenQueue that tells where the top-level elements are.

It is used for pattern matching so the m_tokenQueue can be walked backwards. Each element that is a 'target', (right-most top level element name) has TARGETEXTRA added to it.

TokenQueueType XPathExpression::m_tokenQueue

The queue of used tokens.

The current token is the token at the end of the m_tokenQueue. The idea is that the queue can be marked and a sequence of tokens can be reused.


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

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSL Transformer Version 1.0
Copyright © 2000 The Apache Software Foundation. All Rights Reserved.