1 | /*
|
---|
2 | * Copyright 2001,2004 The Apache Software Foundation.
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | */
|
---|
16 |
|
---|
17 | /*
|
---|
18 | * $Id: ConditionToken.hpp,v 1.5 2004/09/08 13:56:47 peiyongz Exp $
|
---|
19 | */
|
---|
20 |
|
---|
21 | #if !defined(CONDITIONTOKEN_HPP)
|
---|
22 | #define CONDITIONTOKEN_HPP
|
---|
23 |
|
---|
24 | // ---------------------------------------------------------------------------
|
---|
25 | // Includes
|
---|
26 | // ---------------------------------------------------------------------------
|
---|
27 | #include <xercesc/util/regx/Token.hpp>
|
---|
28 |
|
---|
29 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
30 |
|
---|
31 | class XMLUTIL_EXPORT ConditionToken : public Token {
|
---|
32 | public:
|
---|
33 | // -----------------------------------------------------------------------
|
---|
34 | // Public Constructors and Destructor
|
---|
35 | // -----------------------------------------------------------------------
|
---|
36 | ConditionToken(const unsigned int refNo, Token* const condTok,
|
---|
37 | Token* const yesTok, Token* const noTok
|
---|
38 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
39 | ~ConditionToken();
|
---|
40 |
|
---|
41 | // -----------------------------------------------------------------------
|
---|
42 | // Getter methods
|
---|
43 | // -----------------------------------------------------------------------
|
---|
44 | int size() const;
|
---|
45 | int getReferenceNo() const;
|
---|
46 | Token* getChild(const int index) const;
|
---|
47 | Token* getConditionToken() const;
|
---|
48 |
|
---|
49 | private:
|
---|
50 | // -----------------------------------------------------------------------
|
---|
51 | // Unimplemented constructors and operators
|
---|
52 | // -----------------------------------------------------------------------
|
---|
53 | ConditionToken(const ConditionToken&);
|
---|
54 | ConditionToken& operator=(const ConditionToken&);
|
---|
55 |
|
---|
56 | // -----------------------------------------------------------------------
|
---|
57 | // Private data members
|
---|
58 | // -----------------------------------------------------------------------
|
---|
59 | int fRefNo;
|
---|
60 | Token* fConditionToken;
|
---|
61 | Token* fYesToken;
|
---|
62 | Token* fNoToken;
|
---|
63 | };
|
---|
64 |
|
---|
65 |
|
---|
66 | // ---------------------------------------------------------------------------
|
---|
67 | // ConditionToken: getter methods
|
---|
68 | // ---------------------------------------------------------------------------
|
---|
69 | inline int ConditionToken::size() const {
|
---|
70 |
|
---|
71 | return fNoToken == 0 ? 1 : 2;
|
---|
72 | }
|
---|
73 |
|
---|
74 | inline int ConditionToken::getReferenceNo() const {
|
---|
75 |
|
---|
76 | return fRefNo;
|
---|
77 | }
|
---|
78 |
|
---|
79 | inline Token* ConditionToken::getChild(const int index) const {
|
---|
80 |
|
---|
81 | if (index < 0 || index > 1)
|
---|
82 | ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_InvalidChildIndex, fMemoryManager);
|
---|
83 |
|
---|
84 | if (index == 0)
|
---|
85 | return fYesToken;
|
---|
86 |
|
---|
87 | return fNoToken;
|
---|
88 | }
|
---|
89 |
|
---|
90 | inline Token* ConditionToken::getConditionToken() const {
|
---|
91 |
|
---|
92 | return fConditionToken;
|
---|
93 | }
|
---|
94 |
|
---|
95 | XERCES_CPP_NAMESPACE_END
|
---|
96 |
|
---|
97 | #endif
|
---|
98 |
|
---|
99 | /**
|
---|
100 | * End of file ConditionToken.hpp
|
---|
101 | */
|
---|