Back to home page

EIC code displayed by LXR

 
 

    


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

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_OP_HPP)
0023 #define XERCESC_INCLUDE_GUARD_OP_HPP
0024 
0025 // ---------------------------------------------------------------------------
0026 //  Includes
0027 // ---------------------------------------------------------------------------
0028 #include <xercesc/util/RefVectorOf.hpp>
0029 #include <xercesc/util/RuntimeException.hpp>
0030 
0031 XERCES_CPP_NAMESPACE_BEGIN
0032 
0033 // ---------------------------------------------------------------------------
0034 //  Forward Declaration
0035 // ---------------------------------------------------------------------------
0036 class Token;
0037 
0038 
0039 class XMLUTIL_EXPORT Op : public XMemory
0040 {
0041 public:
0042 
0043     typedef enum {
0044         O_DOT                       = 0,
0045         O_CHAR                      = 1,
0046         O_RANGE                     = 3,
0047         O_NRANGE                    = 4,
0048         O_ANCHOR                    = 5,
0049         O_STRING                    = 6,
0050         O_CLOSURE                   = 7,
0051         O_NONGREEDYCLOSURE          = 8,
0052         O_FINITE_CLOSURE            = 9,
0053         O_FINITE_NONGREEDYCLOSURE   = 10,
0054         O_QUESTION                  = 11,
0055         O_NONGREEDYQUESTION         = 12,
0056         O_UNION                     = 13,
0057         O_CAPTURE                   = 15,
0058         O_BACKREFERENCE             = 16
0059     } opType;
0060 
0061     // -----------------------------------------------------------------------
0062     //  Public Constructors and Destructor
0063     // -----------------------------------------------------------------------
0064     virtual ~Op() { }
0065 
0066     // -----------------------------------------------------------------------
0067     // Getter functions
0068     // -----------------------------------------------------------------------
0069             opType       getOpType() const;
0070             const Op*    getNextOp() const;
0071     virtual XMLInt32     getData() const;
0072     virtual XMLInt32     getData2() const;
0073     virtual XMLSize_t    getSize() const;
0074     virtual const Op*    elementAt(XMLSize_t index) const;
0075     virtual const Op*    getChild() const;
0076     virtual const Token* getToken() const;
0077     virtual const XMLCh* getLiteral() const;
0078 
0079     // -----------------------------------------------------------------------
0080     // Setter functions
0081     // -----------------------------------------------------------------------
0082     void setOpType(const opType type);
0083     void setNextOp(const Op* const next);
0084 
0085 protected:
0086     // -----------------------------------------------------------------------
0087     //  Protected Constructors
0088     // -----------------------------------------------------------------------
0089     Op(const opType type, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0090     friend class OpFactory;
0091 
0092     MemoryManager* const fMemoryManager;
0093 
0094 private:
0095     // -----------------------------------------------------------------------
0096     //  Unimplemented constructors and operators
0097     // -----------------------------------------------------------------------
0098     Op(const Op&);
0099     Op& operator=(const Op&);
0100 
0101     // -----------------------------------------------------------------------
0102     //  Private data members
0103     //
0104     //  fOpType
0105     //      Indicates the type of operation
0106     //
0107     //  fNextOp
0108     //      Points to the next operation in the chain
0109     // -----------------------------------------------------------------------
0110     opType      fOpType;
0111     const Op*   fNextOp;
0112 };
0113 
0114 
0115 class XMLUTIL_EXPORT CharOp: public Op {
0116 public:
0117     // -----------------------------------------------------------------------
0118     //  Public Constructors and Destructor
0119     // -----------------------------------------------------------------------
0120     CharOp(const opType type, const XMLInt32 charData, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0121     ~CharOp() {}
0122 
0123     // -----------------------------------------------------------------------
0124     // Getter functions
0125     // -----------------------------------------------------------------------
0126     XMLInt32 getData() const;
0127 
0128 private:
0129     // Private data members
0130     XMLInt32 fCharData;
0131 
0132     // -----------------------------------------------------------------------
0133     //  Unimplemented constructors and operators
0134     // -----------------------------------------------------------------------
0135     CharOp(const CharOp&);
0136     CharOp& operator=(const CharOp&);
0137 };
0138 
0139 class XMLUTIL_EXPORT UnionOp : public Op {
0140 public:
0141     // -----------------------------------------------------------------------
0142     //  Public Constructors and Destructor
0143     // -----------------------------------------------------------------------
0144     UnionOp(const opType type, const XMLSize_t size,
0145             MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0146     ~UnionOp() { delete fBranches; }
0147 
0148     // -----------------------------------------------------------------------
0149     // Getter functions
0150     // -----------------------------------------------------------------------
0151     XMLSize_t getSize() const;
0152     const Op* elementAt(XMLSize_t index) const;
0153 
0154     // -----------------------------------------------------------------------
0155     // Setter functions
0156     // -----------------------------------------------------------------------
0157     void addElement(Op* const op);
0158 
0159 private:
0160     // Private Data members
0161     RefVectorOf<Op>* fBranches;
0162 
0163     // -----------------------------------------------------------------------
0164     //  Unimplemented constructors and operators
0165     // -----------------------------------------------------------------------
0166     UnionOp(const UnionOp&);
0167     UnionOp& operator=(const UnionOp&);
0168 };
0169 
0170 
0171 class XMLUTIL_EXPORT ChildOp: public Op {
0172 public:
0173     // -----------------------------------------------------------------------
0174     //  Public Constructors and Destructor
0175     // -----------------------------------------------------------------------
0176     ChildOp(const opType type, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0177     ~ChildOp() {}
0178 
0179     // -----------------------------------------------------------------------
0180     // Getter functions
0181     // -----------------------------------------------------------------------
0182     const Op* getChild() const;
0183 
0184     // -----------------------------------------------------------------------
0185     // Setter functions
0186     // -----------------------------------------------------------------------
0187     void setChild(const Op* const child);
0188 
0189 private:
0190     // Private data members
0191     const Op* fChild;
0192 
0193     // -----------------------------------------------------------------------
0194     //  Unimplemented constructors and operators
0195     // -----------------------------------------------------------------------
0196     ChildOp(const ChildOp&);
0197     ChildOp& operator=(const ChildOp&);
0198 };
0199 
0200 class XMLUTIL_EXPORT ModifierOp: public ChildOp {
0201 public:
0202     // -----------------------------------------------------------------------
0203     //  Public Constructors and Destructor
0204     // -----------------------------------------------------------------------
0205     ModifierOp(const opType type, const XMLInt32 v1, const XMLInt32 v2, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0206     ~ModifierOp() {}
0207 
0208     // -----------------------------------------------------------------------
0209     // Getter functions
0210     // -----------------------------------------------------------------------
0211     XMLInt32 getData() const;
0212     XMLInt32 getData2() const;
0213 
0214 private:
0215     // Private data members
0216     XMLInt32 fVal1;
0217     XMLInt32 fVal2;
0218 
0219     // -----------------------------------------------------------------------
0220     //  Unimplemented constructors and operators
0221     // -----------------------------------------------------------------------
0222     ModifierOp(const ModifierOp&);
0223     ModifierOp& operator=(const ModifierOp&);
0224 };
0225 
0226 class XMLUTIL_EXPORT RangeOp: public Op {
0227 public:
0228     // -----------------------------------------------------------------------
0229     //  Public Constructors and Destructor
0230     // -----------------------------------------------------------------------
0231     RangeOp(const opType type, const Token* const token, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0232     ~RangeOp() {}
0233 
0234     // -----------------------------------------------------------------------
0235     // Getter functions
0236     // -----------------------------------------------------------------------
0237     const Token* getToken() const;
0238 
0239 private:
0240     // Private data members
0241     const Token* fToken;
0242 
0243     // -----------------------------------------------------------------------
0244     //  Unimplemented constructors and operators
0245     // -----------------------------------------------------------------------
0246     RangeOp(const RangeOp&);
0247     RangeOp& operator=(const RangeOp&);
0248 };
0249 
0250 class XMLUTIL_EXPORT StringOp: public Op {
0251 public:
0252     // -----------------------------------------------------------------------
0253     //  Public Constructors and Destructor
0254     // -----------------------------------------------------------------------
0255     StringOp(const opType type, const XMLCh* const literal, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0256     ~StringOp() { fMemoryManager->deallocate(fLiteral);}
0257 
0258     // -----------------------------------------------------------------------
0259     // Getter functions
0260     // -----------------------------------------------------------------------
0261     const XMLCh* getLiteral() const;
0262 
0263 private:
0264     // Private data members
0265     XMLCh* fLiteral;
0266 
0267     // -----------------------------------------------------------------------
0268     //  Unimplemented constructors and operators
0269     // -----------------------------------------------------------------------
0270     StringOp(const StringOp&);
0271     StringOp& operator=(const StringOp&);
0272 };
0273 
0274 // ---------------------------------------------------------------------------
0275 //  Op: getter methods
0276 // ---------------------------------------------------------------------------
0277 inline Op::opType Op::getOpType() const {
0278 
0279     return fOpType;
0280 }
0281 
0282 inline const Op* Op::getNextOp() const {
0283 
0284     return fNextOp;
0285 }
0286 
0287 // ---------------------------------------------------------------------------
0288 //  Op: setter methods
0289 // ---------------------------------------------------------------------------
0290 inline void Op::setOpType(const Op::opType type) {
0291 
0292     fOpType = type;
0293 }
0294 
0295 inline void Op::setNextOp(const Op* const nextOp) {
0296     
0297     fNextOp = nextOp;
0298 }
0299 
0300 XERCES_CPP_NAMESPACE_END
0301 
0302 #endif
0303 
0304 /**
0305   * End of file Op.hpp
0306   */