18 #if !defined(XPATHEXPRESSION_HEADER_GUARD_1357924680)
19 #define XPATHEXPRESSION_HEADER_GUARD_1357924680
32 #if defined(XALAN_CLASSIC_IOSTREAMS)
54 XALAN_CPP_NAMESPACE_BEGIN
78 #define XALAN_XPATH_EXPRESSION_USE_ITERATORS
80 #if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
392 eOP_EXTFUNCTION = 23,
425 eOP_LOCATIONPATH = 25,
445 eNODETYPE_COMMENT = 27,
500 eNODETYPE_ANYELEMENT = 33,
512 eFROM_ANCESTORS = 34,
513 eFROM_ANCESTORS_OR_SELF = 35,
514 eFROM_ATTRIBUTES = 36,
516 eFROM_DESCENDANTS = 38,
517 eFROM_DESCENDANTS_OR_SELF = 39,
518 eFROM_FOLLOWING = 40,
519 eFROM_FOLLOWING_SIBLINGS = 41,
521 eFROM_PRECEDING = 43,
522 eFROM_PRECEDING_SIBLINGS = 44,
524 eFROM_NAMESPACE = 46,
535 eOP_MATCHPATTERN = 48,
545 eOP_LOCATIONPATHPATTERN = 49,
548 eMATCH_ATTRIBUTE = 50,
549 eMATCH_ANY_ANCESTOR = 51,
550 eMATCH_IMMEDIATE_ANCESTOR = 52,
551 eMATCH_ANY_ANCESTOR_WITH_PREDICATE = 53,
552 eMATCH_ANY_ANCESTOR_WITH_FUNCTION_CALL = 54,
563 eOP_PREDICATE_WITH_POSITION = 55,
569 eOP_FUNCTION_POSITION = 56,
570 eOP_FUNCTION_LAST = 57,
571 eOP_FUNCTION_COUNT = 58,
572 eOP_FUNCTION_NOT = 59,
573 eOP_FUNCTION_TRUE = 60,
574 eOP_FUNCTION_FALSE = 61,
575 eOP_FUNCTION_BOOLEAN = 62,
576 eOP_FUNCTION_NAME_0 = 63,
577 eOP_FUNCTION_NAME_1 = 64,
578 eOP_FUNCTION_LOCALNAME_0 = 65,
579 eOP_FUNCTION_LOCALNAME_1 = 66,
580 eOP_FUNCTION_FLOOR = 67,
581 eOP_FUNCTION_CEILING = 68,
582 eOP_FUNCTION_ROUND = 69,
583 eOP_FUNCTION_NUMBER_0 = 70,
584 eOP_FUNCTION_NUMBER_1 = 71,
585 eOP_FUNCTION_STRING_0 = 72,
586 eOP_FUNCTION_STRING_1 = 73,
587 eOP_FUNCTION_STRINGLENGTH_0 = 74,
588 eOP_FUNCTION_STRINGLENGTH_1 = 75,
589 eOP_FUNCTION_NAMESPACEURI_0 = 76,
590 eOP_FUNCTION_NAMESPACEURI_1 = 77,
591 eOP_FUNCTION_SUM = 78,
592 eOP_FUNCTION_CONCAT = 79,
612 MemoryManager& theManager);
716 #if defined(XALAN_INLINE_INITIALIZATION)
721 s_opCodeMapLengthIndex = 1
733 return m_opMap.getMemoryManager();
774 if (theSize > s_opCodeMapLengthIndex)
778 return m_opMap[s_opCodeMapLengthIndex];
788 OpCodeMapPositionType
791 #if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
792 return m_opMap.begin();
804 return theDifference >= 0 &&
805 theDifference < opCodeMapSize();
808 #if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
812 return theIndex >= 0 && theIndex < opCodeMapSize();
825 assert(theIndex < opCodeMapLength());
827 return m_opMap[theIndex];
841 assert(opPos < getInitialOpCodePosition() + opCodeMapLength());
843 #if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
847 return m_opMap[opPos];
863 assert(theOpCodeMapIndex < opCodeMapLength());
865 m_opMap[theOpCodeMapIndex] = theValue;
882 getOpCodeLengthFromOpMap(OpCodeMapPositionType opPos,
883 MemoryManager& theManager)
const;
885 #if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
894 getOpCodeLengthFromOpMap(OpCodeMapSizeType theIndex,
895 MemoryManager& theManager)
const;
898 #if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
906 OpCodeMapPositionType
909 assert(opPos < getInitialOpCodePosition() + opCodeMapLength());
911 return opPos + *(opPos + s_opCodeMapLengthIndex);
923 #if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
929 assert(theIndex < opCodeMapLength());
931 assert(theIndex + m_opMap[theIndex + s_opCodeMapLengthIndex] ==
949 OpCodeMapSizeType theIndex,
950 const OpCodeMapValueVectorType& theArgs);
959 appendOpCode(eOpCodes theOpCode);
974 setOpCodeArgs(theOpCode,
990 OpCodeMapSizeType theIndex,
991 eOpCodes theOldOpCode,
992 eOpCodes theNewOpCode);
1003 OpCodeMapSizeType theIndex);
1017 assert(theIndex < opCodeMapSize());
1019 updateOpCodeLength(m_opMap[theIndex], theIndex);
1031 updateShiftedOpCodeLength(
1032 OpCodeMapValueType theOpCode,
1033 OpCodeMapSizeType theOriginalIndex,
1034 OpCodeMapSizeType theNewIndex);
1048 OpCodeMapValueType theOpCode,
1049 OpCodeMapSizeType theIndex);
1059 isNodeTestOpCode(OpCodeMapValueType theOpCode);
1067 updateOpCodeLengthAfterNodeTest(OpCodeMapSizeType theIndex);
1077 return tokenQueueSize() > m_currentPosition ? true :
false;
1094 return thePosition < tokenQueueSize();
1105 return m_currentPosition;
1114 m_currentPosition = 0;
1126 assert(thePosition < tokenQueueSize());
1128 return &m_tokenQueue[thePosition];
1139 if (hasMoreTokens() ==
true)
1141 return getToken(m_currentPosition++);
1157 if (m_currentPosition > 0)
1159 return getToken(--m_currentPosition);
1187 calculateRelativePosition(theOffset, theDirection);
1189 if (thePosition == tokenQueueSize())
1195 return getToken(thePosition);
1207 m_tokenQueue.push_back(
1212 getMemoryManager()));
1226 m_tokenQueue.push_back(
1230 getMemoryManager()));
1242 m_tokenQueue.insert(
1243 m_tokenQueue.begin() + (m_currentPosition - 1),
1247 getMemoryManager()));
1262 m_tokenQueue.insert(
1263 m_tokenQueue.begin() + (m_currentPosition - 1),
1267 getMemoryManager()));
1283 calculateRelativePosition(theOffset, theDirection);
1284 assert(thePosition < tokenQueueSize());
1286 m_tokenQueue[thePosition].set(
1300 OpCodeMapSizeType theStartPosition = 0)
const;
1310 OstreamType& theStream,
1311 OpCodeMapSizeType theStartPosition = 0)
const;
1322 TokenQueueSizeType theStartPosition = 0)
const;
1332 OstreamType& theStream,
1333 TokenQueueSizeType theStartPosition = 0)
const;
1341 dumpRemainingTokenQueue(
PrintWriter& thePrintWriter)
const;
1350 dumpRemainingTokenQueue(
1351 OstreamType& theStream,
1352 MemoryManager& theMemoryManager)
const;
1364 m_opMap.push_back(theValue);
1367 ++m_opMap[s_opCodeMapLengthIndex];
1377 pushArgumentOnOpCodeMap(
const XToken& theXToken);
1396 pushArgumentOnOpCodeMap(
1407 pushNumberLiteralOnOpCodeMap(
double theNumber);
1417 assert(theIndex >= 0 &&
1428 pushCurrentTokenOnOpCodeMap();
1438 m_currentPattern = &thePattern;
1449 assert(m_currentPattern != 0);
1451 return *m_currentPattern;
1465 TokenQueuePositionType
1466 calculateRelativePosition(
1467 TokenQueuePositionType theOffset,
1468 eRelativeDirection theDirection)
const
1470 if (theDirection == eRelativeBackward &&
1471 theOffset <= m_currentPosition)
1473 return m_currentPosition - theOffset;
1475 else if (theDirection == eRelativeForward &&
1476 m_currentPosition + theOffset < tokenQueueSize())
1478 return m_currentPosition + theOffset;
1482 return tokenQueueSize();
1492 OpCodeMapType m_opMap;
1498 OpCodeMapSizeType m_lastOpCodeIndex;
1505 TokenQueueType m_tokenQueue;
1510 TokenQueueSizeType m_currentPosition;
1520 eDefaultOpMapSize = 100,
1521 eDefaultTokenQueueSize = 30
1524 NumberLiteralValueVectorType m_numberLiteralValues;
1529 XALAN_CPP_NAMESPACE_END
1533 #endif // XPATHEXPRESSION_HEADER_GUARD_1357924680