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: ConditionToken.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
20 | */ |
---|
21 | |
---|
22 | #if !defined(CONDITIONTOKEN_HPP) |
---|
23 | #define CONDITIONTOKEN_HPP |
---|
24 | |
---|
25 | // --------------------------------------------------------------------------- |
---|
26 | // Includes |
---|
27 | // --------------------------------------------------------------------------- |
---|
28 | #include <xercesc/util/regx/Token.hpp> |
---|
29 | |
---|
30 | XERCES_CPP_NAMESPACE_BEGIN |
---|
31 | |
---|
32 | class XMLUTIL_EXPORT ConditionToken : public Token { |
---|
33 | public: |
---|
34 | // ----------------------------------------------------------------------- |
---|
35 | // Public Constructors and Destructor |
---|
36 | // ----------------------------------------------------------------------- |
---|
37 | ConditionToken(const unsigned int refNo, Token* const condTok, |
---|
38 | Token* const yesTok, Token* const noTok |
---|
39 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
40 | ~ConditionToken(); |
---|
41 | |
---|
42 | // ----------------------------------------------------------------------- |
---|
43 | // Getter methods |
---|
44 | // ----------------------------------------------------------------------- |
---|
45 | int size() const; |
---|
46 | int getReferenceNo() const; |
---|
47 | Token* getChild(const int index) const; |
---|
48 | Token* getConditionToken() const; |
---|
49 | |
---|
50 | private: |
---|
51 | // ----------------------------------------------------------------------- |
---|
52 | // Unimplemented constructors and operators |
---|
53 | // ----------------------------------------------------------------------- |
---|
54 | ConditionToken(const ConditionToken&); |
---|
55 | ConditionToken& operator=(const ConditionToken&); |
---|
56 | |
---|
57 | // ----------------------------------------------------------------------- |
---|
58 | // Private data members |
---|
59 | // ----------------------------------------------------------------------- |
---|
60 | int fRefNo; |
---|
61 | Token* fConditionToken; |
---|
62 | Token* fYesToken; |
---|
63 | Token* fNoToken; |
---|
64 | }; |
---|
65 | |
---|
66 | |
---|
67 | // --------------------------------------------------------------------------- |
---|
68 | // ConditionToken: getter methods |
---|
69 | // --------------------------------------------------------------------------- |
---|
70 | inline int ConditionToken::size() const { |
---|
71 | |
---|
72 | return fNoToken == 0 ? 1 : 2; |
---|
73 | } |
---|
74 | |
---|
75 | inline int ConditionToken::getReferenceNo() const { |
---|
76 | |
---|
77 | return fRefNo; |
---|
78 | } |
---|
79 | |
---|
80 | inline Token* ConditionToken::getChild(const int index) const { |
---|
81 | |
---|
82 | if (index < 0 || index > 1) |
---|
83 | ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_InvalidChildIndex, fMemoryManager); |
---|
84 | |
---|
85 | if (index == 0) |
---|
86 | return fYesToken; |
---|
87 | |
---|
88 | return fNoToken; |
---|
89 | } |
---|
90 | |
---|
91 | inline Token* ConditionToken::getConditionToken() const { |
---|
92 | |
---|
93 | return fConditionToken; |
---|
94 | } |
---|
95 | |
---|
96 | XERCES_CPP_NAMESPACE_END |
---|
97 | |
---|
98 | #endif |
---|
99 | |
---|
100 | /** |
---|
101 | * End of file ConditionToken.hpp |
---|
102 | */ |
---|