📄 xercesxpath.hpp
字号:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//* * $Id: XercesXPath.hpp 568078 2007-08-21 11:43:25Z amassari $ */#if !defined(XERCESXPATH_HPP)#define XERCESXPATH_HPP// ---------------------------------------------------------------------------// Includes// ---------------------------------------------------------------------------#include <xercesc/util/QName.hpp>#include <xercesc/util/RefVectorOf.hpp>#include <xercesc/util/ValueVectorOf.hpp>#include <xercesc/internal/XSerializable.hpp>XERCES_CPP_NAMESPACE_BEGIN// ---------------------------------------------------------------------------// Forward Declarations// ---------------------------------------------------------------------------class XMLStringPool;class NamespaceScope;class VALIDATORS_EXPORT XercesNodeTest : public XSerializable, public XMemory{public: // ----------------------------------------------------------------------- // Constants // ----------------------------------------------------------------------- enum { QNAME = 1, WILDCARD = 2, NODE = 3, NAMESPACE= 4, UNKNOWN }; // ----------------------------------------------------------------------- // Constructors/Destructor // ----------------------------------------------------------------------- XercesNodeTest(const short type, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); XercesNodeTest(const QName* const qName); XercesNodeTest(const XMLCh* const prefix, const unsigned int uriId, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); XercesNodeTest(const XercesNodeTest& other); ~XercesNodeTest() { delete fName; } // ----------------------------------------------------------------------- // Operators // ----------------------------------------------------------------------- XercesNodeTest& operator= (const XercesNodeTest& other); bool operator== (const XercesNodeTest& other) const; bool operator!= (const XercesNodeTest& other) const; // ----------------------------------------------------------------------- // Getter methods // ----------------------------------------------------------------------- short getType() const { return fType; } QName* getName() const { return fName; } /*** * Support for Serialization/De-serialization ***/ DECL_XSERIALIZABLE(XercesNodeTest) XercesNodeTest(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);private: // ----------------------------------------------------------------------- // Data members // ----------------------------------------------------------------------- short fType; QName* fName;};/** * A location path step comprised of an axis and node test. */class VALIDATORS_EXPORT XercesStep : public XSerializable, public XMemory{public: // ----------------------------------------------------------------------- // Constants // ----------------------------------------------------------------------- enum { // Axis type CHILD = 1, ATTRIBUTE = 2, SELF = 3, DESCENDANT = 4, UNKNOWN }; // ----------------------------------------------------------------------- // Constructors/Destructor // ----------------------------------------------------------------------- XercesStep(const unsigned short axisType, XercesNodeTest* const nodeTest); XercesStep(const XercesStep& other); ~XercesStep() { delete fNodeTest; } // ----------------------------------------------------------------------- // Operators // ----------------------------------------------------------------------- XercesStep& operator= (const XercesStep& other); bool operator== (const XercesStep& other) const; bool operator!= (const XercesStep& other) const; // ----------------------------------------------------------------------- // Getter methods // ----------------------------------------------------------------------- unsigned short getAxisType() const { return fAxisType; } XercesNodeTest* getNodeTest() const { return fNodeTest; } /*** * Support for Serialization/De-serialization ***/ DECL_XSERIALIZABLE(XercesStep) XercesStep(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);private: // ----------------------------------------------------------------------- // Data members // ----------------------------------------------------------------------- unsigned short fAxisType; XercesNodeTest* fNodeTest;};/** * A location path representation for an XPath expression. */class VALIDATORS_EXPORT XercesLocationPath : public XSerializable, public XMemory{public: // ----------------------------------------------------------------------- // Constructors/Destructor // ----------------------------------------------------------------------- XercesLocationPath(RefVectorOf<XercesStep>* const steps); ~XercesLocationPath() { delete fSteps; } // ----------------------------------------------------------------------- // Operators // ----------------------------------------------------------------------- bool operator== (const XercesLocationPath& other) const; bool operator!= (const XercesLocationPath& other) const; // ----------------------------------------------------------------------- // Access methods // ----------------------------------------------------------------------- unsigned int getStepSize() const; void addStep(XercesStep* const aStep); XercesStep* getStep(const unsigned int index) const; /*** * Support for Serialization/De-serialization ***/ DECL_XSERIALIZABLE(XercesLocationPath) XercesLocationPath(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);private: // ----------------------------------------------------------------------- // Unimplemented contstructors and operators // ----------------------------------------------------------------------- XercesLocationPath(const XercesLocationPath& other); XercesLocationPath& operator= (const XercesLocationPath& other); // ----------------------------------------------------------------------- // Data members // ----------------------------------------------------------------------- RefVectorOf<XercesStep>* fSteps;};class VALIDATORS_EXPORT XercesXPath : public XSerializable, public XMemory{public: // ----------------------------------------------------------------------- // Constants // ----------------------------------------------------------------------- /** * [28] ExprToken ::= '(' | ')' | '[' | ']' | '.' | '..' | '@' | ',' | '::' * | NameTest | NodeType | Operator | FunctionName * | AxisName | Literal | Number | VariableReference */ enum { EXPRTOKEN_OPEN_PAREN = 0, EXPRTOKEN_CLOSE_PAREN = 1, EXPRTOKEN_OPEN_BRACKET = 2, EXPRTOKEN_CLOSE_BRACKET = 3, EXPRTOKEN_PERIOD = 4, EXPRTOKEN_DOUBLE_PERIOD = 5, EXPRTOKEN_ATSIGN = 6, EXPRTOKEN_COMMA = 7, EXPRTOKEN_DOUBLE_COLON = 8, EXPRTOKEN_NAMETEST_ANY = 9, EXPRTOKEN_NAMETEST_NAMESPACE = 10, EXPRTOKEN_NAMETEST_QNAME = 11, EXPRTOKEN_NODETYPE_COMMENT = 12, EXPRTOKEN_NODETYPE_TEXT = 13, EXPRTOKEN_NODETYPE_PI = 14, EXPRTOKEN_NODETYPE_NODE = 15, EXPRTOKEN_OPERATOR_AND = 16, EXPRTOKEN_OPERATOR_OR = 17, EXPRTOKEN_OPERATOR_MOD = 18, EXPRTOKEN_OPERATOR_DIV = 19, EXPRTOKEN_OPERATOR_MULT = 20, EXPRTOKEN_OPERATOR_SLASH = 21, EXPRTOKEN_OPERATOR_DOUBLE_SLASH = 22, EXPRTOKEN_OPERATOR_UNION = 23, 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,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -