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_OPFACTORY_HPP)
0023 #define XERCESC_INCLUDE_GUARD_OPFACTORY_HPP
0024 
0025 // ---------------------------------------------------------------------------
0026 //  Includes
0027 // ---------------------------------------------------------------------------
0028 #include <xercesc/util/XMemory.hpp>
0029 #include <xercesc/util/RefVectorOf.hpp>
0030 
0031 XERCES_CPP_NAMESPACE_BEGIN
0032 
0033 // ---------------------------------------------------------------------------
0034 //  Forward Declaration
0035 // ---------------------------------------------------------------------------
0036 class Op;
0037 class CharOp;
0038 class UnionOp;
0039 class ChildOp;
0040 class RangeOp;
0041 class StringOp;
0042 class ModifierOp;
0043 class Token;
0044 
0045 /*
0046  * A Factory class used by 'RegularExpression' to create different types of
0047  * operations (Op) objects. The class will keep track of all objects created
0048  * for cleanup purposes. Each 'RegularExpression' object will have its own
0049  * instance of OpFactory and when a 'RegularExpression' object is deleted
0050  * all associated Op objects will be deleted.
0051  */
0052 
0053 class XMLUTIL_EXPORT OpFactory : public XMemory
0054 {
0055 public:
0056     // -----------------------------------------------------------------------
0057     //  Constructors and destructors
0058     // -----------------------------------------------------------------------
0059     OpFactory(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0060     ~OpFactory();
0061 
0062     // -----------------------------------------------------------------------
0063     //  Factory methods
0064     // -----------------------------------------------------------------------
0065     Op* createDotOp();
0066     CharOp* createCharOp(XMLInt32 data);
0067     CharOp* createAnchorOp(XMLInt32 data);
0068     CharOp* createCaptureOp(int number, const Op* const next);
0069     UnionOp* createUnionOp(XMLSize_t size);
0070     ChildOp* createClosureOp(int id);
0071     ChildOp* createNonGreedyClosureOp();
0072     ChildOp* createQuestionOp(bool nonGreedy);
0073     RangeOp* createRangeOp(const Token* const token);
0074     CharOp* createBackReferenceOp(int refNo);
0075     StringOp* createStringOp(const XMLCh* const literal);
0076 
0077     // -----------------------------------------------------------------------
0078     //  Reset methods
0079     // -----------------------------------------------------------------------
0080     /*
0081      *    Remove all created Op objects from Vector
0082      */
0083     void reset();
0084 
0085 private:
0086     // -----------------------------------------------------------------------
0087     //  Unimplemented constructors and operators
0088     // -----------------------------------------------------------------------
0089     OpFactory(const OpFactory&);
0090     OpFactory& operator=(const OpFactory&);
0091 
0092     // -----------------------------------------------------------------------
0093     //  Private data members
0094     //
0095     //  fOpVector
0096     //      Contains Op objects. Used for memory cleanup.
0097     // -----------------------------------------------------------------------
0098     RefVectorOf<Op>* fOpVector;
0099     MemoryManager*   fMemoryManager;
0100 };
0101 
0102 // ---------------------------------------------------------------------------
0103 //  OpFactory - Factory methods
0104 // ---------------------------------------------------------------------------
0105 inline void OpFactory::reset() {
0106 
0107     fOpVector->removeAllElements();
0108 }
0109 
0110 XERCES_CPP_NAMESPACE_END
0111 
0112 #endif
0113 
0114 /**
0115   *    End file OpFactory
0116   */