activemq-cpp-3.9.5
StringTokenizer.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17#ifndef _DECAF_UTIL_STRINGTOKENIZER_H_
18#define _DECAF_UTIL_STRINGTOKENIZER_H_
19
20#include <decaf/util/Config.h>
22#include <string>
23#include <vector>
24
25namespace decaf{
26namespace util{
27
34 private:
35
36 // String to tokenize
37 std::string str;
38
39 // The delimiter string
40 std::string delim;
41
42 // The current pos in the string
43 std::string::size_type pos;
44
45 // Are we returning delimiters
46 bool returnDelims;
47
48 public:
49
67 StringTokenizer(const std::string& str, const std::string& delim = " \t\n\r\f", bool returnDelims = false);
68
70
77 virtual int countTokens() const;
78
84 virtual bool hasMoreTokens() const;
85
93 virtual std::string nextToken();
94
111 virtual std::string nextToken(const std::string& delim);
112
119 virtual unsigned int toArray(std::vector<std::string>& array);
120
141 virtual void reset(const std::string& str = "", const std::string& delim = "", bool returnDelims = false);
142
143 };
144
145}}
146
147#endif /*_DECAF_UTIL_STRINGTOKENIZER_H_*/
virtual bool hasMoreTokens() const
Tests if there are more tokens available from this tokenizer's string.
virtual int countTokens() const
Calculates the number of times that this tokenizer's nextToken method can be called before it generat...
StringTokenizer(const std::string &str, const std::string &delim=" \t\n\r\f", bool returnDelims=false)
Constructs a string tokenizer for the specified string.
virtual unsigned int toArray(std::vector< std::string > &array)
Grab all remaining tokens in the String and return them in the vector that is passed in by reference.
virtual std::string nextToken(const std::string &delim)
Returns the next token in this string tokenizer's string.
virtual void reset(const std::string &str="", const std::string &delim="", bool returnDelims=false)
Resets the Tokenizer's position in the String to the Beginning calls to countToken and nextToken now ...
virtual std::string nextToken()
Returns the next token from this string tokenizer.
#define DECAF_API
Definition Config.h:29
Definition AbstractCollection.h:33
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25