Xalan-C++ API Reference 1.12.0
XToken.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18#if !defined(XTOKEN_HEADER_GUARD_1357924680)
19#define XTOKEN_HEADER_GUARD_1357924680
20
21
22
23// Base header file. Must be first.
25
26
27
28// Base class...
30
31
32
34
35
36
37namespace XALAN_CPP_NAMESPACE {
38
39
40
42{
43public:
44
45 /**
46 * Create an XToken.
47 *
48 * @param theMemoryManager The MemoryManager instance.
49 */
50 XToken(MemoryManager& theMemoryManager);
51
52 /**
53 * Create an XToken for string in the token queue.
54 *
55 * @param theString The string data for the token. The instance will keep a point to this string, so it must be persistent.
56 * @param theNumber The numeric data for the token. This must be consistent with the lexical value in theString.
57 * @param theMemoryManager The MemoryManager instance.
58 */
61 double theNumber,
62 MemoryManager& theMemoryManager);
63
64 /**
65 * Create an XToken for number in the token queue.
66 *
67 * @param theNumber The numeric data for the token. This must be consistent with the lexical value in theString.
68 * @param theString The string data for the token. The instance will keep a point to this string, so it must be persistent.
69 * @param theMemoryManager The MemoryManager instance.
70 */
72 double theNumber,
74 MemoryManager& theMemoryManager);
75
76 /**
77 * Create an XToken from another one.
78 *
79 * In most cases, the following copy constructor,
80 * which accepts an explicit MemoryManager instance,
81 * is recommended.
82 *
83 * @param theSource The source XToken instance.
84 */
86
87 /**
88 * Create an XToken from another one.
89 *
90 * @param theSource The source XToken instance.
91 * @param theMemoryManager The MemoryManager instance.
92 */
94 const XToken& theSource,
95 MemoryManager& theMemoryManager);
96
97 virtual
99
100 virtual const XalanDOMString&
102
103 virtual double
105
106 virtual bool
108
109 virtual const XalanDOMString&
111
112 virtual const XalanDOMString&
113 str() const;
114
115 virtual void
119 MemberFunctionPtr function) const;
120
121 virtual void
124 MemberFunctionPtr function) const;
125
126 virtual void
130
131 virtual void
133
134 virtual double
136
137 virtual void
139
140 virtual void
142
143 XToken&
145 {
146 m_stringValue = theRHS.m_stringValue;
147
148 m_numberValue = theRHS.m_numberValue;
149
150 return *this;
151 }
152
153 bool
154 boolean() const
155 {
156 assert(m_stringValue != 0);
157
158 return m_isString == true ? XObject::boolean(*m_stringValue) : XObject::boolean(m_numberValue);
159 }
160
161 double
162 num() const
163 {
164 assert(m_stringValue != 0);
165
166 return m_numberValue;
167 }
168
169 double
171 {
172 assert(m_stringValue != 0);
173
174 return static_cast<double>(m_stringValue->length());
175 }
176
177 /**
178 * Set the instance as a string in the token queue.
179 *
180 * @param theString The string data for the token. XToken will keep a point to this string, so it must be persistent.
181 * @param theNumber The numeric data for the token. This must be consistent with the lexical value in theString.
182 */
183 void
186 double theNumber);
187
188 /**
189 * Set the instance as a number in the token queue.
190 *
191 * @param theNumber The numeric data for the token. This must be consistent with the lexical value in theString.
192 * @param theString The string data for the token. XToken will keep a point to this string, so it must be persistent.
193 */
194 void
196 double theNumber,
198
199protected:
200
201 virtual void
203
204 virtual void
206
207private:
208
209 // Not defined...
210 bool
211 operator==(const XToken&) const;
212
213 // Data members...
214 const XalanDOMString* m_stringValue;
215
216 double m_numberValue;
217
218 bool m_isString;
219};
220
221
222
224
225
226
227}
228
229
230
231#endif // XTOKEN_HEADER_GUARD_1357924680
#define XALAN_XPATH_EXPORT
#define XALAN_USES_MEMORY_MANAGER(Type)
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
A SAX-based formatter interface for the XSL processor.
The purpose of this class is to provide a way to get the "preferred" or closest matching type for XOb...
Class to hold XPath return types.
Definition XObject.hpp:64
virtual double num(XPathExecutionContext &executionContext) const
Cast result object to a number.
virtual const XalanDOMString & getTypeString() const
Given a request type, return the equivalent string.
void set(const XalanDOMString &theString, double theNumber)
Set the instance as a string in the token queue.
virtual void ProcessXObjectTypeCallback(XObjectTypeCallback &theCallbackObject)
Process a callback request for preferred type information.
XToken & operator=(const XToken &theRHS)
Definition XToken.hpp:144
virtual void str(XalanDOMString &theBuffer) const
Append the string value directly a string.
virtual void str(XPathExecutionContext &executionContext, FormatterListener &formatterListener, MemberFunctionPtr function) const
Send the string value to a FormatterListener instance.
virtual void dereferenced()
XToken(const XToken &theSource, MemoryManager &theMemoryManager)
Create an XToken from another one.
virtual void str(XPathExecutionContext &executionContext, XalanDOMString &theBuffer) const
Append the string value directly a string.
XToken(MemoryManager &theMemoryManager)
Create an XToken.
XToken(const XalanDOMString &theString, double theNumber, MemoryManager &theMemoryManager)
Create an XToken for string in the token queue.
virtual bool boolean(XPathExecutionContext &executionContext) const
Cast result object to a boolean.
void set(double theNumber, const XalanDOMString &theString)
Set the instance as a number in the token queue.
virtual void referenced()
virtual const XalanDOMString & str(XPathExecutionContext &executionContext) const
Cast result object to a string.
bool boolean() const
Definition XToken.hpp:154
XToken(double theNumber, const XalanDOMString &theString, MemoryManager &theMemoryManager)
Create an XToken for number in the token queue.
XToken(const XToken &theSource)
Create an XToken from another one.
virtual void str(FormatterListener &formatterListener, MemberFunctionPtr function) const
Send the string value to a FormatterListener instance.
double num() const
Cast result object to a number.
Definition XToken.hpp:162
virtual const XalanDOMString & str() const
Cast result object to a string.
virtual ~XToken()
virtual void ProcessXObjectTypeCallback(XObjectTypeCallback &theCallbackObject) const
Process a callback request for preferred type information.
double stringLength() const
Definition XToken.hpp:170
virtual double stringLength(XPathExecutionContext &executionContext) const
Get the length of the string value of the instance.
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)