Data Model API (libmodel) | ||||
---|---|---|---|---|
Top | Description |
ModelSimpleDictionaryModelSimpleDictionary — a very simple implementation of ModelDictionary |
Synopsis
ModelSimpleDictionary; ModelSimpleDictionary * model_simple_dictionary_new (void); void model_simple_dictionary_set (ModelSimpleDictionary *simple, const gchar *key, ModelObject *value, gboolean monitored); void model_simple_dictionary_set_boolean (ModelSimpleDictionary *simple, const gchar *key, gboolean value, gboolean monitored); void model_simple_dictionary_set_integer (ModelSimpleDictionary *simple, const gchar *key, gint value, gboolean monitored); void model_simple_dictionary_set_float (ModelSimpleDictionary *simple, const gchar *key, gdouble value, gboolean monitored); void model_simple_dictionary_set_string (ModelSimpleDictionary *simple, const gchar *key, const gchar *value, gboolean monitored);
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.
|
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
.
|
a ModelSimpleDictionary |
|
a string, the key to set |
|
the new value, a ModelObject or NULL
|
|
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()
.
|
a ModelSimpleDictionary |
|
a string, the key to set |
|
a boolean value |
|
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()
.
|
a ModelSimpleDictionary |
|
a string, the key to set |
|
an integer |
|
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()
.
|
a ModelSimpleDictionary |
|
a string, the key to set |
|
a double precision floating point value |
|
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()
.
|
a ModelSimpleDictionary |
|
a string, the key to set |
|
a string |
|
TRUE if the key is being monitored
|