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: Op.cpp 678879 2008-07-22 20:05:05Z amassari $
20  */
21 
22 // ---------------------------------------------------------------------------
23 //  Includes
24 // ---------------------------------------------------------------------------
25 #include <xercesc/util/regx/Op.hpp>
26 #include <xercesc/util/XMLString.hpp>
27 
28 XERCES_CPP_NAMESPACE_BEGIN
29 
30 // ---------------------------------------------------------------------------
31 //  Op: Constructors and Destructors
32 // ---------------------------------------------------------------------------
Op(const Op::opType type,MemoryManager * const manager)33 Op::Op(const Op::opType type, MemoryManager* const manager)
34     : fMemoryManager(manager)
35     , fOpType(type)
36     , fNextOp(0)
37 {
38 }
39 
40 // ---------------------------------------------------------------------------
41 //  Op: Getter methods
42 // ---------------------------------------------------------------------------
getSize() const43 XMLSize_t Op::getSize() const {
44 
45     ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager);
46     return 0; // for compilers that complain about no return value
47 }
48 
getData() const49 XMLInt32 Op::getData() const {
50 
51     ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager);
52     return 0; // for compilers that complain about no return value
53 }
54 
getData2() const55 XMLInt32 Op::getData2() const {
56 
57     ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager);
58     return 0; // for compilers that complain about no return value
59 }
60 
elementAt(XMLSize_t) const61 const Op* Op::elementAt(XMLSize_t) const {
62 
63     ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager);
64     return 0; // for compilers that complain about no return value
65 }
66 
getChild() const67 const Op* Op::getChild() const {
68 
69     ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager);
70     return 0; // for compilers that complain about no return value
71 }
72 
getLiteral() const73 const XMLCh* Op::getLiteral() const {
74 
75     ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager);
76     return 0; // for compilers that complain about no return value
77 }
78 
getToken() const79 const Token* Op::getToken() const {
80 
81     ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager);
82     return 0; // for compilers that complain about no return value
83 }
84 
85 
86 // ---------------------------------------------------------------------------
87 //  CharOp: Constructors and Destuctors
88 // ---------------------------------------------------------------------------
CharOp(const Op::opType type,const XMLInt32 charData,MemoryManager * const manager)89 CharOp::CharOp(const Op::opType type, const XMLInt32 charData
90                , MemoryManager* const manager)
91     : Op(type, manager)
92       , fCharData(charData) {
93 }
94 
95 // ---------------------------------------------------------------------------
96 //  CharOp: Getter methods
97 // ---------------------------------------------------------------------------
getData() const98 XMLInt32 CharOp::getData() const {
99 
100     return fCharData;
101 }
102 
103 // ---------------------------------------------------------------------------
104 //  UnionOp: Constructors and Destuctors
105 // ---------------------------------------------------------------------------
UnionOp(const Op::opType type,const XMLSize_t size,MemoryManager * const manager)106 UnionOp::UnionOp(const Op::opType type, const XMLSize_t size, MemoryManager* const manager)
107     : Op(type, manager)
108       , fBranches(new (manager) RefVectorOf<Op> (size, false, manager)) {
109 
110 }
111 
112 // ---------------------------------------------------------------------------
113 //  UnionOp: Getter/Setter methods
114 // ---------------------------------------------------------------------------
getSize() const115 XMLSize_t UnionOp::getSize() const {
116 
117     return fBranches->size();
118 }
119 
elementAt(XMLSize_t index) const120 const Op* UnionOp::elementAt(XMLSize_t index) const {
121 
122     return fBranches->elementAt(index);
123 }
124 
addElement(Op * const op)125 void UnionOp::addElement(Op* const op) {
126 
127     fBranches->addElement(op);
128 }
129 
130 // ---------------------------------------------------------------------------
131 //  ChildOp: Constructors and Destuctors
132 // ---------------------------------------------------------------------------
ChildOp(const Op::opType type,MemoryManager * const manager)133 ChildOp::ChildOp(const Op::opType type, MemoryManager* const manager)
134     : Op(type, manager)
135       , fChild(0) {
136 
137 }
138 
139 // ---------------------------------------------------------------------------
140 //  ChildOp: Getter/Setter methods
141 // ---------------------------------------------------------------------------
getChild() const142 const Op* ChildOp::getChild() const {
143 
144     return fChild;
145 }
146 
setChild(const Op * const child)147 void ChildOp::setChild(const Op* const child) {
148 
149     fChild = child;
150 }
151 
152 // ---------------------------------------------------------------------------
153 //  ModifierOp: Constructors and Destuctors
154 // ---------------------------------------------------------------------------
ModifierOp(const Op::opType type,const XMLInt32 v1,const XMLInt32 v2,MemoryManager * const manager)155 ModifierOp::ModifierOp(const Op::opType type, const XMLInt32 v1, const XMLInt32 v2
156                        , MemoryManager* const manager)
157     : ChildOp(type, manager)
158       , fVal1(v1)
159       , fVal2(v2) {
160 
161 }
162 
163 // ---------------------------------------------------------------------------
164 //  ModifierOp: Getter methods
165 // ---------------------------------------------------------------------------
getData() const166 XMLInt32 ModifierOp::getData() const {
167 
168     return fVal1;
169 }
170 
getData2() const171 XMLInt32 ModifierOp::getData2() const {
172 
173     return fVal2;
174 }
175 
176 // ---------------------------------------------------------------------------
177 //  RangeOp: Constructors and Destuctors
178 // ---------------------------------------------------------------------------
RangeOp(const Op::opType type,const Token * const token,MemoryManager * const manager)179 RangeOp::RangeOp(const Op::opType type, const Token* const token, MemoryManager* const manager)
180     : Op (type, manager)
181       , fToken(token) {
182 
183 }
184 
185 // ---------------------------------------------------------------------------
186 //  RangeOp: Getter methods
187 // ---------------------------------------------------------------------------
getToken() const188 const Token* RangeOp::getToken() const {
189 
190     return fToken;
191 }
192 
193 
194 // ---------------------------------------------------------------------------
195 //  StringOp: Constructors and Destuctors
196 // ---------------------------------------------------------------------------
StringOp(const Op::opType type,const XMLCh * const literal,MemoryManager * const manager)197 StringOp::StringOp(const Op::opType type, const XMLCh* const literal
198                    , MemoryManager* const manager)
199     : Op (type, manager)
200       , fLiteral(XMLString::replicate(literal, manager)) {
201 
202 }
203 
204 // ---------------------------------------------------------------------------
205 //  StringOp: Getter methods
206 // ---------------------------------------------------------------------------
getLiteral() const207 const XMLCh* StringOp::getLiteral() const {
208 
209     return fLiteral;
210 }
211 
212 XERCES_CPP_NAMESPACE_END
213 
214 /**
215   * End file Op.cpp
216   */
217