Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:19

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  * 
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  * 
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_XPATHMATCHERSTACK_HPP)
0023 #define XERCESC_INCLUDE_GUARD_XPATHMATCHERSTACK_HPP
0024 
0025 
0026 // ---------------------------------------------------------------------------
0027 //  Includes
0028 // ---------------------------------------------------------------------------
0029 #include <xercesc/validators/schema/identity/XPathMatcher.hpp>
0030 
0031 XERCES_CPP_NAMESPACE_BEGIN
0032 
0033 class VALIDATORS_EXPORT XPathMatcherStack : public XMemory
0034 {
0035 public:
0036     // -----------------------------------------------------------------------
0037     //  Constructors/Destructor
0038     // -----------------------------------------------------------------------
0039     XPathMatcherStack(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0040     ~XPathMatcherStack();
0041 
0042     // -----------------------------------------------------------------------
0043     //  Getter methods
0044     // -----------------------------------------------------------------------
0045     XPathMatcher* getMatcherAt(const XMLSize_t index) const;
0046     XMLSize_t     getMatcherCount() const;
0047     XMLSize_t     size() const;
0048 
0049     // -----------------------------------------------------------------------
0050     //  Access methods
0051     // -----------------------------------------------------------------------
0052     void addMatcher(XPathMatcher* const matcher);
0053 
0054     // -----------------------------------------------------------------------
0055     //  Stack methods
0056     // -----------------------------------------------------------------------
0057     void pushContext();
0058     void popContext();
0059 
0060     // -----------------------------------------------------------------------
0061     //  Reset methods
0062     // -----------------------------------------------------------------------
0063     void clear();
0064 
0065 private:
0066     // -----------------------------------------------------------------------
0067     //  Private helper methods
0068     // -----------------------------------------------------------------------
0069     void cleanUp();
0070 
0071     // -----------------------------------------------------------------------
0072     //  Unimplemented constructors and operators
0073     // -----------------------------------------------------------------------
0074     XPathMatcherStack(const XPathMatcherStack& other);
0075     XPathMatcherStack& operator= (const XPathMatcherStack& other);
0076 
0077     // -----------------------------------------------------------------------
0078     //  Data members
0079     // -----------------------------------------------------------------------
0080     unsigned int                fMatchersCount;
0081     ValueStackOf<int>*          fContextStack;
0082     RefVectorOf<XPathMatcher>*  fMatchers;
0083 };
0084 
0085 // ---------------------------------------------------------------------------
0086 //  XPathMatcherStack: Getter methods
0087 // ---------------------------------------------------------------------------
0088 inline XMLSize_t XPathMatcherStack::size() const {
0089 
0090     return fContextStack->size();
0091 }
0092 
0093 inline XMLSize_t XPathMatcherStack::getMatcherCount() const {
0094 
0095     return fMatchersCount;
0096 }
0097 
0098 inline XPathMatcher*
0099 XPathMatcherStack::getMatcherAt(const XMLSize_t index) const {
0100 
0101     return fMatchers->elementAt(index);
0102 }
0103 
0104 // ---------------------------------------------------------------------------
0105 //  XPathMatcherStack: Stack methods
0106 // ---------------------------------------------------------------------------
0107 inline void XPathMatcherStack::pushContext() {
0108 
0109     fContextStack->push(fMatchersCount);
0110 }
0111 
0112 inline void XPathMatcherStack::popContext() {
0113 
0114     fMatchersCount = fContextStack->pop();
0115 }
0116 
0117 // ---------------------------------------------------------------------------
0118 //  XPathMatcherStack: Access methods
0119 // ---------------------------------------------------------------------------
0120 inline void XPathMatcherStack::addMatcher(XPathMatcher* const matcher) {
0121 
0122     if (fMatchersCount == fMatchers->size()) {
0123 
0124         fMatchers->addElement(matcher);
0125         fMatchersCount++;
0126     }
0127     else {
0128         fMatchers->setElementAt(matcher, fMatchersCount++);
0129     }
0130 }
0131 
0132 XERCES_CPP_NAMESPACE_END
0133 
0134 #endif
0135 
0136 /**
0137   * End of file XPathMatcherStack.hpp
0138   */
0139