source: icXML/icXML-devel/src/xercesc/validators/schema/identity/XPathMatcherStack.hpp @ 3565

Last change on this file since 3565 was 3565, checked in by cameron, 6 years ago

Updates to xercesc sources

File size: 4.8 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id: XPathMatcherStack.hpp 932887 2010-04-11 13:04:59Z borisk $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_XPATHMATCHERSTACK_HPP)
23#define XERCESC_INCLUDE_GUARD_XPATHMATCHERSTACK_HPP
24
25
26// ---------------------------------------------------------------------------
27//  Includes
28// ---------------------------------------------------------------------------
29#include <xercesc/validators/schema/identity/XPathMatcher.hpp>
30
31XERCES_CPP_NAMESPACE_BEGIN
32
33class XMLStringPool;
34
35class VALIDATORS_EXPORT XPathMatcherStack : public XMemory
36{
37public:
38    // -----------------------------------------------------------------------
39    //  Constructors/Destructor
40    // -----------------------------------------------------------------------
41    XPathMatcherStack(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
42        ~XPathMatcherStack();
43
44        // -----------------------------------------------------------------------
45    //  Getter methods
46    // -----------------------------------------------------------------------
47    XPathMatcher* getMatcherAt(const XMLSize_t index) const;
48    XMLSize_t     getMatcherCount() const;
49    XMLSize_t     size() const;
50
51        // -----------------------------------------------------------------------
52    //  Access methods
53    // -----------------------------------------------------------------------
54    void addMatcher(XPathMatcher* const matcher);
55
56        // -----------------------------------------------------------------------
57    //  Stack methods
58    // -----------------------------------------------------------------------
59    void pushContext();
60    void popContext();
61
62        // -----------------------------------------------------------------------
63    //  Reset methods
64    // -----------------------------------------------------------------------
65    void clear();
66
67private:
68    // -----------------------------------------------------------------------
69    //  Private helper methods
70    // -----------------------------------------------------------------------
71    void cleanUp();
72
73    // -----------------------------------------------------------------------
74    //  Unimplemented constructors and operators
75    // -----------------------------------------------------------------------
76    XPathMatcherStack(const XPathMatcherStack& other);
77    XPathMatcherStack& operator= (const XPathMatcherStack& other);
78
79    // -----------------------------------------------------------------------
80    //  Data members
81    // -----------------------------------------------------------------------
82    unsigned int                fMatchersCount;
83    ValueStackOf<int>*          fContextStack;
84    RefVectorOf<XPathMatcher>*  fMatchers;
85};
86
87// ---------------------------------------------------------------------------
88//  XPathMatcherStack: Getter methods
89// ---------------------------------------------------------------------------
90inline XMLSize_t XPathMatcherStack::size() const {
91
92    return fContextStack->size();
93}
94
95inline XMLSize_t XPathMatcherStack::getMatcherCount() const {
96
97    return fMatchersCount;
98}
99
100inline XPathMatcher*
101XPathMatcherStack::getMatcherAt(const XMLSize_t index) const {
102
103    return fMatchers->elementAt(index);
104}
105
106// ---------------------------------------------------------------------------
107//  XPathMatcherStack: Stack methods
108// ---------------------------------------------------------------------------
109inline void XPathMatcherStack::pushContext() {
110
111    fContextStack->push(fMatchersCount);
112}
113
114inline void XPathMatcherStack::popContext() {
115
116    fMatchersCount = fContextStack->pop();
117}
118
119// ---------------------------------------------------------------------------
120//  XPathMatcherStack: Access methods
121// ---------------------------------------------------------------------------
122inline void XPathMatcherStack::addMatcher(XPathMatcher* const matcher) {
123
124    if (fMatchersCount == fMatchers->size()) {
125
126        fMatchers->addElement(matcher);
127        fMatchersCount++;
128    }
129    else {
130        fMatchers->setElementAt(matcher, fMatchersCount++);
131    }
132}
133
134XERCES_CPP_NAMESPACE_END
135
136#endif
137
138/**
139  * End of file XPathMatcherStack.hpp
140  */
141
Note: See TracBrowser for help on using the repository browser.