1 | /*
|
---|
2 | * Copyright 2001-2004 The Apache Software Foundation.
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | */
|
---|
16 |
|
---|
17 | /*
|
---|
18 | * $Id: IC_Selector.hpp,v 1.9 2004/09/08 13:56:59 peiyongz Exp $
|
---|
19 | */
|
---|
20 |
|
---|
21 | #if !defined(IC_SELECTOR_HPP)
|
---|
22 | #define IC_SELECTOR_HPP
|
---|
23 |
|
---|
24 |
|
---|
25 | // ---------------------------------------------------------------------------
|
---|
26 | // Includes
|
---|
27 | // ---------------------------------------------------------------------------
|
---|
28 | #include <xercesc/validators/schema/identity/XPathMatcher.hpp>
|
---|
29 |
|
---|
30 | #include <xercesc/internal/XSerializable.hpp>
|
---|
31 |
|
---|
32 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
33 |
|
---|
34 | // ---------------------------------------------------------------------------
|
---|
35 | // Forward Declaration
|
---|
36 | // ---------------------------------------------------------------------------
|
---|
37 | class FieldActivator;
|
---|
38 |
|
---|
39 |
|
---|
40 | class VALIDATORS_EXPORT IC_Selector : public XSerializable, public XMemory
|
---|
41 | {
|
---|
42 | public:
|
---|
43 | // -----------------------------------------------------------------------
|
---|
44 | // Constructors/Destructor
|
---|
45 | // -----------------------------------------------------------------------
|
---|
46 | IC_Selector(XercesXPath* const xpath,
|
---|
47 | IdentityConstraint* const identityConstraint);
|
---|
48 | ~IC_Selector();
|
---|
49 |
|
---|
50 | // -----------------------------------------------------------------------
|
---|
51 | // operators
|
---|
52 | // -----------------------------------------------------------------------
|
---|
53 | bool operator== (const IC_Selector& other) const;
|
---|
54 | bool operator!= (const IC_Selector& other) const;
|
---|
55 |
|
---|
56 | // -----------------------------------------------------------------------
|
---|
57 | // Getter methods
|
---|
58 | // -----------------------------------------------------------------------
|
---|
59 | XercesXPath* getXPath() const { return fXPath; }
|
---|
60 | IdentityConstraint* getIdentityConstraint() const { return fIdentityConstraint; }
|
---|
61 |
|
---|
62 | // -----------------------------------------------------------------------
|
---|
63 | // Factory methods
|
---|
64 | // -----------------------------------------------------------------------
|
---|
65 | XPathMatcher* createMatcher(FieldActivator* const fieldActivator,
|
---|
66 | const int initialDepth,
|
---|
67 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
68 |
|
---|
69 | /***
|
---|
70 | * Support for Serialization/De-serialization
|
---|
71 | ***/
|
---|
72 | DECL_XSERIALIZABLE(IC_Selector)
|
---|
73 |
|
---|
74 | IC_Selector(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
75 |
|
---|
76 | private:
|
---|
77 | // -----------------------------------------------------------------------
|
---|
78 | // Unimplemented contstructors and operators
|
---|
79 | // -----------------------------------------------------------------------
|
---|
80 | IC_Selector(const IC_Selector& other);
|
---|
81 | IC_Selector& operator= (const IC_Selector& other);
|
---|
82 |
|
---|
83 | // -----------------------------------------------------------------------
|
---|
84 | // Data members
|
---|
85 | // -----------------------------------------------------------------------
|
---|
86 | XercesXPath* fXPath;
|
---|
87 | IdentityConstraint* fIdentityConstraint;
|
---|
88 | };
|
---|
89 |
|
---|
90 |
|
---|
91 | class VALIDATORS_EXPORT SelectorMatcher : public XPathMatcher
|
---|
92 | {
|
---|
93 | public:
|
---|
94 | // -----------------------------------------------------------------------
|
---|
95 | // Constructors/Destructor
|
---|
96 | // -----------------------------------------------------------------------
|
---|
97 | ~SelectorMatcher() {}
|
---|
98 |
|
---|
99 | int getInitialDepth() const { return fInitialDepth; }
|
---|
100 |
|
---|
101 | // -----------------------------------------------------------------------
|
---|
102 | // XMLDocumentHandler methods
|
---|
103 | // -----------------------------------------------------------------------
|
---|
104 | void startDocumentFragment();
|
---|
105 | void startElement(const XMLElementDecl& elemDecl,
|
---|
106 | const unsigned int urlId,
|
---|
107 | const XMLCh* const elemPrefix,
|
---|
108 | const RefVectorOf<XMLAttr>& attrList,
|
---|
109 | const unsigned int attrCount);
|
---|
110 | void endElement(const XMLElementDecl& elemDecl,
|
---|
111 | const XMLCh* const elemContent);
|
---|
112 |
|
---|
113 | private:
|
---|
114 | // -----------------------------------------------------------------------
|
---|
115 | // Constructors/Destructor
|
---|
116 | // -----------------------------------------------------------------------
|
---|
117 | SelectorMatcher(XercesXPath* const anXPath,
|
---|
118 | IC_Selector* const selector,
|
---|
119 | FieldActivator* const fieldActivator,
|
---|
120 | const int initialDepth,
|
---|
121 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
122 |
|
---|
123 | // -----------------------------------------------------------------------
|
---|
124 | // Unimplemented contstructors and operators
|
---|
125 | // -----------------------------------------------------------------------
|
---|
126 | SelectorMatcher(const SelectorMatcher& other);
|
---|
127 | SelectorMatcher& operator= (const SelectorMatcher& other);
|
---|
128 |
|
---|
129 | // -----------------------------------------------------------------------
|
---|
130 | // Friends
|
---|
131 | // -----------------------------------------------------------------------
|
---|
132 | friend class IC_Selector;
|
---|
133 |
|
---|
134 | // -----------------------------------------------------------------------
|
---|
135 | // Data members
|
---|
136 | // -----------------------------------------------------------------------
|
---|
137 | int fInitialDepth;
|
---|
138 | int fElementDepth;
|
---|
139 | int fMatchedDepth;
|
---|
140 | IC_Selector* fSelector;
|
---|
141 | FieldActivator* fFieldActivator;
|
---|
142 | };
|
---|
143 |
|
---|
144 | XERCES_CPP_NAMESPACE_END
|
---|
145 |
|
---|
146 | #endif
|
---|
147 |
|
---|
148 | /**
|
---|
149 | * End of file IC_Selector.hpp
|
---|
150 | */
|
---|
151 |
|
---|