18 #if !defined(XPATHEXPRESSION_HEADER_GUARD_1357924680)
19 #define XPATHEXPRESSION_HEADER_GUARD_1357924680
54 using xercesc::MemoryManager;
74 #define XALAN_XPATH_EXPRESSION_USE_ITERATORS
76 #if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
388 eOP_EXTFUNCTION = 23,
421 eOP_LOCATIONPATH = 25,
441 eNODETYPE_COMMENT = 27,
496 eNODETYPE_ANYELEMENT = 33,
508 eFROM_ANCESTORS = 34,
509 eFROM_ANCESTORS_OR_SELF = 35,
510 eFROM_ATTRIBUTES = 36,
512 eFROM_DESCENDANTS = 38,
513 eFROM_DESCENDANTS_OR_SELF = 39,
514 eFROM_FOLLOWING = 40,
515 eFROM_FOLLOWING_SIBLINGS = 41,
517 eFROM_PRECEDING = 43,
518 eFROM_PRECEDING_SIBLINGS = 44,
520 eFROM_NAMESPACE = 46,
531 eOP_MATCHPATTERN = 48,
541 eOP_LOCATIONPATHPATTERN = 49,
544 eMATCH_ATTRIBUTE = 50,
545 eMATCH_ANY_ANCESTOR = 51,
546 eMATCH_IMMEDIATE_ANCESTOR = 52,
547 eMATCH_ANY_ANCESTOR_WITH_PREDICATE = 53,
548 eMATCH_ANY_ANCESTOR_WITH_FUNCTION_CALL = 54,
559 eOP_PREDICATE_WITH_POSITION = 55,
565 eOP_FUNCTION_POSITION = 56,
566 eOP_FUNCTION_LAST = 57,
567 eOP_FUNCTION_COUNT = 58,
568 eOP_FUNCTION_NOT = 59,
569 eOP_FUNCTION_TRUE = 60,
570 eOP_FUNCTION_FALSE = 61,
571 eOP_FUNCTION_BOOLEAN = 62,
572 eOP_FUNCTION_NAME_0 = 63,
573 eOP_FUNCTION_NAME_1 = 64,
574 eOP_FUNCTION_LOCALNAME_0 = 65,
575 eOP_FUNCTION_LOCALNAME_1 = 66,
576 eOP_FUNCTION_FLOOR = 67,
577 eOP_FUNCTION_CEILING = 68,
578 eOP_FUNCTION_ROUND = 69,
579 eOP_FUNCTION_NUMBER_0 = 70,
580 eOP_FUNCTION_NUMBER_1 = 71,
581 eOP_FUNCTION_STRING_0 = 72,
582 eOP_FUNCTION_STRING_1 = 73,
583 eOP_FUNCTION_STRINGLENGTH_0 = 74,
584 eOP_FUNCTION_STRINGLENGTH_1 = 75,
585 eOP_FUNCTION_NAMESPACEURI_0 = 76,
586 eOP_FUNCTION_NAMESPACEURI_1 = 77,
587 eOP_FUNCTION_SUM = 78,
588 eOP_FUNCTION_CONCAT = 79,
608 MemoryManager& theManager);
714 s_opCodeMapLengthIndex = 1
725 return m_opMap.getMemoryManager();
766 if (theSize > s_opCodeMapLengthIndex)
770 return m_opMap[s_opCodeMapLengthIndex];
780 OpCodeMapPositionType
783 #if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
784 return m_opMap.begin();
796 return theDifference >= 0 &&
797 theDifference < opCodeMapSize();
800 #if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
804 return theIndex >= 0 && theIndex < opCodeMapSize();
817 assert(theIndex < opCodeMapLength());
819 return m_opMap[theIndex];
833 assert(opPos < getInitialOpCodePosition() + opCodeMapLength());
835 #if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
839 return m_opMap[opPos];
855 assert(theOpCodeMapIndex < opCodeMapLength());
857 m_opMap[theOpCodeMapIndex] = theValue;
863 return getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
874 getOpCodeLengthFromOpMap(OpCodeMapPositionType opPos,
875 MemoryManager& theManager)
const;
877 #if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
886 getOpCodeLengthFromOpMap(OpCodeMapSizeType theIndex,
887 MemoryManager& theManager)
const;
890 #if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
898 OpCodeMapPositionType
901 assert(opPos < getInitialOpCodePosition() + opCodeMapLength());
903 return opPos + *(opPos + s_opCodeMapLengthIndex);
915 #if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
921 assert(theIndex < opCodeMapLength());
923 assert(theIndex + m_opMap[theIndex + s_opCodeMapLengthIndex] ==
941 OpCodeMapSizeType theIndex,
942 const OpCodeMapValueVectorType& theArgs);
951 appendOpCode(eOpCodes theOpCode);
966 setOpCodeArgs(theOpCode,
982 OpCodeMapSizeType theIndex,
983 eOpCodes theOldOpCode,
984 eOpCodes theNewOpCode);
995 OpCodeMapSizeType theIndex);
1009 assert(theIndex < opCodeMapSize());
1011 updateOpCodeLength(m_opMap[theIndex], theIndex);
1023 updateShiftedOpCodeLength(
1024 OpCodeMapValueType theOpCode,
1025 OpCodeMapSizeType theOriginalIndex,
1026 OpCodeMapSizeType theNewIndex);
1040 OpCodeMapValueType theOpCode,
1041 OpCodeMapSizeType theIndex);
1051 isNodeTestOpCode(OpCodeMapValueType theOpCode);
1059 updateOpCodeLengthAfterNodeTest(OpCodeMapSizeType theIndex);
1069 return tokenQueueSize() > m_currentPosition ? true :
false;
1086 return thePosition < tokenQueueSize();
1097 return m_currentPosition;
1106 m_currentPosition = 0;
1118 assert(thePosition < tokenQueueSize());
1120 return &m_tokenQueue[thePosition];
1131 if (hasMoreTokens() ==
true)
1133 return getToken(m_currentPosition++);
1149 if (m_currentPosition > 0)
1151 return getToken(--m_currentPosition);
1179 calculateRelativePosition(theOffset, theDirection);
1181 if (thePosition == tokenQueueSize())
1187 return getToken(thePosition);
1199 m_tokenQueue.push_back(
1202 DoubleSupport::toDouble(theToken, getMemoryManager()),
1204 getMemoryManager()));
1218 m_tokenQueue.push_back(
1222 getMemoryManager()));
1234 m_tokenQueue.insert(
1235 m_tokenQueue.begin() + (m_currentPosition - 1),
1238 DoubleSupport::toDouble(theToken, getMemoryManager()),
1239 getMemoryManager()));
1254 m_tokenQueue.insert(
1255 m_tokenQueue.begin() + (m_currentPosition - 1),
1259 getMemoryManager()));
1275 calculateRelativePosition(theOffset, theDirection);
1276 assert(thePosition < tokenQueueSize());
1278 m_tokenQueue[thePosition].set(
1280 DoubleSupport::toDouble(theString, getMemoryManager()));
1292 OpCodeMapSizeType theStartPosition = 0)
const;
1302 OstreamType& theStream,
1303 OpCodeMapSizeType theStartPosition = 0)
const;
1314 TokenQueueSizeType theStartPosition = 0)
const;
1324 OstreamType& theStream,
1325 TokenQueueSizeType theStartPosition = 0)
const;
1333 dumpRemainingTokenQueue(
PrintWriter& thePrintWriter)
const;
1342 dumpRemainingTokenQueue(
1343 OstreamType& theStream,
1344 MemoryManager& theMemoryManager)
const;
1356 m_opMap.push_back(theValue);
1359 ++m_opMap[s_opCodeMapLengthIndex];
1369 pushArgumentOnOpCodeMap(
const XToken& theXToken);
1388 pushArgumentOnOpCodeMap(
1399 pushNumberLiteralOnOpCodeMap(
double theNumber);
1409 assert(theIndex >= 0 &&
1420 pushCurrentTokenOnOpCodeMap();
1430 m_currentPattern = &thePattern;
1441 assert(m_currentPattern != 0);
1443 return *m_currentPattern;
1457 TokenQueuePositionType
1458 calculateRelativePosition(
1459 TokenQueuePositionType theOffset,
1460 eRelativeDirection theDirection)
const
1462 if (theDirection == eRelativeBackward &&
1463 theOffset <= m_currentPosition)
1465 return m_currentPosition - theOffset;
1467 else if (theDirection == eRelativeForward &&
1468 m_currentPosition + theOffset < tokenQueueSize())
1470 return m_currentPosition + theOffset;
1474 return tokenQueueSize();
1484 OpCodeMapType m_opMap;
1490 OpCodeMapSizeType m_lastOpCodeIndex;
1497 TokenQueueType m_tokenQueue;
1502 TokenQueueSizeType m_currentPosition;
1507 const XalanDOMString* m_currentPattern;
1512 eDefaultOpMapSize = 100,
1513 eDefaultTokenQueueSize = 30
1516 NumberLiteralValueVectorType m_numberLiteralValues;
1525 #endif // XPATHEXPRESSION_HEADER_GUARD_1357924680