5 #ifndef BPP_TEXT_STRINGTOKENIZER_H 6 #define BPP_TEXT_STRINGTOKENIZER_H 12 #include "../Exceptions.h" 40 StringTokenizer(
const std::string& s,
const std::string& delimiters =
" \t\n\f\r",
bool solid =
false,
bool allowEmptyTokens =
false);
57 return tokens_[currentPosition_++];
66 return currentPosition_ < tokens_.size();
84 const std::string&
getToken(
size_t pos)
const {
return tokens_[pos]; }
104 #endif // BPP_TEXT_STRINGTOKENIZER_H virtual ~StringTokenizer()
const std::string & nextToken()
Get the next available token. If no token is availbale, throw an Exception.
bool hasMoreToken() const
Tell if some tokens are still available.
const std::string & getToken(size_t pos) const
Get a particular token.
size_t numberOfRemainingTokens() const
Tell how many tokens are available.
void removeEmptyTokens()
remove all empty token from the current position.
std::deque< std::string > tokens_
Where the tokens are stored.
const std::deque< std::string > & getTokens() const
Retrieve all tokens.
Exception base class. Overload exception constructor (to control the exceptions mechanism). Destructor is already virtual (from std::exception)
std::string unparseRemainingTokens() const
std::deque< std::string > splits_
size_t currentPosition_
the current position in the token list.