--- branches/new_design/OOPSE-4/src/utils/StringTokenizer.hpp 2004/11/24 18:20:15 1779 +++ branches/new_design/OOPSE-4/src/utils/StringTokenizer.hpp 2004/11/24 19:49:07 1780 @@ -32,13 +32,10 @@ */ #ifndef UTIL_STRINGTOKENIZER_HPP - #define UTIL_STRINGTOKENIZER_HPP #include -//#include "util/NoSuchElementException.hpp" - namespace oopse { /** @@ -52,7 +49,6 @@ class StringTokenizer { class StringTokenizer { public: - static const std::string defaultDelim; /** * Constructs a string tokenizer for the specified string. The characters in the delim argument * are the delimiters for separating tokens. characters are skipped and only serve as @@ -63,7 +59,7 @@ class StringTokenizer { * Boost's tokenizer class is one of them */ StringTokenizer(const std::string & str, - const std::string & delim = defaultDelim); + const std::string & delim = " \t\n\r"); /** * Constructs a string tokenizer for an iterator range [first, last). The characters in the delim argument @@ -76,7 +72,7 @@ class StringTokenizer { * Boost's tokenizer class is one of them */ StringTokenizer(std::string::const_iterator& first, std::string::const_iterator& last, - const std::string & delim = defaultDelim); + const std::string & delim = " \t\n\r"); /** * Constructs a string tokenizer for the specified string. The characters in the delim argument @@ -111,7 +107,17 @@ class StringTokenizer { */ std::string nextToken(); + //actually, nextToken Can be template function + //template + //ReturnType nextToken(); + /** + * Returns the next token from this string tokenizer as a bool. + * @return the next token from this string tokenizer as a bool. + */ + bool nextTokenAsBool(); + + /** * Returns the next token from this string tokenizer as an integer. * @return the next token from this string tokenizer as an integer. */ @@ -158,7 +164,7 @@ class StringTokenizer { * @param c character to be tested * @return true if character is in current delimiter set, flase otherwise. */ - bool isDelimiter(char c); + bool isDelimiter(const char c); std::string tokenString_;