secureswitools/swisistools/source/xmlparser/xerces/include/xercesc/util/regx/Op.hpp
changeset 0 ba25891c3a9e
child 1 c42dffbd5b4f
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 /*
       
    18  * Licensed to the Apache Software Foundation (ASF) under one or more
       
    19  * contributor license agreements.  See the NOTICE file distributed with
       
    20  * this work for additional information regarding copyright ownership.
       
    21  * The ASF licenses this file to You under the Apache License, Version 2.0
       
    22  * (the "License"); you may not use this file except in compliance with
       
    23  * the License.  You may obtain a copy of the License at
       
    24  * 
       
    25  *      http://www.apache.org/licenses/LICENSE-2.0
       
    26  * 
       
    27  * Unless required by applicable law or agreed to in writing, software
       
    28  * distributed under the License is distributed on an "AS IS" BASIS,
       
    29  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    30  * See the License for the specific language governing permissions and
       
    31  * limitations under the License.
       
    32  */
       
    33 
       
    34 /*
       
    35  * $Id: Op.hpp 568078 2007-08-21 11:43:25Z amassari $
       
    36  */
       
    37 
       
    38 #if !defined(OP_HPP)
       
    39 #define OP_HPP
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 //  Includes
       
    43 // ---------------------------------------------------------------------------
       
    44 #include <xercesc/util/RefVectorOf.hpp>
       
    45 #include <xercesc/util/RuntimeException.hpp>
       
    46 
       
    47 XERCES_CPP_NAMESPACE_BEGIN
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 //  Forward Declaration
       
    51 // ---------------------------------------------------------------------------
       
    52 class Token;
       
    53 
       
    54 
       
    55 class XMLUTIL_EXPORT Op : public XMemory
       
    56 {
       
    57 public:
       
    58 
       
    59     enum {
       
    60         O_DOT                = 0,
       
    61         O_CHAR               = 1,
       
    62         O_RANGE              = 3,
       
    63         O_NRANGE             = 4,
       
    64         O_ANCHOR             = 5,
       
    65         O_STRING             = 6,
       
    66         O_CLOSURE            = 7,
       
    67         O_NONGREEDYCLOSURE   = 8,
       
    68         O_QUESTION           = 9,
       
    69         O_NONGREEDYQUESTION  = 10,
       
    70         O_UNION              = 11,
       
    71         O_CAPTURE            = 15,
       
    72         O_BACKREFERENCE      = 16,
       
    73         O_LOOKAHEAD          = 20,
       
    74         O_NEGATIVELOOKAHEAD  = 21,
       
    75         O_LOOKBEHIND         = 22,
       
    76         O_NEGATIVELOOKBEHIND = 23,
       
    77         O_INDEPENDENT        = 24,
       
    78         O_MODIFIER           = 25,
       
    79         O_CONDITION          = 26
       
    80     };
       
    81 
       
    82     // -----------------------------------------------------------------------
       
    83     //  Public Constructors and Destructor
       
    84     // -----------------------------------------------------------------------
       
    85     virtual ~Op() { }
       
    86 
       
    87     // -----------------------------------------------------------------------
       
    88     // Getter functions
       
    89     // -----------------------------------------------------------------------
       
    90             short        getOpType() const;
       
    91             const Op*    getNextOp() const;
       
    92     virtual XMLInt32     getData() const;
       
    93     virtual XMLInt32     getData2() const;
       
    94     virtual int          getSize() const;
       
    95     virtual int          getRefNo() const;
       
    96     virtual const Op*    getConditionFlow() const;
       
    97     virtual const Op*    getYesFlow() const;
       
    98     virtual const Op*    getNoFlow() const;
       
    99     virtual const Op*    elementAt(int index) const;
       
   100     virtual const Op*    getChild() const;
       
   101     virtual const Token* getToken() const;
       
   102     virtual const XMLCh* getLiteral() const;
       
   103 
       
   104     // -----------------------------------------------------------------------
       
   105     // Setter functions
       
   106     // -----------------------------------------------------------------------
       
   107     void setOpType(const short type);
       
   108     void setNextOp(const Op* const next);
       
   109 
       
   110 protected:
       
   111     // -----------------------------------------------------------------------
       
   112     //  Protected Constructors
       
   113     // -----------------------------------------------------------------------
       
   114     Op(const short type, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
       
   115     friend class OpFactory;
       
   116 
       
   117     MemoryManager* const fMemoryManager;
       
   118 
       
   119 private:
       
   120     // -----------------------------------------------------------------------
       
   121     //  Unimplemented constructors and operators
       
   122     // -----------------------------------------------------------------------
       
   123     Op(const Op&);
       
   124     Op& operator=(const Op&);
       
   125 
       
   126     // -----------------------------------------------------------------------
       
   127     //  Private data members
       
   128     //
       
   129     //  fOpType
       
   130     //      Indicates the type of operation
       
   131     //
       
   132     //  fNextOp
       
   133     //      Points to the next operation in the chain
       
   134     // -----------------------------------------------------------------------
       
   135     short fOpType;
       
   136     const Op*   fNextOp;
       
   137 };
       
   138 
       
   139 
       
   140 class XMLUTIL_EXPORT CharOp: public Op {
       
   141 public:
       
   142 	// -----------------------------------------------------------------------
       
   143     //  Public Constructors and Destructor
       
   144     // -----------------------------------------------------------------------
       
   145 	CharOp(const short type, const XMLInt32 charData, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
       
   146 	~CharOp() {}
       
   147 
       
   148 	// -----------------------------------------------------------------------
       
   149 	// Getter functions
       
   150 	// -----------------------------------------------------------------------
       
   151 	XMLInt32 getData() const;
       
   152 
       
   153 private:
       
   154 	// Private data members
       
   155 	XMLInt32 fCharData;
       
   156 
       
   157     // -----------------------------------------------------------------------
       
   158     //  Unimplemented constructors and operators
       
   159     // -----------------------------------------------------------------------
       
   160     CharOp(const CharOp&);
       
   161     CharOp& operator=(const CharOp&);
       
   162 };
       
   163 
       
   164 class XMLUTIL_EXPORT UnionOp : public Op {
       
   165 public:
       
   166 	// -----------------------------------------------------------------------
       
   167     //  Public Constructors and Destructor
       
   168     // -----------------------------------------------------------------------
       
   169 	UnionOp(const short type, const int size,
       
   170             MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
       
   171 	~UnionOp() { delete fBranches; }
       
   172 
       
   173 	// -----------------------------------------------------------------------
       
   174 	// Getter functions
       
   175 	// -----------------------------------------------------------------------
       
   176 	int getSize() const;
       
   177 	const Op* elementAt(int index) const;
       
   178 
       
   179 	// -----------------------------------------------------------------------
       
   180 	// Setter functions
       
   181 	// -----------------------------------------------------------------------
       
   182 	void addElement(Op* const op);
       
   183 
       
   184 private:
       
   185 	// Private Data memebers
       
   186 	RefVectorOf<Op>* fBranches;
       
   187 
       
   188     // -----------------------------------------------------------------------
       
   189     //  Unimplemented constructors and operators
       
   190     // -----------------------------------------------------------------------
       
   191     UnionOp(const UnionOp&);
       
   192     UnionOp& operator=(const UnionOp&);
       
   193 };
       
   194 
       
   195 
       
   196 class XMLUTIL_EXPORT ChildOp: public Op {
       
   197 public:
       
   198 	// -----------------------------------------------------------------------
       
   199     //  Public Constructors and Destructor
       
   200     // -----------------------------------------------------------------------
       
   201 	ChildOp(const short type, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
       
   202 	~ChildOp() {}
       
   203 
       
   204 	// -----------------------------------------------------------------------
       
   205 	// Getter functions
       
   206 	// -----------------------------------------------------------------------
       
   207 	const Op* getChild() const;
       
   208 
       
   209 	// -----------------------------------------------------------------------
       
   210 	// Setter functions
       
   211 	// -----------------------------------------------------------------------
       
   212 	void setChild(const Op* const child);
       
   213 
       
   214 private:
       
   215 	// Private data members
       
   216 	const Op* fChild;
       
   217 
       
   218     // -----------------------------------------------------------------------
       
   219     //  Unimplemented constructors and operators
       
   220     // -----------------------------------------------------------------------
       
   221     ChildOp(const ChildOp&);
       
   222     ChildOp& operator=(const ChildOp&);
       
   223 };
       
   224 
       
   225 class XMLUTIL_EXPORT ModifierOp: public ChildOp {
       
   226 public:
       
   227 	// -----------------------------------------------------------------------
       
   228     //  Public Constructors and Destructor
       
   229     // -----------------------------------------------------------------------
       
   230 	ModifierOp(const short type, const XMLInt32 v1, const XMLInt32 v2, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
       
   231 	~ModifierOp() {}
       
   232 
       
   233 	// -----------------------------------------------------------------------
       
   234 	// Getter functions
       
   235 	// -----------------------------------------------------------------------
       
   236 	XMLInt32 getData() const;
       
   237 	XMLInt32 getData2() const;
       
   238 
       
   239 private:
       
   240 	// Private data members
       
   241 	XMLInt32 fVal1;
       
   242 	XMLInt32 fVal2;
       
   243 
       
   244     // -----------------------------------------------------------------------
       
   245     //  Unimplemented constructors and operators
       
   246     // -----------------------------------------------------------------------
       
   247     ModifierOp(const ModifierOp&);
       
   248     ModifierOp& operator=(const ModifierOp&);
       
   249 };
       
   250 
       
   251 class XMLUTIL_EXPORT RangeOp: public Op {
       
   252 public:
       
   253 	// -----------------------------------------------------------------------
       
   254     //  Public Constructors and Destructor
       
   255     // -----------------------------------------------------------------------
       
   256 	RangeOp(const short type, const Token* const token, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
       
   257 	~RangeOp() {}
       
   258 
       
   259 	// -----------------------------------------------------------------------
       
   260 	// Getter functions
       
   261 	// -----------------------------------------------------------------------
       
   262 	const Token* getToken() const;
       
   263 
       
   264 private:
       
   265 	// Private data members
       
   266 	const Token* fToken;
       
   267 
       
   268     // -----------------------------------------------------------------------
       
   269     //  Unimplemented constructors and operators
       
   270     // -----------------------------------------------------------------------
       
   271     RangeOp(const RangeOp&);
       
   272     RangeOp& operator=(const RangeOp&);
       
   273 };
       
   274 
       
   275 class XMLUTIL_EXPORT StringOp: public Op {
       
   276 public:
       
   277 	// -----------------------------------------------------------------------
       
   278     //  Public Constructors and Destructor
       
   279     // -----------------------------------------------------------------------
       
   280 	StringOp(const short type, const XMLCh* const literal, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
       
   281 	~StringOp() { fMemoryManager->deallocate(fLiteral);}
       
   282 
       
   283 	// -----------------------------------------------------------------------
       
   284 	// Getter functions
       
   285 	// -----------------------------------------------------------------------
       
   286 	const XMLCh* getLiteral() const;
       
   287 
       
   288 private:
       
   289 	// Private data members
       
   290 	XMLCh* fLiteral;
       
   291 
       
   292     // -----------------------------------------------------------------------
       
   293     //  Unimplemented constructors and operators
       
   294     // -----------------------------------------------------------------------
       
   295     StringOp(const StringOp&);
       
   296     StringOp& operator=(const StringOp&);
       
   297 };
       
   298 
       
   299 class XMLUTIL_EXPORT ConditionOp: public Op {
       
   300 public:
       
   301 	// -----------------------------------------------------------------------
       
   302     //  Public Constructors and Destructor
       
   303     // -----------------------------------------------------------------------
       
   304 	ConditionOp(const short type, const int refNo,
       
   305 				const Op* const condFlow, const Op* const yesFlow,
       
   306 				const Op* const noFlow, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
       
   307 	~ConditionOp() {}
       
   308 
       
   309 	// -----------------------------------------------------------------------
       
   310 	// Getter functions
       
   311 	// -----------------------------------------------------------------------
       
   312 	int			getRefNo() const;
       
   313 	const Op*	getConditionFlow() const;
       
   314 	const Op*	getYesFlow() const;
       
   315 	const Op*	getNoFlow() const;
       
   316 	
       
   317 private:
       
   318 	// Private data members
       
   319 	int fRefNo;
       
   320 	const Op* fConditionOp;
       
   321 	const Op* fYesOp;
       
   322 	const Op* fNoOp;
       
   323 
       
   324     // -----------------------------------------------------------------------
       
   325     //  Unimplemented constructors and operators
       
   326     // -----------------------------------------------------------------------
       
   327     ConditionOp(const ConditionOp&);
       
   328     ConditionOp& operator=(const ConditionOp&);
       
   329 };
       
   330 
       
   331 // ---------------------------------------------------------------------------
       
   332 //  Op: getter methods
       
   333 // ---------------------------------------------------------------------------
       
   334 inline short Op::getOpType() const {
       
   335 
       
   336 	return fOpType;
       
   337 }
       
   338 
       
   339 inline const Op* Op::getNextOp() const {
       
   340 
       
   341 	return fNextOp;
       
   342 }
       
   343 
       
   344 // ---------------------------------------------------------------------------
       
   345 //  Op: setter methods
       
   346 // ---------------------------------------------------------------------------
       
   347 inline void Op::setOpType(const short type) {
       
   348 
       
   349 	fOpType = type;
       
   350 }
       
   351 
       
   352 inline void Op::setNextOp(const Op* const nextOp) {
       
   353 	
       
   354 	fNextOp = nextOp;
       
   355 }
       
   356 
       
   357 XERCES_CPP_NAMESPACE_END
       
   358 
       
   359 #endif
       
   360 
       
   361 /**
       
   362   * End of file Op.hpp
       
   363   */