Xalan-C++ API Reference 1.12.0
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.
25
26
27
29
30
31
33
34
35
36namespace XALAN_CPP_NAMESPACE {
37
38
39
41{
42public:
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 */
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 */
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 */
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 */
100 bool fReturnTokens = false);
101
103
104 /**
105 * Determine if there are tokens remaining
106 *
107 * @return true if there are more tokens
108 */
109 bool
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
121
122 /**
123 * Count the number of tokens yet to be parsed
124 *
125 * @return number of remaining tokens
126 */
128 countTokens() const;
129
130 void
132 {
133 m_currentIndex = 0;
134 }
135
136protected:
137
140
141private:
142
143 // These are not implemented...
145
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
#define XALAN_PLATFORMSUPPORT_EXPORT
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
StringTokenizer(const XalanDOMChar *theString, const XalanDOMString &theTokens, bool fReturnTokens=false)
Constructs a tokenizer for the target string.
size_type countTokens() const
Count the number of tokens yet to be parsed.
XalanDOMString::size_type FindNextDelimiterIndex(XalanDOMString::size_type theStartIndex) const
StringTokenizer(const XalanDOMString &theString, const XalanDOMString &theTokens, bool fReturnTokens=false)
Constructs a tokenizer for the target string.
StringTokenizer(const XalanDOMChar *theString, const XalanDOMChar *theTokens=s_defaultTokens, bool fReturnTokens=false)
Constructs a tokenizer for the target string.
StringTokenizer(const XalanDOMString &theString, const XalanDOMChar *theTokens=s_defaultTokens, bool fReturnTokens=false)
Constructs a tokenizer for the target string.
void nextToken(XalanDOMString &theToken)
Retrieve the next token to be parsed; behavior is undefined if there are no more tokens.
bool hasMoreTokens() const
Determine if there are tokens remaining.
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)