cgul_progress_bar_cxx Class Reference

C++ bindings for cgul_progress_bar More...

#include <cgul_progress_bar_cxx.h>

Collaboration diagram for cgul_progress_bar_cxx:
Collaboration graph

Public Member Functions

 cgul_progress_bar_cxx ()
 
virtual ~cgul_progress_bar_cxx ()
 
virtual void reset ()
 
virtual cgul_progress_bar__style_t get_style () const
 
virtual void set_style (cgul_progress_bar__style_t style)
 
virtual double get_min () const
 
virtual void set_min (double min)
 
virtual double get_max () const
 
virtual void set_max (double max)
 
virtual FILE * get_file () const
 
virtual void set_file (FILE *f)
 
virtual void update (double progress, const char *before=NULL, const char *after=NULL)
 
virtual cgul_progress_bar_t get_obj () const
 
virtual cgul_progress_bar_t take_obj ()
 
virtual void set_obj (cgul_progress_bar_t rhs)
 

Detailed Description

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

Constructor & Destructor Documentation

§ cgul_progress_bar_cxx()

cgul_progress_bar_cxx::cgul_progress_bar_cxx ( )
inline

Construct a new cgul_progress_bar_cxx object with a default minimum value of 0 and a default maximum value of

  1. Also by default, new instances of this class draw their progress indicator to stdout. If memory allocation fails, an exception is thrown.

References cgul_progress_bar__new().

Referenced by set_obj().

§ ~cgul_progress_bar_cxx()

virtual cgul_progress_bar_cxx::~cgul_progress_bar_cxx ( )
inlinevirtual

This method frees all internally allocated resources for the object.

References cgul_progress_bar__delete().

Member Function Documentation

§ reset()

virtual void cgul_progress_bar_cxx::reset ( )
inlinevirtual

Reset the object so it can be reused. This method does not change the minimum or maximum values back to their default values. It also does not change the current file where the progress indicator will be drawn.

References cgul_progress_bar__reset().

§ get_style()

virtual cgul_progress_bar__style_t cgul_progress_bar_cxx::get_style ( ) const
inlinevirtual

Get the style of the progress bar.

Returns
progress bar style

References cgul_progress_bar__get_style().

§ set_style()

virtual void cgul_progress_bar_cxx::set_style ( cgul_progress_bar__style_t  style)
inlinevirtual

Set the style of the progress bar. The default style is CGUL_PROGRESS_BAR__SIMPLE. If an invalid style is specified, an exception is thrown.

Parameters
[in]styleprogress bar style

References cgul_progress_bar__set_style().

§ get_min()

virtual double cgul_progress_bar_cxx::get_min ( ) const
inlinevirtual

Get the minimum value for the range of progress.

Returns
minimum value

References cgul_progress_bar__get_min().

§ set_min()

virtual void cgul_progress_bar_cxx::set_min ( double  min)
inlinevirtual

Set the minimum value for the range of progress. By default, the minimum value is 0.

Parameters
[in]minminimum value

References cgul_progress_bar__set_min().

§ get_max()

virtual double cgul_progress_bar_cxx::get_max ( ) const
inlinevirtual

Get the maximum value for the range of progress.

Returns
maximum value

References cgul_progress_bar__get_max().

§ set_max()

virtual void cgul_progress_bar_cxx::set_max ( double  max)
inlinevirtual

Set the maximum value for the range of progress. By default, the maximum value is 100.

Parameters
[in]maxmaximum value

References cgul_progress_bar__set_max().

§ get_file()

virtual FILE* cgul_progress_bar_cxx::get_file ( ) const
inlinevirtual

Get the file where the progress indicator will be drawn.

Returns
file

References cgul_progress_bar__get_file().

§ set_file()

virtual void cgul_progress_bar_cxx::set_file ( FILE *  f)
inlinevirtual

Set the file where the progress indicator will be drawn. By default, the progress indicator is drawn to stdout.

Parameters
[in]ffile

References cgul_progress_bar__set_file().

§ update()

virtual void cgul_progress_bar_cxx::update ( double  progress,
const char *  before = NULL,
const char *  after = NULL 
)
inlinevirtual

Set the value used to indicated current progress. This is the method that makes the progress bar grow. The value of progress should be between the minimum and maximum values set by cgul_progress_bar__set_min() and cgul_progress_bar__set_max() respectively.

The actual percentage used when drawing the progress bar is rounded to the nearest percentage with the exception that 100% is not used until progress is greater than or equal to the maximum value.

If progress is less than the minimum value for the range, the minimum value will be used instead. If progress is greater than the maximum value for the range, the maximum value will be used instead.

If before or after is not NULL, the value or values that are not NULL will drawn in the correct location provided the style of the progress bar allows it. It is the responsibility of the client to make sure that before and after never get shorter; however, they can get longer.

If an error occurs while drawing the progress bar, an exception is throw. If the minimum value is set greater than or equal to the maximum value when this method is called, an exception is also thrown.

Parameters
[in]progressprogress
[in]beforecustom text to draw before the progress bar
[in]aftercustom text to draw after the progress bar

References cgul_progress_bar__update().

§ get_obj()

virtual cgul_progress_bar_t cgul_progress_bar_cxx::get_obj ( ) const
inlinevirtual

Get the underlying cgul_progress_bar object.

Returns
underlying object

§ take_obj()

virtual cgul_progress_bar_t cgul_progress_bar_cxx::take_obj ( )
inlinevirtual

Take the underlying cgul_progress_bar 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_progress_bar__delete().

Returns
underlying object

§ set_obj()

virtual void cgul_progress_bar_cxx::set_obj ( cgul_progress_bar_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_progress_bar__delete(), and cgul_progress_bar_cxx().


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