![]() |
![]() |
![]() |
V_Sim API - Reference Manual | ![]() |
---|---|---|---|---|
struct Option_stuct; typedef Option; typedef OptionTable; enum OptionTypes; Option* toolOptionsNew_optionBoolean (const gchar *name, const gchar *label); Option* toolOptionsNew_optionFloat (const gchar *name, const gchar *label); Option* toolOptionsNew_optionInteger (const gchar *name, const gchar *label); #define toolOptionsNew_table () void toolOptionsFree_option (gpointer option); #define toolOptionsFree_table (table) #define toolOptionsAdd_optionToTable (table, option) gchar* toolOptionsGet_label (Option *option); gchar* toolOptionsGet_name (Option *option); #define toolOptionsGet_optionFromTable (table, option) OptionTypes toolOptionsGet_type (Option *option); gchar* toolOptionsGet_valueAndLabel (Option *option); gboolean toolOptionsGet_valueBoolean (Option *option, gboolean *value); gboolean toolOptionsGet_valueFloat (Option *option, float *value); gboolean toolOptionsGet_valueInteger (Option *option, int *value); void toolOptionsSet_valueBoolean (Option *option, gboolean value); void toolOptionsSet_valueFloat (Option *option, float value); void toolOptionsSet_valueInteger (Option *option, int value);
This wrapper is a simple way to store integers, floating point values or booleans in a table, accessing with a string key and remembering their types.
typedef GHashTable OptionTable;
This hashtable is used to specificaly bind strings to Option elements.
typedef enum { OPTION_BOOLEAN, OPTION_INTEGER, OPTION_FLOAT, NB_OPTION_TYPES } OptionTypes;
These are types supported in the OptionTable.
Option* toolOptionsNew_optionBoolean (const gchar *name, const gchar *label);
Create a new Option using the name as identifier.
|
a string identifying the option ; |
|
a string describing shortly the option (must be in UTF-8). |
Returns : |
a newly created option, use toolOptionsFree_option() to free it.
|
Option* toolOptionsNew_optionFloat (const gchar *name, const gchar *label);
Create a new Option using the name as identifier.
|
a string identifying the option ; |
|
a string describing shortly the option (must be in UTF-8). |
Returns : |
a newly created option, use toolOptionsFree_option() to free it.
|
Option* toolOptionsNew_optionInteger (const gchar *name, const gchar *label);
Create a new Option using the name as identifier.
|
a string identifying the option ; |
|
a string describing shortly the option (must be in UTF-8). |
Returns : |
a newly created option, use toolOptionsFree_option() to free it.
|
#define toolOptionsNew_table()
Create a new table of options. Strings are used as keys and elements are Option.
Returns : |
a newly created table. Use toolOptionsFree_table() to destroy it.
|
void toolOptionsFree_option (gpointer option);
Free the memory used by the option
.
|
the Option to free. |
#define toolOptionsFree_table(table) g_hash_table_destroy((GHashTable*)table);
Free all memory used by a table of options, and free also its elements.
|
the table to free. |
#define toolOptionsAdd_optionToTable(table, option)
Add the given option
to the table, using its name as key.
|
the table to add the option to ; |
|
an Option to be added. |
gchar* toolOptionsGet_label (Option *option);
Get the label of the option.
|
the Option to get the label of. |
Returns : |
a string owned by V_Sim, should not be freed. |
gchar* toolOptionsGet_name (Option *option);
Get the name of the option.
|
the Option to get the name of. |
Returns : |
a string owned by V_Sim, should not be freed. |
#define toolOptionsGet_optionFromTable(table, option)
Look in table
to find option
. If no option with this name is found, then it
|
the table to look in ; |
|
a string being the option name. |
OptionTypes toolOptionsGet_type (Option *option);
Get the type of the option.
|
the Option to get the type of. |
Returns : |
a OptionTypes value. |
gchar* toolOptionsGet_valueAndLabel (Option *option);
This method returns a string with the value followed by the label in parenthesis and with Pango markup for smaller font.
|
the Option to get the value from. |
Returns : |
a newly created markup string. |
gboolean toolOptionsGet_valueBoolean (Option *option, gboolean *value);
Read the value of one option.
|
the Option to get the value from ; |
|
a location to store the value. |
Returns : |
FALSE if the value is currently unset. |
gboolean toolOptionsGet_valueFloat (Option *option, float *value);
Read the value of one option.
|
the Option to get the value from ; |
|
a location to store the value. |
Returns : |
FALSE if the value is currently unset. |
gboolean toolOptionsGet_valueInteger (Option *option, int *value);
Read the value of one option.
|
the Option to get the value from ; |
|
a location to store the value. |
Returns : |
FALSE if the value is currently unset. |
void toolOptionsSet_valueBoolean (Option *option, gboolean value);
Change or set (if not set yet) the value of one option.
|
the Option to set the value of ; |
|
the new value. |
void toolOptionsSet_valueFloat (Option *option, float value);
Change or set (if not set yet) the value of one option.
|
the Option to set the value of ; |
|
the new value. |