Core Library
|
A class to split a string into separate tokens. More...
#include <Tokeniser.hpp>
Public Types | |
enum | Flags { NONE = 0x0000, MERGE_SEPS = 0x0001, RETURN_SEPS = 0x0002 } |
The flags that control the tokensiation. More... | |
typedef std::vector< tstring > | Tokens |
An array of strings. | |
Public Member Functions | |
Tokeniser (const tstring &string, const tstring &seps, int flags=NONE) | |
Construction from a string, separator list and flags. | |
~Tokeniser () | |
Destructor. | |
bool | moreTokens () const |
Query if we've reached the end. | |
tstring | nextToken () |
Get the next token. | |
Static Public Member Functions | |
static size_t | split (const tstring &string, const tstring &seps, Tokens &tokens, uint flags=NONE) |
Tokenise the string into an array of strings. | |
Private Types | |
enum | TokenType { END_TOKEN = -1, VALUE_TOKEN = 1, SEPARATOR_TOKEN = 2 } |
The token types. More... | |
Private Attributes | |
const tstring & | m_string |
The string to tokenise. | |
const tstring & | m_seps |
The list of separators. | |
uint | m_flags |
The tokenising control flags. | |
TokenType | m_nextToken |
The next token type expected. | |
tstring::const_iterator | m_iter |
The string iterator. |
A class to split a string into separate tokens.
typedef std::vector<tstring> Core::Tokeniser::Tokens |
An array of strings.
enum Core::Tokeniser::TokenType [private] |
Core::Tokeniser::Tokeniser | ( | const tstring & | string, |
const tstring & | seps, | ||
int | flags = NONE |
||
) |
Construction from a string, separator list and flags.
Destructor.
bool Core::Tokeniser::moreTokens | ( | ) | const |
Query if we've reached the end.
Get the next token.
size_t Core::Tokeniser::split | ( | const tstring & | string, |
const tstring & | seps, | ||
Tokens & | tokens, | ||
uint | flags = NONE |
||
) | [static] |
Tokenise the string into an array of strings.
const tstring& Core::Tokeniser::m_string [private] |
The string to tokenise.
const tstring& Core::Tokeniser::m_seps [private] |
The list of separators.
uint Core::Tokeniser::m_flags [private] |
The tokenising control flags.
TokenType Core::Tokeniser::m_nextToken [private] |
The next token type expected.
tstring::const_iterator Core::Tokeniser::m_iter [private] |
The string iterator.