#include <strtool.hpp>
Public Member Functions | |
string_tokenizer () | |
~string_tokenizer () | |
void | tokenize (const char *sequence, const char *separator) |
Sets the token list and separator to be used by subsequent next_token() calls. | |
const char * | next_token () |
Returns the next token in the list. | |
bool | has_tokens () |
Returns true if this object has another token to return via next_token(). |
.. well, a string tokenizer, modelled after Java's java.util.string_tokenizer class.
This code used to be part of the KDE 1.x libraries: (named StringTokenizer)
Copyright (C) 1997 Martin Jones (mjones@kde.org), (C) 1997 Torben Weis (weis@kde.org), and (C) 1998 Waldo Bastian (bastian@kde.org)
Then this code was part of the QUB project:
Copyright (C) 2000-2003 stephan beal (sgbeal@users.sourceforge.net) and Rusty Ballinger (bozo@users.sourceforge.net)
THIS code is part of the s11n project, and is maintained by stephan@s11n.net. i have been graciously granted explicit permission from the three original authors to release this code into the Public Domain, and this copy falls under that "license." (The original license was GNU GPL.)
Definition at line 455 of file strtool.hpp.
s11n::io::strtool::string_tokenizer::string_tokenizer | ( | ) |
s11n::io::strtool::string_tokenizer::~string_tokenizer | ( | ) |
void s11n::io::strtool::string_tokenizer::tokenize | ( | const char * | sequence, | |
const char * | separator | |||
) |
Sets the token list and separator to be used by subsequent next_token() calls.
It is important that the strings not be destroyed/freed by the client before this object is done with them. That is, do not call tokenize(), then free the strings, then call has_tokens() or next_token(). (In practice, this has never happened.)
const char* s11n::io::strtool::string_tokenizer::next_token | ( | ) |
Returns the next token in the list.
Results are undefined if this method is called when has_tokens() returns false.
bool s11n::io::strtool::string_tokenizer::has_tokens | ( | ) |
Returns true if this object has another token to return via next_token().