cgul_strtok_cxx Class Reference

C++ bindings for cgul_strtok More...

#include <cgul_strtok_cxx.h>

Collaboration diagram for cgul_strtok_cxx:
Collaboration graph

Public Member Functions

 cgul_strtok_cxx ()
 
virtual ~cgul_strtok_cxx ()
 
virtual void set_value (const char *value)
 
virtual const char * get_next (const char *separators, int allow_empty_tokens)
 
virtual char get_separator () const
 
virtual size_t get_start () const
 
virtual size_t get_end () const
 
virtual cgul_strtok_t get_obj () const
 
virtual cgul_strtok_t take_obj ()
 
virtual void set_obj (cgul_strtok_t rhs)
 

Detailed Description

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.

Constructor & Destructor Documentation

§ cgul_strtok_cxx()

cgul_strtok_cxx::cgul_strtok_cxx ( )
inline

Default constructor.

References cgul_strtok__new().

Referenced by set_obj().

§ ~cgul_strtok_cxx()

virtual cgul_strtok_cxx::~cgul_strtok_cxx ( )
inlinevirtual

Destructor.

References cgul_strtok__delete().

Member Function Documentation

§ 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]valuevalue 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]separatorslist of separators that delimit tokens
[in]allow_empty_tokenswhether 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()

virtual cgul_strtok_t cgul_strtok_cxx::get_obj ( ) const
inlinevirtual

Get the underlying cgul_strtok object.

Returns
underlying object

§ take_obj()

virtual cgul_strtok_t cgul_strtok_cxx::take_obj ( )
inlinevirtual

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()

virtual void cgul_strtok_cxx::set_obj ( cgul_strtok_t  rhs)
inlinevirtual

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
[in]rhsright-hand side

References cgul_strtok__delete(), and cgul_strtok_cxx().


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