#include <StringTokenizer.h>
Public Types | |
typedef std::vector < std::string > ::const_iterator | Iterator |
enum | Options { TOK_IGNORE_EMPTY = 1, TOK_TRIM = 2 } |
Public Member Functions | |
Iterator | begin () const |
Destroys the tokenizer. | |
std::size_t | count () const |
Iterator | end () const |
const std::string & | operator[] (std::size_t index) const |
StringTokenizer (const std::string &str, const std::string &separators, int options=0) | |
~StringTokenizer () | |
Private Member Functions | |
StringTokenizer & | operator= (const StringTokenizer &) |
StringTokenizer (const StringTokenizer &) | |
Returns the number of tokens. | |
Private Attributes | |
std::vector< std::string > | _tokens |
A simple tokenizer that splits a string into tokens, which are separated by separator characters. An iterator is used to iterate over all tokens.
Definition at line 52 of file StringTokenizer.h.
typedef std::vector<std::string>::const_iterator Poco::StringTokenizer::Iterator |
Definition at line 64 of file StringTokenizer.h.
Definition at line 58 of file StringTokenizer.h.
Poco::StringTokenizer::StringTokenizer | ( | const std::string & | str, | |
const std::string & | separators, | |||
int | options = 0 | |||
) |
Definition at line 44 of file StringTokenizer.cpp.
Poco::StringTokenizer::~StringTokenizer | ( | ) |
Splits the given string into tokens. The tokens are expected to be separated by one of the separator characters given in separators. Additionally, options can be specified: TOK_IGNORE_EMPTY: empty tokens are ignored TOK_TRIM: trailing and leading whitespace is removed from tokens. An empty token at the end of str is always ignored. For example, a StringTokenizer with the following arguments: StringTokenizer(",ab,cd,", ","); will produce three tokens, "", "ab" and "cd".
Definition at line 81 of file StringTokenizer.cpp.
Poco::StringTokenizer::StringTokenizer | ( | const StringTokenizer & | ) | [private] |
Returns the number of tokens.
StringTokenizer::Iterator Poco::StringTokenizer::begin | ( | ) | const [inline] |
Destroys the tokenizer.
Definition at line 103 of file StringTokenizer.h.
std::size_t Poco::StringTokenizer::count | ( | ) | const [inline] |
Returns the index'th token. Throws a RangeException if the index is out of range.
Definition at line 122 of file StringTokenizer.h.
StringTokenizer::Iterator Poco::StringTokenizer::end | ( | ) | const [inline] |
Definition at line 109 of file StringTokenizer.h.
StringTokenizer& Poco::StringTokenizer::operator= | ( | const StringTokenizer & | ) | [private] |
const std::string & Poco::StringTokenizer::operator[] | ( | std::size_t | index | ) | const [inline] |
Definition at line 115 of file StringTokenizer.h.
std::vector<std::string> Poco::StringTokenizer::_tokens [private] |
Definition at line 94 of file StringTokenizer.h.