cgul_exception_cxx Class Reference

C++ bindings for cgul_exception More...

#include <cgul_exception_cxx.h>

Collaboration diagram for cgul_exception_cxx:
Collaboration graph

Public Member Functions

 cgul_exception_cxx (const char *format,...)
 
 cgul_exception_cxx (const char *format, va_list args)
 
 cgul_exception_cxx (cgul_exception_t rhs)
 
 cgul_exception_cxx (const cgul_exception_cxx &rhs)
 
virtual ~cgul_exception_cxx ()
 
cgul_exception_cxxoperator= (const cgul_exception_cxx &rhs)
 
const char * get_message () const
 
virtual cgul_exception_t get_obj () const
 
virtual cgul_exception_t take_obj ()
 
virtual void set_obj (cgul_exception_t rhs)
 

Detailed Description

This class provides the C++ bindings for C cgul_exception objects. The main purpose of this class is to convert the C-style function calls into C++-style function calls and to provide a C++ object that is suitable for being used like any other C++ exception.

This class does not inherit from std::exception. While that would be nice, this is just a major source of portability problems because the header and namespace for "exception" is almost never the same for older but still commonly-used C++ compilers.

See also
cgul_exception_t

Constructor & Destructor Documentation

§ cgul_exception_cxx() [1/4]

cgul_exception_cxx::cgul_exception_cxx ( const char *  format,
  ... 
)
inline

Construct a new cgul_exception_cxx object using a printf()-style format string.

Parameters
[in]formatprintf()-style format string
[in]...variable number of arguments that satisfy the format string

References cgul_exception__new_from_va_list().

§ cgul_exception_cxx() [2/4]

cgul_exception_cxx::cgul_exception_cxx ( const char *  format,
va_list  args 
)
inline

Construct a new cgul_exception_cxx object using the vprintf()-style variable argument list args.

Parameters
[in]formatprintf()-style format string
argsvariable number of arguments that satisfy format

References cgul_exception__new_from_va_list().

§ cgul_exception_cxx() [3/4]

cgul_exception_cxx::cgul_exception_cxx ( cgul_exception_t  rhs)
inline

Construct a new cgul_exception_cxx object by wrapping and taking ownership of an existing cgul_exception.

Parameters
[in]rhsright-hand side

§ cgul_exception_cxx() [4/4]

cgul_exception_cxx::cgul_exception_cxx ( const cgul_exception_cxx rhs)
inline

Copy constructor.

Parameters
[in]rhsright-hand side

§ ~cgul_exception_cxx()

virtual cgul_exception_cxx::~cgul_exception_cxx ( )
inlinevirtual

Destructor.

References cgul_exception__delete().

Member Function Documentation

§ operator=()

cgul_exception_cxx& cgul_exception_cxx::operator= ( const cgul_exception_cxx rhs)
inline

This method assigns the exception in rhs to this object and then return this object.

Parameters
[in]rhsright-hand side
Returns
*this

References cgul_exception__delete(), cgul_exception__new(), and get_message().

§ get_message()

const char* cgul_exception_cxx::get_message ( ) const
inline

Get the message associated with the exception.

Returns
message associated with the exception

References cgul_exception__get_message().

Referenced by operator=().

§ get_obj()

virtual cgul_exception_t cgul_exception_cxx::get_obj ( ) const
inlinevirtual

Get the underlying cgul_exception object.

Returns
underlying object

§ take_obj()

virtual cgul_exception_t cgul_exception_cxx::take_obj ( )
inlinevirtual

Take the underlying cgul_exception 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_exception__delete().

Returns
underlying object

§ set_obj()

virtual void cgul_exception_cxx::set_obj ( cgul_exception_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_exception__delete().


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