00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _DECAF_UTIL_STRINGTOKENIZER_H_
00018 #define _DECAF_UTIL_STRINGTOKENIZER_H_
00019
00020 #include <decaf/util/Config.h>
00021 #include <decaf/util/NoSuchElementException.h>
00022 #include <string>
00023 #include <vector>
00024
00025 namespace decaf{
00026 namespace util{
00027
00033 class DECAF_API StringTokenizer {
00034 private:
00035
00036
00037 std::string str;
00038
00039
00040 std::string delim;
00041
00042
00043 std::string::size_type pos;
00044
00045
00046 bool returnDelims;
00047
00048 public:
00049
00067 StringTokenizer(const std::string& str, const std::string& delim = " \t\n\r\f", bool returnDelims = false);
00068
00069 virtual ~StringTokenizer();
00070
00077 virtual int countTokens() const;
00078
00084 virtual bool hasMoreTokens() const;
00085
00093 virtual std::string nextToken();
00094
00111 virtual std::string nextToken(const std::string& delim);
00112
00119 virtual unsigned int toArray(std::vector<std::string>& array);
00120
00141 virtual void reset(const std::string& str = "", const std::string& delim = "", bool returnDelims = false);
00142
00143 };
00144
00145 }}
00146
00147 #endif