C++ bindings for cgul_strtok
More...
#include <cgul_strtok_cxx.h>
This class provides the C++ bindings for C cgul_strtok
objects. The main purpose of this class is to convert the C-style function calls and exception handling in cgul_strtok
into C++-style function calls and exception handling.
§ cgul_strtok_cxx()
cgul_strtok_cxx::cgul_strtok_cxx |
( |
| ) |
|
|
inline |
§ ~cgul_strtok_cxx()
virtual cgul_strtok_cxx::~cgul_strtok_cxx |
( |
| ) |
|
|
inlinevirtual |
§ set_value()
virtual void cgul_strtok_cxx::set_value |
( |
const char * |
value | ) |
|
|
inlinevirtual |
Set the value to tokenize. This method makes an internal copy of value
out of which tokens will be returned.
- Parameters
-
[in] | value | value to tokenize |
References cgul_strtok__set_value().
§ get_next()
virtual const char* cgul_strtok_cxx::get_next |
( |
const char * |
separators, |
|
|
int |
allow_empty_tokens |
|
) |
| |
|
inlinevirtual |
Get the next token that is delimited by the current list of separators
. The list of separators can change each time this method is called. If all the tokens have been consumed, NULL
is returned.
If allow_empty_tokens
is true, this method will return empty tokens when two consecutive separators are encountered including the case where a separator immediately precedes the end of string. If allow_empty_tokens
is false, consecutive separators will be telescoped into one, and all tokens returned will be non-empty.
- Parameters
-
[in] | separators | list of separators that delimit tokens |
[in] | allow_empty_tokens | whether to allow returning empty tokens |
- Returns
- next token
References cgul_strtok__get_next().
§ get_separator()
virtual char cgul_strtok_cxx::get_separator |
( |
| ) |
const |
|
inlinevirtual |
Get the trailing separator for the current token. This value can be nul
if the current token terminated because it reached the end of the string.
- Returns
- trailing separator for the current token
References cgul_strtok__get_separator().
§ get_start()
virtual size_t cgul_strtok_cxx::get_start |
( |
| ) |
const |
|
inlinevirtual |
Get the starting index for the current token.
- Returns
- starting index for the current token
References cgul_strtok__get_start().
§ get_end()
virtual size_t cgul_strtok_cxx::get_end |
( |
| ) |
const |
|
inlinevirtual |
Get the ending index for the current token. The value returned is actually one beyond the end of the current token. So in effect, the value returned is the index of the trailing separator for the current token.
- Returns
- ending index for the current token
References cgul_strtok__get_end().
§ get_obj()
Get the underlying cgul_strtok
object.
- Returns
- underlying object
§ take_obj()
Take the underlying cgul_strtok
object. This means the underlying object will not be deleted when the wrapper goes out of scope. Also, because you have taken the underlying object, no other methods should be called on this wrapper's instance. Lastly, after taking the underlying object, it is the caller's responsibility to delete the underlying object by calling cgul_strtok__delete()
.
- Returns
- underlying object
§ set_obj()
Set the new underlying object to rhs
. This causes the old underlying object to be deleted which invalidates any outstanding pointers to or iterators for the old underlying object.
This instance takes ownership of rhs
which means rhs
will be automatically deleted when the C++ wrapper is deleted. To prevent automatic deletion of rhs
, call take_obj()
when the C++ wrapper is no longer needed.
- Parameters
-
References cgul_strtok__delete(), and cgul_strtok_cxx().
The documentation for this class was generated from the following file: