source: icXML/icXML-devel/src/xercesc/util/regx/OpFactory.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.1 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: OpFactory.hpp 678879 2008-07-22 20:05:05Z amassari $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_OPFACTORY_HPP)
23#define XERCESC_INCLUDE_GUARD_OPFACTORY_HPP
24
25// ---------------------------------------------------------------------------
26//  Includes
27// ---------------------------------------------------------------------------
28#include <xercesc/util/XMemory.hpp>
29#include <xercesc/util/RefVectorOf.hpp>
30
31XERCES_CPP_NAMESPACE_BEGIN
32
33// ---------------------------------------------------------------------------
34//  Forward Declaration
35// ---------------------------------------------------------------------------
36class Op;
37class CharOp;
38class UnionOp;
39class ChildOp;
40class RangeOp;
41class StringOp;
42class ModifierOp;
43class Token;
44
45/*
46 * A Factory class used by 'RegularExpression' to create different types of
47 * operations (Op) objects. The class will keep track of all objects created
48 * for cleanup purposes. Each 'RegularExpression' object will have its own
49 * instance of OpFactory and when a 'RegularExpression' object is deleted
50 * all associated Op objects will be deleted.
51 */
52
53class XMLUTIL_EXPORT OpFactory : public XMemory
54{
55public:
56    // -----------------------------------------------------------------------
57    //  Constructors and destructors
58    // -----------------------------------------------------------------------
59    OpFactory(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
60    ~OpFactory();
61
62    // -----------------------------------------------------------------------
63    //  Factory methods
64    // -----------------------------------------------------------------------
65    Op* createDotOp();
66    CharOp* createCharOp(XMLInt32 data);
67    CharOp* createAnchorOp(XMLInt32 data);
68    CharOp* createCaptureOp(int number, const Op* const next);
69    UnionOp* createUnionOp(XMLSize_t size);
70    ChildOp* createClosureOp(int id);
71    ChildOp* createNonGreedyClosureOp();
72    ChildOp* createQuestionOp(bool nonGreedy);
73    RangeOp* createRangeOp(const Token* const token);
74    CharOp* createBackReferenceOp(int refNo);
75    StringOp* createStringOp(const XMLCh* const literal);
76
77    // -----------------------------------------------------------------------
78    //  Reset methods
79    // -----------------------------------------------------------------------
80    /*
81     *    Remove all created Op objects from Vector
82     */
83    void reset();
84
85private:
86    // -----------------------------------------------------------------------
87    //  Unimplemented constructors and operators
88    // -----------------------------------------------------------------------
89    OpFactory(const OpFactory&);
90    OpFactory& operator=(const OpFactory&);
91
92    // -----------------------------------------------------------------------
93    //  Private data members
94    //
95    //  fOpVector
96    //      Contains Op objects. Used for memory cleanup.
97    // -----------------------------------------------------------------------
98    RefVectorOf<Op>* fOpVector;
99    MemoryManager*   fMemoryManager;
100};
101
102// ---------------------------------------------------------------------------
103//  OpFactory - Factory methods
104// ---------------------------------------------------------------------------
105inline void OpFactory::reset() {
106
107    fOpVector->removeAllElements();
108}
109
110XERCES_CPP_NAMESPACE_END
111
112#endif
113
114/**
115  *    End file OpFactory
116  */
Note: See TracBrowser for help on using the repository browser.