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

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

Original Xerces files with import mods for icxercesc

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 VALIDATORS_EXPORT XPathMatcherStack : public XMemory
34{
35public:
36    // -----------------------------------------------------------------------
37    //  Constructors/Destructor
38    // -----------------------------------------------------------------------
39    XPathMatcherStack(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
40        ~XPathMatcherStack();
41
42        // -----------------------------------------------------------------------
43    //  Getter methods
44    // -----------------------------------------------------------------------
45    XPathMatcher* getMatcherAt(const XMLSize_t index) const;
46    XMLSize_t     getMatcherCount() const;
47    XMLSize_t     size() const;
48
49        // -----------------------------------------------------------------------
50    //  Access methods
51    // -----------------------------------------------------------------------
52    void addMatcher(XPathMatcher* const matcher);
53
54        // -----------------------------------------------------------------------
55    //  Stack methods
56    // -----------------------------------------------------------------------
57    void pushContext();
58    void popContext();
59
60        // -----------------------------------------------------------------------
61    //  Reset methods
62    // -----------------------------------------------------------------------
63    void clear();
64
65private:
66    // -----------------------------------------------------------------------
67    //  Private helper methods
68    // -----------------------------------------------------------------------
69    void cleanUp();
70
71    // -----------------------------------------------------------------------
72    //  Unimplemented constructors and operators
73    // -----------------------------------------------------------------------
74    XPathMatcherStack(const XPathMatcherStack& other);
75    XPathMatcherStack& operator= (const XPathMatcherStack& other);
76
77    // -----------------------------------------------------------------------
78    //  Data members
79    // -----------------------------------------------------------------------
80    unsigned int                fMatchersCount;
81    ValueStackOf<int>*          fContextStack;
82    RefVectorOf<XPathMatcher>*  fMatchers;
83};
84
85// ---------------------------------------------------------------------------
86//  XPathMatcherStack: Getter methods
87// ---------------------------------------------------------------------------
88inline XMLSize_t XPathMatcherStack::size() const {
89
90    return fContextStack->size();
91}
92
93inline XMLSize_t XPathMatcherStack::getMatcherCount() const {
94
95    return fMatchersCount;
96}
97
98inline XPathMatcher*
99XPathMatcherStack::getMatcherAt(const XMLSize_t index) const {
100
101    return fMatchers->elementAt(index);
102}
103
104// ---------------------------------------------------------------------------
105//  XPathMatcherStack: Stack methods
106// ---------------------------------------------------------------------------
107inline void XPathMatcherStack::pushContext() {
108
109    fContextStack->push(fMatchersCount);
110}
111
112inline void XPathMatcherStack::popContext() {
113
114    fMatchersCount = fContextStack->pop();
115}
116
117// ---------------------------------------------------------------------------
118//  XPathMatcherStack: Access methods
119// ---------------------------------------------------------------------------
120inline void XPathMatcherStack::addMatcher(XPathMatcher* const matcher) {
121
122    if (fMatchersCount == fMatchers->size()) {
123
124        fMatchers->addElement(matcher);
125        fMatchersCount++;
126    }
127    else {
128        fMatchers->setElementAt(matcher, fMatchersCount++);
129    }
130}
131
132XERCES_CPP_NAMESPACE_END
133
134#endif
135
136/**
137  * End of file XPathMatcherStack.hpp
138  */
139
Note: See TracBrowser for help on using the repository browser.