toolOptions

toolOptions — A convienent wrapper around GHashTable that can support types.

Synopsis

                    ToolOption;
ToolOption*         tool_option_new                     (const gchar *name,
                                                         const gchar *label,
                                                         GType g_type);
void                tool_option_free                    (gpointer data);
ToolOption*         tool_option_copy                    (const ToolOption *from);
const gchar*        tool_option_getName                 (ToolOption *option);
const gchar*        tool_option_getLabel                (ToolOption *option);
GType               tool_option_getType                 (ToolOption *option);
GValue*             tool_option_getValue                (ToolOption *option);
gchar*              tool_option_getValueAndLabel        (ToolOption *option);

Description

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.

Details

ToolOption

typedef struct _ToolOption ToolOption;

An opaque structure to store values. It is equivalent to GValue but with a name and a label.


tool_option_new ()

ToolOption*         tool_option_new                     (const gchar *name,
                                                         const gchar *label,
                                                         GType g_type);

Create a new Option using the name as identifier.

name :

a string identifying the option ;

label :

a string describing shortly the option (must be in UTF-8).

g_type :

the type of option to create.

Returns :

a newly created option, use tool_option_free() to free it.. transfer none.

tool_option_free ()

void                tool_option_free                    (gpointer data);

Free the memory used by the data.

data :

the Option to free.

tool_option_copy ()

ToolOption*         tool_option_copy                    (const ToolOption *from);

Create a new ToolOption using the values from option from.

from :

an existing ToolOption.

Returns :

a newly created option, use tool_option_free() to free it.. transfer none.

tool_option_getName ()

const gchar*        tool_option_getName                 (ToolOption *option);

Get the name of the option.

option :

the Option to get the name of.

Returns :

a string owned by V_Sim, should not be freed.

tool_option_getLabel ()

const gchar*        tool_option_getLabel                (ToolOption *option);

Get the label of the option.

option :

the Option to get the label of.

Returns :

a string owned by V_Sim, should not be freed.

tool_option_getType ()

GType               tool_option_getType                 (ToolOption *option);

Get the type of the option.

option :

the Option to get the type of.

Returns :

a OptionTypes value.

tool_option_getValue ()

GValue*             tool_option_getValue                (ToolOption *option);

Get the location of the storage for the option.

option :

a Option object.

Returns :

the GValue storing the option value.

tool_option_getValueAndLabel ()

gchar*              tool_option_getValueAndLabel        (ToolOption *option);

This method returns a string with the value followed by the label in parenthesis and with Pango markup for smaller font.

option :

the Option to get the value from.

Returns :

a newly created markup string.