activemq-cpp-3.8.2
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 
25 namespace decaf{
26 namespace 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 
69  virtual ~StringTokenizer();
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_*/
Class that allows for parsing of string based on Tokens.
Definition: StringTokenizer.h:33
#define DECAF_API
Definition: Config.h:29
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: AprPool.h:25