Xalan-C++ API Reference
1.12.0
xalanc
PlatformSupport
StringTokenizer.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(STRINGTOKENIZER_HEADER_GUARD_1357924680)
19
#define STRINGTOKENIZER_HEADER_GUARD_1357924680
20
21
22
23
// Base include file. Must be first.
24
#include <
xalanc/PlatformSupport/PlatformSupportDefinitions.hpp
>
25
26
27
28
#include <
xalanc/XalanDOM/XalanDOMString.hpp
>
29
30
31
32
#include <
xalanc/PlatformSupport/DOMStringHelper.hpp
>
33
34
35
36
namespace
XALAN_CPP_NAMESPACE
{
37
38
39
40
class
XALAN_PLATFORMSUPPORT_EXPORT
StringTokenizer
41
{
42
public
:
43
44
static
const
XalanDOMChar s_defaultTokens[];
45
46
typedef
size_t
size_type
;
47
48
/**
49
* Constructs a tokenizer for the target string. No copies of any input
50
* strings are made.
51
*
52
* @param theString string to tokenize
53
* @param theTokens string of delimiters used to parse target, default
54
* is " \t\n\r"
55
* @param fReturnTokens if true, delimiter characters are also returned
56
* as tokens, default is false
57
*/
58
StringTokenizer
(
const
XalanDOMString
& theString,
59
const
XalanDOMString
& theTokens,
60
bool
fReturnTokens =
false
);
61
62
/**
63
* Constructs a tokenizer for the target string. No copies of any input
64
* strings are made.
65
*
66
* @param theString string to tokenize
67
* @param theTokens string of delimiters used to parse target, default
68
* is " \t\n\r"
69
* @param fReturnTokens if true, delimiter characters are also returned
70
* as tokens, default is false
71
*/
72
StringTokenizer
(
const
XalanDOMString
& theString,
73
const
XalanDOMChar* theTokens = s_defaultTokens,
74
bool
fReturnTokens =
false
);
75
76
/**
77
* Constructs a tokenizer for the target string. No copies of any input
78
* strings are made.
79
*
80
* @param theString string to tokenize
81
* @param theTokens string of delimiters used to parse target.
82
* @param fReturnTokens if true, delimiter characters are also returned
83
* as tokens, default is false
84
*/
85
StringTokenizer
(
const
XalanDOMChar* theString,
86
const
XalanDOMChar* theTokens = s_defaultTokens,
87
bool
fReturnTokens =
false
);
88
89
/**
90
* Constructs a tokenizer for the target string. No copies of any input
91
* strings are made.
92
*
93
* @param theString string to tokenize
94
* @param theTokens string of delimiters used to parse target.
95
* @param fReturnTokens if true, delimiter characters are also returned
96
* as tokens, default is false
97
*/
98
StringTokenizer
(
const
XalanDOMChar* theString,
99
const
XalanDOMString
& theTokens,
100
bool
fReturnTokens =
false
);
101
102
~
StringTokenizer
();
103
104
/**
105
* Determine if there are tokens remaining
106
*
107
* @return true if there are more tokens
108
*/
109
bool
110
hasMoreTokens()
const
;
111
112
113
/**
114
* Retrieve the next token to be parsed; behavior is undefined if there are
115
* no more tokens
116
*
117
* @param theToken next token string
118
*/
119
void
120
nextToken(
XalanDOMString
& theToken);
121
122
/**
123
* Count the number of tokens yet to be parsed
124
*
125
* @return number of remaining tokens
126
*/
127
size_type
128
countTokens()
const
;
129
130
void
131
reset
()
132
{
133
m_currentIndex = 0;
134
}
135
136
protected
:
137
138
XalanDOMString::size_type
139
FindNextDelimiterIndex(
XalanDOMString::size_type
theStartIndex)
const
;
140
141
private
:
142
143
// These are not implemented...
144
StringTokenizer
(
const
StringTokenizer
&);
145
146
StringTokenizer
&
147
operator=(
const
StringTokenizer
&);
148
149
bool
150
operator==
(
const
StringTokenizer
&)
const
;
151
152
153
// Data members...
154
const
XalanDOMChar*
const
m_string;
155
156
const
XalanDOMChar*
const
m_tokens;
157
158
const
bool
m_returnTokens;
159
160
XalanDOMString::size_type
m_currentIndex;
161
162
const
XalanDOMString::size_type
m_stringLength;
163
164
const
XalanDOMString::size_type
m_tokensLength;
165
};
166
167
168
169
}
170
171
172
173
#endif // STRINGTOKENIZER_HEADER_GUARD_1357924680
xalanc::StringTokenizer::reset
void reset()
Definition:
StringTokenizer.hpp:131
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition:
XalanVersion.hpp:76
XalanDOMString.hpp
xalanc::operator==
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
Definition:
XalanVector.hpp:1118
DOMStringHelper.hpp
XALAN_PLATFORMSUPPORT_EXPORT
#define XALAN_PLATFORMSUPPORT_EXPORT
Definition:
PlatformSupportDefinitions.hpp:35
PlatformSupportDefinitions.hpp
xalanc::StringTokenizer::size_type
size_t size_type
Definition:
StringTokenizer.hpp:46
xalanc::StringTokenizer
Definition:
StringTokenizer.hpp:40
xalanc::XalanDOMString::size_type
XalanSize_t size_type
Definition:
XalanDOMString.hpp:57
xalanc::XalanDOMString
Definition:
XalanDOMString.hpp:45
Copyright © 1999-2020 The Apache Software Foundation. All Rights Reserved.
Generated on Sun May 31 2020 10:37:17 for Xalan-C++ API Reference by
1.8.17