GME  13
Op.cpp
Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  * 
00009  *      http://www.apache.org/licenses/LICENSE-2.0
00010  * 
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 /*
00019  * $Id: Op.cpp 678879 2008-07-22 20:05:05Z amassari $
00020  */
00021 
00022 // ---------------------------------------------------------------------------
00023 //  Includes
00024 // ---------------------------------------------------------------------------
00025 #include <xercesc/util/regx/Op.hpp>
00026 #include <xercesc/util/XMLString.hpp>
00027 
00028 XERCES_CPP_NAMESPACE_BEGIN
00029 
00030 // ---------------------------------------------------------------------------
00031 //  Op: Constructors and Destructors
00032 // ---------------------------------------------------------------------------
00033 Op::Op(const Op::opType type, MemoryManager* const manager) 
00034     : fMemoryManager(manager)
00035     , fOpType(type)
00036     , fNextOp(0)
00037 {
00038 }
00039 
00040 // ---------------------------------------------------------------------------
00041 //  Op: Getter methods
00042 // ---------------------------------------------------------------------------
00043 XMLSize_t Op::getSize() const {
00044 
00045     ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager);
00046     return 0; // for compilers that complain about no return value
00047 }
00048 
00049 XMLInt32 Op::getData() const {
00050 
00051     ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager);
00052     return 0; // for compilers that complain about no return value
00053 }
00054 
00055 XMLInt32 Op::getData2() const {
00056 
00057     ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager);
00058     return 0; // for compilers that complain about no return value
00059 }
00060 
00061 const Op* Op::elementAt(XMLSize_t) const {
00062 
00063     ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager);
00064     return 0; // for compilers that complain about no return value
00065 }
00066 
00067 const Op* Op::getChild() const {
00068 
00069     ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager);
00070     return 0; // for compilers that complain about no return value
00071 }
00072 
00073 const XMLCh* Op::getLiteral() const {
00074 
00075     ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager);
00076     return 0; // for compilers that complain about no return value
00077 }
00078     
00079 const Token* Op::getToken() const {
00080 
00081     ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager);
00082     return 0; // for compilers that complain about no return value
00083 }
00084 
00085 
00086 // ---------------------------------------------------------------------------
00087 //  CharOp: Constructors and Destuctors
00088 // ---------------------------------------------------------------------------
00089 CharOp::CharOp(const Op::opType type, const XMLInt32 charData
00090                , MemoryManager* const manager)
00091     : Op(type, manager)
00092       , fCharData(charData) {
00093 }
00094 
00095 // ---------------------------------------------------------------------------
00096 //  CharOp: Getter methods
00097 // ---------------------------------------------------------------------------
00098 XMLInt32 CharOp::getData() const {
00099 
00100     return fCharData;
00101 }
00102 
00103 // ---------------------------------------------------------------------------
00104 //  UnionOp: Constructors and Destuctors
00105 // ---------------------------------------------------------------------------
00106 UnionOp::UnionOp(const Op::opType type, const XMLSize_t size, MemoryManager* const manager)
00107     : Op(type, manager)
00108       , fBranches(new (manager) RefVectorOf<Op> (size, false, manager)) {
00109 
00110 }
00111 
00112 // ---------------------------------------------------------------------------
00113 //  UnionOp: Getter/Setter methods
00114 // ---------------------------------------------------------------------------
00115 XMLSize_t UnionOp::getSize() const {
00116 
00117     return fBranches->size();
00118 }
00119 
00120 const Op* UnionOp::elementAt(XMLSize_t index) const {
00121 
00122     return fBranches->elementAt(index);
00123 }
00124 
00125 void UnionOp::addElement(Op* const op) {
00126 
00127     fBranches->addElement(op);
00128 }
00129 
00130 // ---------------------------------------------------------------------------
00131 //  ChildOp: Constructors and Destuctors
00132 // ---------------------------------------------------------------------------
00133 ChildOp::ChildOp(const Op::opType type, MemoryManager* const manager)
00134     : Op(type, manager)
00135       , fChild(0) {
00136 
00137 }
00138 
00139 // ---------------------------------------------------------------------------
00140 //  ChildOp: Getter/Setter methods
00141 // ---------------------------------------------------------------------------
00142 const Op* ChildOp::getChild() const {
00143 
00144     return fChild;
00145 }
00146 
00147 void ChildOp::setChild(const Op* const child) {
00148 
00149     fChild = child;
00150 }
00151 
00152 // ---------------------------------------------------------------------------
00153 //  ModifierOp: Constructors and Destuctors
00154 // ---------------------------------------------------------------------------
00155 ModifierOp::ModifierOp(const Op::opType type, const XMLInt32 v1, const XMLInt32 v2
00156                        , MemoryManager* const manager)
00157     : ChildOp(type, manager)
00158       , fVal1(v1)
00159       , fVal2(v2) {
00160 
00161 }
00162 
00163 // ---------------------------------------------------------------------------
00164 //  ModifierOp: Getter methods
00165 // ---------------------------------------------------------------------------
00166 XMLInt32 ModifierOp::getData() const {
00167 
00168     return fVal1;
00169 }
00170 
00171 XMLInt32 ModifierOp::getData2() const {
00172 
00173     return fVal2;
00174 }
00175 
00176 // ---------------------------------------------------------------------------
00177 //  RangeOp: Constructors and Destuctors
00178 // ---------------------------------------------------------------------------
00179 RangeOp::RangeOp(const Op::opType type, const Token* const token, MemoryManager* const manager)
00180     : Op (type, manager)
00181       , fToken(token) {
00182 
00183 }
00184 
00185 // ---------------------------------------------------------------------------
00186 //  RangeOp: Getter methods
00187 // ---------------------------------------------------------------------------
00188 const Token* RangeOp::getToken() const {
00189 
00190     return fToken;
00191 }
00192 
00193 
00194 // ---------------------------------------------------------------------------
00195 //  StringOp: Constructors and Destuctors
00196 // ---------------------------------------------------------------------------
00197 StringOp::StringOp(const Op::opType type, const XMLCh* const literal
00198                    , MemoryManager* const manager)
00199     : Op (type, manager)
00200       , fLiteral(XMLString::replicate(literal, manager)) {
00201 
00202 }
00203 
00204 // ---------------------------------------------------------------------------
00205 //  StringOp: Getter methods
00206 // ---------------------------------------------------------------------------
00207 const XMLCh* StringOp::getLiteral() const {
00208 
00209     return fLiteral;
00210 }
00211 
00212 XERCES_CPP_NAMESPACE_END
00213