📄 xercesxpath.hpp
字号:
EXPRTOKEN_OPERATOR_PLUS = 24, EXPRTOKEN_OPERATOR_MINUS = 25, EXPRTOKEN_OPERATOR_EQUAL = 26, EXPRTOKEN_OPERATOR_NOT_EQUAL = 27, EXPRTOKEN_OPERATOR_LESS = 28, EXPRTOKEN_OPERATOR_LESS_EQUAL = 29, EXPRTOKEN_OPERATOR_GREATER = 30, EXPRTOKEN_OPERATOR_GREATER_EQUAL = 31, EXPRTOKEN_FUNCTION_NAME = 32, EXPRTOKEN_AXISNAME_ANCESTOR = 33, EXPRTOKEN_AXISNAME_ANCESTOR_OR_SELF = 34, EXPRTOKEN_AXISNAME_ATTRIBUTE = 35, EXPRTOKEN_AXISNAME_CHILD = 36, EXPRTOKEN_AXISNAME_DESCENDANT = 37, EXPRTOKEN_AXISNAME_DESCENDANT_OR_SELF = 38, EXPRTOKEN_AXISNAME_FOLLOWING = 39, EXPRTOKEN_AXISNAME_FOLLOWING_SIBLING = 40, EXPRTOKEN_AXISNAME_NAMESPACE = 41, EXPRTOKEN_AXISNAME_PARENT = 42, EXPRTOKEN_AXISNAME_PRECEDING = 43, EXPRTOKEN_AXISNAME_PRECEDING_SIBLING = 44, EXPRTOKEN_AXISNAME_SELF = 45, EXPRTOKEN_LITERAL = 46, EXPRTOKEN_NUMBER = 47, EXPRTOKEN_VARIABLE_REFERENCE = 48 }; // ----------------------------------------------------------------------- // Constructors/Destructor // ----------------------------------------------------------------------- XercesXPath(const XMLCh* const xpathExpr, XMLStringPool* const stringPool, NamespaceScope* const scopeContext, const unsigned int emptyNamespaceId, const bool isSelector = false, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); ~XercesXPath(); // ----------------------------------------------------------------------- // Operators // ----------------------------------------------------------------------- bool operator== (const XercesXPath& other) const; bool operator!= (const XercesXPath& other) const; // ----------------------------------------------------------------------- // Constructors/Destructor // ----------------------------------------------------------------------- RefVectorOf<XercesLocationPath>* getLocationPaths() const; /*** * Support for Serialization/De-serialization ***/ DECL_XSERIALIZABLE(XercesXPath) XercesXPath(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); XMLCh* getExpression();private: // ----------------------------------------------------------------------- // Unimplemented contstructors and operators // ----------------------------------------------------------------------- XercesXPath(const XercesXPath& other); XercesXPath& operator= (const XercesXPath& other); // ----------------------------------------------------------------------- // Helper methods // ----------------------------------------------------------------------- void cleanUp(); void checkForSelectedAttributes(); void parseExpression(XMLStringPool* const stringPool, NamespaceScope* const scopeContext); // ----------------------------------------------------------------------- // Data members // ----------------------------------------------------------------------- unsigned int fEmptyNamespaceId; XMLCh* fExpression; RefVectorOf<XercesLocationPath>* fLocationPaths; MemoryManager* fMemoryManager;};class VALIDATORS_EXPORT XPathScanner : public XMemory{public: // ----------------------------------------------------------------------- // Constants // ----------------------------------------------------------------------- enum { CHARTYPE_INVALID = 0, // invalid XML character CHARTYPE_OTHER = 1, // not special - one of "#%&;?\^`{}~" or DEL CHARTYPE_WHITESPACE = 2, // one of "\t\n\r " (0x09, 0x0A, 0x0D, 0x20) CHARTYPE_EXCLAMATION = 3, // '!' (0x21) CHARTYPE_QUOTE = 4, // '\"' or '\'' (0x22 and 0x27) CHARTYPE_DOLLAR = 5, // '$' (0x24) CHARTYPE_OPEN_PAREN = 6, // '(' (0x28) CHARTYPE_CLOSE_PAREN = 7, // ')' (0x29) CHARTYPE_STAR = 8, // '*' (0x2A) CHARTYPE_PLUS = 9, // '+' (0x2B) CHARTYPE_COMMA = 10, // ',' (0x2C) CHARTYPE_MINUS = 11, // '-' (0x2D) CHARTYPE_PERIOD = 12, // '.' (0x2E) CHARTYPE_SLASH = 13, // '/' (0x2F) CHARTYPE_DIGIT = 14, // '0'-'9' (0x30 to 0x39) CHARTYPE_COLON = 15, // ':' (0x3A) CHARTYPE_LESS = 16, // '<' (0x3C) CHARTYPE_EQUAL = 17, // '=' (0x3D) CHARTYPE_GREATER = 18, // '>' (0x3E) CHARTYPE_ATSIGN = 19, // '@' (0x40) CHARTYPE_LETTER = 20, // 'A'-'Z' or 'a'-'z' (0x41 to 0x5A and 0x61 to 0x7A) CHARTYPE_OPEN_BRACKET = 21, // '[' (0x5B) CHARTYPE_CLOSE_BRACKET = 22, // ']' (0x5D) CHARTYPE_UNDERSCORE = 23, // '_' (0x5F) CHARTYPE_UNION = 24, // '|' (0x7C) CHARTYPE_NONASCII = 25 // Non-ASCII Unicode codepoint (>= 0x80) }; // ----------------------------------------------------------------------- // Constructors/Destructor // ----------------------------------------------------------------------- XPathScanner(XMLStringPool* const stringPool); virtual ~XPathScanner() {} // ----------------------------------------------------------------------- // Scan methods // ----------------------------------------------------------------------- bool scanExpression(const XMLCh* const data, int currentOffset, const int endOffset, ValueVectorOf<int>* const tokens);protected: // ----------------------------------------------------------------------- // Helper methods // ----------------------------------------------------------------------- /** * This method adds the specified token to the token list. By default, * this method allows all tokens. However, subclasses can can override * this method in order to disallow certain tokens from being used in the * scanned XPath expression. This is a convenient way of allowing only * a subset of XPath. */ virtual void addToken(ValueVectorOf<int>* const tokens, const int aToken);private: // ----------------------------------------------------------------------- // Unimplemented contstructors and operators // ----------------------------------------------------------------------- XPathScanner(const XPathScanner& other); XPathScanner& operator= (const XPathScanner& other); // ----------------------------------------------------------------------- // Helper methods // ----------------------------------------------------------------------- void init(); // ----------------------------------------------------------------------- // Scan methods // ----------------------------------------------------------------------- int scanNCName(const XMLCh* const data, const int endOffset, int currentOffset); int scanNumber(const XMLCh* const data, const int endOffset, int currentOffset, ValueVectorOf<int>* const tokens); // ----------------------------------------------------------------------- // Data members // ----------------------------------------------------------------------- int fAndSymbol; int fOrSymbol; int fModSymbol; int fDivSymbol; int fCommentSymbol; int fTextSymbol; int fPISymbol; int fNodeSymbol; int fAncestorSymbol; int fAncestorOrSelfSymbol; int fAttributeSymbol; int fChildSymbol; int fDescendantSymbol; int fDescendantOrSelfSymbol; int fFollowingSymbol; int fFollowingSiblingSymbol; int fNamespaceSymbol; int fParentSymbol; int fPrecedingSymbol; int fPrecedingSiblingSymbol; int fSelfSymbol; XMLStringPool* fStringPool; static const XMLByte fASCIICharMap[128];};class VALIDATORS_EXPORT XPathScannerForSchema: public XPathScanner{public: // ----------------------------------------------------------------------- // Constructors/Destructor // ----------------------------------------------------------------------- XPathScannerForSchema(XMLStringPool* const stringPool); ~XPathScannerForSchema() {}protected: // ----------------------------------------------------------------------- // Helper methods // ----------------------------------------------------------------------- void addToken(ValueVectorOf<int>* const tokens, const int aToken);private: // ----------------------------------------------------------------------- // Unimplemented contstructors and operators // ----------------------------------------------------------------------- XPathScannerForSchema(const XPathScannerForSchema& other); XPathScannerForSchema& operator= (const XPathScannerForSchema& other);};// ---------------------------------------------------------------------------// XercesLocationPath: Access methods// ---------------------------------------------------------------------------inline unsigned int XercesLocationPath::getStepSize() const { if (fSteps) return fSteps->size(); return 0;}inline void XercesLocationPath::addStep(XercesStep* const aStep) { fSteps->addElement(aStep);}inline XercesStep* XercesLocationPath::getStep(const unsigned int index) const { if (fSteps) return fSteps->elementAt(index); return 0;}// ---------------------------------------------------------------------------// XercesScanner: Helper methods// ---------------------------------------------------------------------------inline void XPathScanner::addToken(ValueVectorOf<int>* const tokens, const int aToken) { tokens->addElement(aToken);}// ---------------------------------------------------------------------------// XercesXPath: Getter methods// ---------------------------------------------------------------------------inline RefVectorOf<XercesLocationPath>* XercesXPath::getLocationPaths() const { return fLocationPaths;}inline XMLCh* XercesXPath::getExpression() { return fExpression;}XERCES_CPP_NAMESPACE_END#endif/** * End of file XercesPath.hpp */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -