Public Types | Public Member Functions | Private Member Functions | Private Attributes
Poco::StringTokenizer Class Reference

#include <StringTokenizer.h>

List of all members.

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

StringTokenizeroperator= (const StringTokenizer &)
 StringTokenizer (const StringTokenizer &)
 Returns the number of tokens.

Private Attributes

std::vector< std::string > _tokens

Detailed Description

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.


Member Typedef Documentation

typedef std::vector<std::string>::const_iterator Poco::StringTokenizer::Iterator

Definition at line 64 of file StringTokenizer.h.


Member Enumeration Documentation

Enumerator:
TOK_IGNORE_EMPTY 
TOK_TRIM 

ignore empty tokens

Definition at line 58 of file StringTokenizer.h.


Constructor & Destructor Documentation

Poco::StringTokenizer::StringTokenizer ( const std::string &  str,
const std::string &  separators,
int  options = 0 
)

Definition at line 44 of file StringTokenizer.cpp.

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.

Returns the number of tokens.


Member Function Documentation

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.

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.


Member Data Documentation

std::vector<std::string> Poco::StringTokenizer::_tokens [private]

Definition at line 94 of file StringTokenizer.h.


The documentation for this class was generated from the following files:


pluginlib
Author(s): Tully Foote and Eitan Marder-Eppstein
autogenerated on Sat Dec 28 2013 17:20:20