ModelSimpleDictionary

ModelSimpleDictionary — a very simple implementation of ModelDictionary

Description

ModelSimpleDictionary is a simple ModelDictionary implementation.

After creating an instance, it needs to be filled with values using model_simple_dictionary_set() or its convenience wrappers.

No new keys may be added after the first use of any of the ModelDictionary APIs, but values of existing keys may be changed. If you don't know the value of a particular key at creation time then use NULL.

Details

ModelSimpleDictionary

typedef struct {
  ModelDictionary parent_instance;
} ModelSimpleDictionary;

This is an opaque structure; it may not be accessed directly.


model_simple_dictionary_new ()

ModelSimpleDictionary * model_simple_dictionary_new     (void);

Creates a new ModelSimpleDictionary with no keys.

You must add the entire set of keys to it with model_simple_dictionary_set() before using any of the ModelDictionary APIs.

returns :

a new ModelSimpleDictionary

model_simple_dictionary_set ()

void                model_simple_dictionary_set         (ModelSimpleDictionary *simple,
                                                         const gchar *key,
                                                         ModelObject *value,
                                                         gboolean monitored);

Create a new key, key, or set the value of an existing key.

The value is set to value, which may be NULL.

If monitored is TRUE, then simple is kept alive for as long as there is a ModelReference for key. This allows subclasses of ModelSimpleDictionary to continue monitoring for changes in the value. If monitored is FALSE, then no extra effort is made to keep simple alive when ModelReferences are being held for key.

simple :

a ModelSimpleDictionary

key :

a string, the key to set

value :

the new value, a ModelObject or NULL

monitored :

TRUE if the key is being monitored

model_simple_dictionary_set_boolean ()

void                model_simple_dictionary_set_boolean (ModelSimpleDictionary *simple,
                                                         const gchar *key,
                                                         gboolean value,
                                                         gboolean monitored);

Updates the value of key to the given boolean value.

This is a convenience wrapper around model_simple_dictionary_set() and model_boolean_new().

simple :

a ModelSimpleDictionary

key :

a string, the key to set

value :

a boolean value

monitored :

TRUE if the key is being monitored

model_simple_dictionary_set_integer ()

void                model_simple_dictionary_set_integer (ModelSimpleDictionary *simple,
                                                         const gchar *key,
                                                         gint value,
                                                         gboolean monitored);

Updates the value of key to the given integer.

This is a convenience wrapper around model_simple_dictionary_set() and model_integer_new().

simple :

a ModelSimpleDictionary

key :

a string, the key to set

value :

an integer

monitored :

TRUE if the key is being monitored

model_simple_dictionary_set_float ()

void                model_simple_dictionary_set_float   (ModelSimpleDictionary *simple,
                                                         const gchar *key,
                                                         gdouble value,
                                                         gboolean monitored);

Updates the value of key to the given floating point value.

This is a convenience wrapper around model_simple_dictionary_set() and model_float_new().

simple :

a ModelSimpleDictionary

key :

a string, the key to set

value :

a double precision floating point value

monitored :

TRUE if the key is being monitored

model_simple_dictionary_set_string ()

void                model_simple_dictionary_set_string  (ModelSimpleDictionary *simple,
                                                         const gchar *key,
                                                         const gchar *value,
                                                         gboolean monitored);

Updates the value of key to the given string.

This is a convenience wrapper around model_simple_dictionary_set() and model_string_new().

simple :

a ModelSimpleDictionary

key :

a string, the key to set

value :

a string

monitored :

TRUE if the key is being monitored