cgul_convspec_cxx Class Reference

C++ bindings for cgul_convspec More...

#include <cgul_convspec_cxx.h>

Collaboration diagram for cgul_convspec_cxx:
Collaboration graph

Public Member Functions

 cgul_convspec_cxx ()
 
 cgul_convspec_cxx (const cgul_convspec_cxx &rhs)
 
 cgul_convspec_cxx (cgul_convspec_t rhs)
 
virtual ~cgul_convspec_cxx ()
 
virtual cgul_convspec_cxxoperator= (const cgul_convspec_cxx &rhs)
 
virtual cgul_convspec_cxxoperator= (cgul_convspec_t rhs)
 
virtual void copy (const cgul_convspec_cxx &rhs)
 
virtual void deserialize (const char *format, unsigned long int *index)
 
virtual void serialize (cgul_string_cxx &s)
 
virtual int get_flag_hash () const
 
virtual void set_flag_hash (int flag_hash)
 
virtual int get_flag_zero () const
 
virtual void set_flag_zero (int flag_zero)
 
virtual int get_flag_dash () const
 
virtual void set_flag_dash (int flag_dash)
 
virtual int get_flag_space () const
 
virtual void set_flag_space (int flag_space)
 
virtual int get_flag_plus () const
 
virtual void set_flag_plus (int flag_plus)
 
virtual int get_is_field_width_present () const
 
virtual void set_is_field_width_present (int is_field_width_present)
 
virtual int get_is_field_width_on_stack () const
 
virtual void set_is_field_width_on_stack (int is_field_width_on_stack)
 
virtual int get_field_width () const
 
virtual void set_field_width (int field_width)
 
virtual int get_is_precision_present () const
 
virtual void set_is_precision_present (int is_precision_present)
 
virtual int get_is_precision_on_stack () const
 
virtual void set_is_precision_on_stack (int is_precision_on_stack)
 
virtual int get_precision () const
 
virtual void set_precision (int precision)
 
virtual int get_is_length_modifier_present () const
 
virtual void set_is_length_modifier_present (int is_length_modifier_present)
 
virtual const char * get_length_modifier () const
 
virtual void set_length_modifier (const char *length_modifier)
 
virtual char get_cspec () const
 
virtual void set_cspec (char cspec)
 
virtual cgul_convspec_t get_obj () const
 
virtual cgul_convspec_t take_obj ()
 
virtual void set_obj (cgul_convspec_t rhs)
 

Detailed Description

This class provides the C++ bindings for C cgul_convspec objects. The main purpose of this class is to convert the C-style function calls and exception handling in cgul_convspec into C++-style function calls and exception handling.

See also
cgul_convspec_t

Constructor & Destructor Documentation

§ cgul_convspec_cxx() [1/3]

cgul_convspec_cxx::cgul_convspec_cxx ( )
inline

Default constructor.

References cgul_convspec__new().

§ cgul_convspec_cxx() [2/3]

cgul_convspec_cxx::cgul_convspec_cxx ( const cgul_convspec_cxx rhs)
inline

Copy constructor.

References cgul_convspec__new(), and copy().

§ cgul_convspec_cxx() [3/3]

cgul_convspec_cxx::cgul_convspec_cxx ( cgul_convspec_t  rhs)
inline

Adaptor constructor.

References cgul_convspec__copy(), and cgul_convspec__new().

§ ~cgul_convspec_cxx()

virtual cgul_convspec_cxx::~cgul_convspec_cxx ( )
inlinevirtual

This method deletes the object by freeing all internally allocated resources associated with the object. The caller must not use the object after calling this method.

References cgul_convspec__delete().

Member Function Documentation

§ operator=() [1/2]

virtual cgul_convspec_cxx& cgul_convspec_cxx::operator= ( const cgul_convspec_cxx rhs)
inlinevirtual

operator=()

Parameters
[in]rhsright-hand side
Returns
*this

References copy().

§ operator=() [2/2]

virtual cgul_convspec_cxx& cgul_convspec_cxx::operator= ( cgul_convspec_t  rhs)
inlinevirtual

operator=()

Parameters
[in]rhsright-hand side
Returns
*this

References cgul_convspec__copy().

§ copy()

virtual void cgul_convspec_cxx::copy ( const cgul_convspec_cxx rhs)
inlinevirtual

This method performs a deep copy of rhs so that this has the same state. If an error occurs, an exception is thrown.

Parameters
[in]rhsright-hand side

References cgul_convspec__copy().

Referenced by cgul_convspec_cxx(), and operator=().

§ deserialize()

virtual void cgul_convspec_cxx::deserialize ( const char *  format,
unsigned long int *  index 
)
inlinevirtual

This method assumes the conversion specification begins with a '' character at format[index] and increments index for each character that is consumed such that when this method returns index points to one character beyond the end of the conversion specification. This is the primary method to use when you want to initialize an instance of this class.

Note that serializing an object of this class produces a conversion specification string that is suitable for use as part of a format string that can be passed to printf(). Thus, deserializing an instance of this class reduces a printf() conversion specification into its component parts.

If an error occurs, an exception is thrown, and the object will be in an undefined state.

It is important that you call this method correctly. Because index is a pointer to a variable, you must define and use a variable:

    unsigned long int index = 0;
    cs.deserialize("%d", &index);
Parameters
[in]formatformat string
[in,out]indexindex into format

References cgul_convspec__deserialize().

§ serialize()

virtual void cgul_convspec_cxx::serialize ( cgul_string_cxx s)
inlinevirtual

This method serializes the object to a string and appends the result to s. Note that serializing an object of this class produces a conversion specification string that is suitable for use as part of a format string that can be passed to printf().

If an error occurs, an exception is thrown. An error can occur if the system runs out of memory while inserting into s. In this case, s will be in an undefined state.

Parameters
[in,out]sstring

References cgul_convspec__serialize(), and cgul_string_cxx::get_obj().

§ get_flag_hash()

virtual int cgul_convspec_cxx::get_flag_hash ( ) const
inlinevirtual

Get whether the '#' flag is present.

Returns
whether the '#' flag is present

References cgul_convspec__get_flag_hash().

§ set_flag_hash()

virtual void cgul_convspec_cxx::set_flag_hash ( int  flag_hash)
inlinevirtual

Set whether the '#' flag is present.

Parameters
[in]flag_hashwhether the '#' flag is present

References cgul_convspec__set_flag_hash().

§ get_flag_zero()

virtual int cgul_convspec_cxx::get_flag_zero ( ) const
inlinevirtual

Get whether the '0' flag is present.

Returns
whether the '0' flag is present

References cgul_convspec__get_flag_zero().

§ set_flag_zero()

virtual void cgul_convspec_cxx::set_flag_zero ( int  flag_zero)
inlinevirtual

Set whether the '0' flag is present.

Parameters
[in]flag_zerowhether the '0' flag is present

References cgul_convspec__set_flag_zero().

§ get_flag_dash()

virtual int cgul_convspec_cxx::get_flag_dash ( ) const
inlinevirtual

Get whether the '-' flag is present.

Returns
whether the '-' flag is present

References cgul_convspec__get_flag_dash().

§ set_flag_dash()

virtual void cgul_convspec_cxx::set_flag_dash ( int  flag_dash)
inlinevirtual

Set whether the '-' flag is present.

Parameters
[in]flag_dashwhether the '-' flag is present

References cgul_convspec__set_flag_dash().

§ get_flag_space()

virtual int cgul_convspec_cxx::get_flag_space ( ) const
inlinevirtual

Get whether the ' ' flag is present.

Returns
whether the ' ' flag is present

References cgul_convspec__get_flag_space().

§ set_flag_space()

virtual void cgul_convspec_cxx::set_flag_space ( int  flag_space)
inlinevirtual

Set whether the ' ' flag is present.

Parameters
[in]flag_spacewhether the ' ' flag is present

References cgul_convspec__set_flag_space().

§ get_flag_plus()

virtual int cgul_convspec_cxx::get_flag_plus ( ) const
inlinevirtual

Get whether the '+' flag is present.

Returns
whether the '+' flag is present

References cgul_convspec__get_flag_plus().

§ set_flag_plus()

virtual void cgul_convspec_cxx::set_flag_plus ( int  flag_plus)
inlinevirtual

Set whether the '+' flag is present.

Parameters
[in]flag_pluswhether the '+' flag is present

References cgul_convspec__set_flag_plus().

§ get_is_field_width_present()

virtual int cgul_convspec_cxx::get_is_field_width_present ( ) const
inlinevirtual

Whether the field width is present.

Returns
whether the field width is present

References cgul_convspec__get_is_field_width_present().

§ set_is_field_width_present()

virtual void cgul_convspec_cxx::set_is_field_width_present ( int  is_field_width_present)
inlinevirtual

Set whether the field width is present.

Parameters
[in]is_field_width_presentwhether the field width is present

References cgul_convspec__set_is_field_width_present().

§ get_is_field_width_on_stack()

virtual int cgul_convspec_cxx::get_is_field_width_on_stack ( ) const
inlinevirtual

Whether the field width is on the stack. This occurs when the conversion specifier uses '*' instead of an actual width. It makes no sense to call this function if get_is_field_width_present() returns false.

Returns
whether the field width is on the stack

References cgul_convspec__get_is_field_width_on_stack().

§ set_is_field_width_on_stack()

virtual void cgul_convspec_cxx::set_is_field_width_on_stack ( int  is_field_width_on_stack)
inlinevirtual

Set whether the field width is on the stack. This occurs when the conversion specifier uses '*' instead of an actual width. Calling this method with is_field_width_on_stack set to true does not implicitly mark the field width as present. You will still need to call set_is_field_width_present() if that is the intent.

Parameters
[in]is_field_width_on_stackwhether the field width is on stack

References cgul_convspec__set_is_field_width_on_stack().

§ get_field_width()

virtual int cgul_convspec_cxx::get_field_width ( ) const
inlinevirtual

Get the field width. It makes no sense to call this function if get_is_field_width_present returns false or get_is_field_width_on_stack() returns true.

Returns
field width

References cgul_convspec__get_field_width().

§ set_field_width()

virtual void cgul_convspec_cxx::set_field_width ( int  field_width)
inlinevirtual

Set the field width. Calling this method does not implicitly mark the field width as present. You will still need to call set_is_field_width_present() if that is the intent. It also does not implicitly mark the field width as not being on the stack. You will still need to call set_is_field_width_on_stack() if that is the intent.

Parameters
[in]field_widthfield width

References cgul_convspec__set_field_width().

§ get_is_precision_present()

virtual int cgul_convspec_cxx::get_is_precision_present ( ) const
inlinevirtual

Whether the precision is present.

Returns
whether the precision is present

References cgul_convspec__get_is_precision_present().

§ set_is_precision_present()

virtual void cgul_convspec_cxx::set_is_precision_present ( int  is_precision_present)
inlinevirtual

Set whether the precision is present.

Parameters
[in]is_precision_presentwhether the precision is present

References cgul_convspec__set_is_precision_present().

§ get_is_precision_on_stack()

virtual int cgul_convspec_cxx::get_is_precision_on_stack ( ) const
inlinevirtual

Whether the precision is on the stack. This occurs when the conversion specifier uses '*' instead of an actual precision. It makes no sense to call this function if get_is_precision_present() returns false.

Returns
whether the precision is on the stack

References cgul_convspec__get_is_precision_on_stack().

§ set_is_precision_on_stack()

virtual void cgul_convspec_cxx::set_is_precision_on_stack ( int  is_precision_on_stack)
inlinevirtual

Set whether the precision is on the stack. This occurs when the conversion specifier uses '*' instead of an actual precision. Calling this method with is_precision_on_stack set to true does not implicitly mark the precision as present. You will still need to call set_is_precision_present() if that is the intent.

Parameters
[in]is_precision_on_stackwhether the precision is on stack

References cgul_convspec__set_is_precision_on_stack().

§ get_precision()

virtual int cgul_convspec_cxx::get_precision ( ) const
inlinevirtual

Get the precision. It makes no sense to call this function if get_is_precision_present returns false or get_is_precision_on_stack() returns true.

Returns
precision

References cgul_convspec__get_precision().

§ set_precision()

virtual void cgul_convspec_cxx::set_precision ( int  precision)
inlinevirtual

Set the precision. Calling this method does not implicitly mark the precision as present. You will still need to call set_is_precision_present() if that is the intent. It also does not implicitly mark the precision as not being on the stack. You will still need to call set_is_precision_on_stack() if that is the intent.

Parameters
[in]precisionprecision

References cgul_convspec__set_precision().

§ get_is_length_modifier_present()

virtual int cgul_convspec_cxx::get_is_length_modifier_present ( ) const
inlinevirtual

Whether the length modifier is present.

Returns
whether the length modifier is present

References cgul_convspec__get_is_length_modifier_present().

§ set_is_length_modifier_present()

virtual void cgul_convspec_cxx::set_is_length_modifier_present ( int  is_length_modifier_present)
inlinevirtual

Set whether the length modifier is present.

Parameters
[in]is_length_modifier_presentwhether the length modifier is present

References cgul_convspec__set_is_length_modifier_present().

§ get_length_modifier()

virtual const char* cgul_convspec_cxx::get_length_modifier ( ) const
inlinevirtual

Get the length modifier. It makes no sense to call this function if get_is_length_modifier_present() returns false.

Returns
length modifier

References cgul_convspec__get_length_modifier().

§ set_length_modifier()

virtual void cgul_convspec_cxx::set_length_modifier ( const char *  length_modifier)
inlinevirtual

Set the length modifier. Calling this method does not implicitly mark the length modifier as present. You will still need to call set_is_length_modifier_present() if that is the intent. If an error occurs, an exception is thrown.

Parameters
[in]length_modifierlength modifier

References cgul_convspec__set_length_modifier().

§ get_cspec()

virtual char cgul_convspec_cxx::get_cspec ( ) const
inlinevirtual

Get the conversion specifier. For example, this is the 'd' character in the "%d" conversion specification.

Returns
conversion specifier

References cgul_convspec__get_cspec().

§ set_cspec()

virtual void cgul_convspec_cxx::set_cspec ( char  cspec)
inlinevirtual

Set the conversion specifier. For example, this is the 'd' character in the "%d" conversion specification.

Parameters
[in]cspecconversion specifier

References cgul_convspec__set_cspec().

§ get_obj()

virtual cgul_convspec_t cgul_convspec_cxx::get_obj ( ) const
inlinevirtual

Get the underlying cgul_convspec object.

Returns
underlying object

§ take_obj()

virtual cgul_convspec_t cgul_convspec_cxx::take_obj ( )
inlinevirtual

Take the underlying cgul_convspec 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_convspec__delete().

Returns
underlying object

§ set_obj()

virtual void cgul_convspec_cxx::set_obj ( cgul_convspec_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_convspec__delete().


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