C++ bindings for cgul_progress_bar
More...
#include <cgul_progress_bar_cxx.h>
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) |
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.
|
inline |
Construct a new cgul_progress_bar_cxx
object with a default minimum value of 0 and a default maximum value of
stdout
. If memory allocation fails, an exception is thrown. References cgul_progress_bar__new().
Referenced by set_obj().
|
inlinevirtual |
This method frees all internally allocated resources for the object.
References cgul_progress_bar__delete().
|
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().
|
inlinevirtual |
Get the style of the progress bar.
References cgul_progress_bar__get_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.
[in] | style | progress bar style |
References cgul_progress_bar__set_style().
|
inlinevirtual |
Get the minimum value for the range of progress.
References cgul_progress_bar__get_min().
|
inlinevirtual |
Set the minimum value for the range of progress. By default, the minimum value is 0.
[in] | min | minimum value |
References cgul_progress_bar__set_min().
|
inlinevirtual |
Get the maximum value for the range of progress.
References cgul_progress_bar__get_max().
|
inlinevirtual |
Set the maximum value for the range of progress. By default, the maximum value is 100.
[in] | max | maximum value |
References cgul_progress_bar__set_max().
|
inlinevirtual |
Get the file where the progress indicator will be drawn.
References cgul_progress_bar__get_file().
|
inlinevirtual |
Set the file where the progress indicator will be drawn. By default, the progress indicator is drawn to stdout
.
[in] | f | file |
References cgul_progress_bar__set_file().
|
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.
[in] | progress | progress |
[in] | before | custom text to draw before the progress bar |
[in] | after | custom text to draw after the progress bar |
References cgul_progress_bar__update().
|
inlinevirtual |
Get the underlying cgul_progress_bar
object.
|
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()
.
|
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.
[in] | rhs | right-hand side |
References cgul_progress_bar__delete(), and cgul_progress_bar_cxx().