Xerces-C++: XMLStringTokenizer.hpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22#if !defined(XERCESC_INCLUDE_GUARD_XMLSTRINGTOKENIZER_HPP)

23#define XERCESC_INCLUDE_GUARD_XMLSTRINGTOKENIZER_HPP

24

25#include <xercesc/util/RefArrayVectorOf.hpp>

27

29

43{

44public:

45

46

47

50

65

77 , const XMLCh* const delim

79

81

82

83

84

87

89

91

92

93

94

97

105

114 unsigned int countTokens();

115

123

125

126private:

127

128

129

132

133

134

135

136 void cleanUp();

137

138

139

140

141 bool isDelimeter(const XMLCh ch);

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

164 const XMLCh* fDelimeters;

165 RefArrayVectorOf* fTokens;

167};

168

169

170

171

172inline bool XMLStringTokenizer::isDelimeter(const XMLCh ch) {

173

175}

176

177

178

179

180

182

183 if (fStringLen == 0)

184 return 0;

185

186 unsigned int tokCount = 0;

187 bool inToken = false;

188

189 for (XMLSize_t i= fOffset; i< fStringLen; i++) {

190

191 if (isDelimeter(fString[i])) {

192

193 if (inToken) {

194 inToken = false;

195 }

196

197 continue;

198 }

199

200 if (!inToken) {

201

202 tokCount++;

203 inToken = true;

204 }

205

206 }

207

208 return tokCount;

209}

210

212

213#endif

214

#define XERCES_CPP_NAMESPACE_BEGIN

Definition XercesDefs.hpp:112

#define XMLUTIL_EXPORT

Definition XercesDefs.hpp:162

#define XERCES_CPP_NAMESPACE_END

Definition XercesDefs.hpp:113

size_t XMLSize_t

Definition Xerces_autoconf_config.hpp:112

char16_t XMLCh

Definition Xerces_autoconf_config.hpp:120

Configurable memory manager.

Definition MemoryManager.hpp:40

static MemoryManager * fgMemoryManager

The configurable memory manager.

Definition PlatformUtils.hpp:121

The string tokenizer class breaks a string into tokens.

Definition XMLStringTokenizer.hpp:43

unsigned int countTokens()

Calculates the number of times that this tokenizer's nextToken method can be called to return a valid...

Definition XMLStringTokenizer.hpp:181

XMLStringTokenizer(const XMLCh *const srcStr, const XMLCh *const delim, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)

Constructs a string tokenizer for the specified string.

XMLCh * nextToken()

Returns the next token from this string tokenizer.

XMLStringTokenizer(const XMLCh *const srcStr, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)

Constructs a string tokenizer for the specified string.

bool hasMoreTokens()

Tests if there are more tokens available from this tokenizer's string.

static int indexOf(const char *const toSearch, const char ch)

Provides the index of the first occurrence of a character within a string.

This class makes it possible to override the C++ memory management by adding new/delete operators to ...

Definition XMemory.hpp:41