![]() |
![]() |
![]() |
GNOME Data Access 4.0 manual | ![]() |
---|---|---|---|---|
GdaSet; GdaSet* gda_set_new (GSList *holders); GdaSet* gda_set_copy (GdaSet *set); GdaSet* gda_set_new_inline (gint nb, ...); GdaSet* gda_set_new_from_spec_string (const gchar *xml_spec, GError **error); GdaSet* gda_set_new_from_spec_node (xmlNodePtr xml_spec, GError **error); gboolean gda_set_is_valid (GdaSet *set, GError **error); const GValue* gda_set_get_holder_value (GdaSet *set, const gchar *holder_id); gboolean gda_set_set_holder_value (GdaSet *set, GError **error, const gchar *holder_id, ...); GdaHolder* gda_set_get_holder (GdaSet *set, const gchar *holder_id); gboolean gda_set_add_holder (GdaSet *set, GdaHolder *holder); void gda_set_remove_holder (GdaSet *set, GdaHolder *holder); void gda_set_merge_with_set (GdaSet *set, GdaSet *set_to_merge); GdaSetNode; GdaSetNode* gda_set_get_node (GdaSet *set, GdaHolder *param); GdaSetSource; GdaSetSource* gda_set_get_source_for_model (GdaSet *set, GdaDataModel *model); GdaSetSource* gda_set_get_source (GdaSet *set, GdaHolder *param); GdaSetGroup; GdaSetGroup* gda_set_get_group (GdaSet *set, GdaHolder *param);
"description" gchar* : Read / Write "holders" gpointer : Write / Construct Only "id" gchar* : Read / Write "name" gchar* : Read / Write
"holder-attr-changed" : Run First "holder-changed" : Run First "public-data-changed" : Run First "validate-holder-change" : Run Last "validate-set" : Run Last
The GdaSet object is a container for several values (as GdaHolder objects), which also offers
different classifications of the group of GdaHolder values (see gda_set_get_node()
, gda_set_get_source()
or
gda_set_get_group()
).
It is possible to control the values a GdaHolder can have in the GdaSet by connecting to the "before-holder-change" signal.
GdaSet* gda_set_new (GSList *holders);
Creates a new GdaSet object, and populates it with the list given as argument.
The list can then be freed as it is copied. All the value holders in holders
are referenced counted
and modified, so they should not be used anymore afterwards.
GdaSet* gda_set_new_inline (gint nb, ...);
Creates a new GdaSet containing holders defined by each triplet in ... For each triplet (id, Glib type and value), the value must be of the correct type (gchar * if type is G_STRING, ...)
Note that this function is a utility function and that anly a limited set of types are supported. Trying to use an unsupported type will result in a warning, and the returned value holder holding a safe default value.
GdaSet* gda_set_new_from_spec_string (const gchar *xml_spec, GError **error);
Creates a new GdaSet object from the xml_spec
specifications
GdaSet* gda_set_new_from_spec_node (xmlNodePtr xml_spec, GError **error);
Creates a new GdaSet object from the xml_spec
specifications
gboolean gda_set_is_valid (GdaSet *set, GError **error);
This method tells if all set
's GdaHolder objects are valid, and if
they represent a valid combination of values, as defined by rules
external to Libgda: the "validate-set" signal is emitted and if none of the signal handlers return an
error, then the returned value is TRUE, otherwise the return value is FALSE as soon as a signal handler
returns an error.
const GValue* gda_set_get_holder_value (GdaSet *set, const gchar *holder_id);
Get the value of the GdaHolder which ID is holder_id
|
a GdaSet object |
|
the ID of the holder to set the value |
Returns : |
the requested GValue, or NULL (see gda_holder_get_value() )
|
gboolean gda_set_set_holder_value (GdaSet *set, GError **error, const gchar *holder_id, ...);
Set the value of the GdaHolder which ID is holder_id
to a specified value
GdaHolder* gda_set_get_holder (GdaSet *set, const gchar *holder_id);
Finds a GdaHolder using its ID
gboolean gda_set_add_holder (GdaSet *set, GdaHolder *holder);
Adds holder
to the list of holders managed within set
.
NOTE: if set
already has a GdaHolder with the same ID as holder
, then holder
will not be added to the set (even if holder
's type or value is not the same as the
one already in set
).
void gda_set_remove_holder (GdaSet *set, GdaHolder *holder);
|
|
|
void gda_set_merge_with_set (GdaSet *set, GdaSet *set_to_merge);
Add to set
all the holders of set_to_merge
.
Note1: only the GdaHolder of set_to_merge
for which no holder in set
has the same ID are merged
Note2: all the GdaHolder merged in set
are still used by set_to_merge
.
typedef struct { GdaHolder *holder; /* Can't be NULL */ GdaDataModel *source_model; /* may be NULL if @holder does not have any source */ gint source_column; /* unused is @source_model is NULL */ } GdaSetNode;
For each GdaHolder object in the GdaSet object, there is a GdaSetNode structure which sums up all the information for each GdaHolder.
GdaSetNode* gda_set_get_node (GdaSet *set, GdaHolder *param);
Finds a GdaSetNode holding information for holder
, don't modify the returned structure
|
a GdaSet object |
|
|
Returns : |
a GdaSetNode or NULL
|
typedef struct { GdaDataModel *data_model; /* Can't be NULL */ GSList *nodes; /* list of #GdaSetNode for which source_model == @data_model */ /* displayed columns in 'data_model' */ gint shown_n_cols; gint *shown_cols_index; /* columns used as a reference (corresponding to PK values) in 'data_model' */ gint ref_n_cols; gint *ref_cols_index; } GdaSetSource;
There is a GdaSetSource structure for each GdaDataModel which is a source for least one GdaHolder in the GdaSet object.
GdaSetSource* gda_set_get_source_for_model (GdaSet *set, GdaDataModel *model);
Finds the GdaSetSource structure used in set
for which model
is a
the data model, don't modify the returned structure
|
a GdaSet object |
|
a GdaDataModel object |
Returns : |
a GdaSetSource pointer or NULL .
|
GdaSetSource* gda_set_get_source (GdaSet *set, GdaHolder *param);
Finds a GdaSetSource which contains the GdaDataModel restricting the possible values of
holder
, don't modify the returned structure.
|
a GdaSet object |
|
|
Returns : |
a GdaSetSource or NULL
|
typedef struct { GSList *nodes; /* list of GdaSetNode, at least one entry */ GdaSetSource *nodes_source; /* if NULL, then @nodes contains exactly one entry */ } GdaSetGroup;
The GdaSetGroup is another view of the GdaHolder objects contained in the "" there is one such structure for each _independant_ parameter (parameters which have the same source data model all appear in the same GdaSetGroup structure).
GdaSetGroup* gda_set_get_group (GdaSet *set, GdaHolder *param);
Finds a GdaSetGroup which lists a GdaSetNode containing holder
,
don't modify the returned structure.
|
a GdaSet object |
|
|
Returns : |
a GdaSetGroup or NULL
|
"holder-attr-changed"
signalvoid user_function (GdaSet *gdaset, GdaHolder *arg1, gchar *arg2, GValue *arg3, gpointer user_data) : Run First
|
the object which received the signal. |
|
|
|
|
|
|
|
user data set when the signal handler was connected. |
"holder-changed"
signalvoid user_function (GdaSet *gdaset, GdaHolder *arg1, gpointer user_data) : Run First
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
"public-data-changed"
signalvoid user_function (GdaSet *gdaset, gpointer user_data) : Run First
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"validate-holder-change"
signalGdaError* user_function (GdaSet *set, GdaHolder *holder, GValue *new_value, gpointer user_data) : Run Last
Gets emitted when a GdaHolder's in set
is going to change its value. One can connect to
this signal to control which values holder
can have (for example to implement some business rules)
"validate-set"
signalGdaError* user_function (GdaSet *set, gpointer user_data) : Run Last
Gets emitted when gda_set_is_valid()
is called, use
this signal to control which combination of values set
's holder can have (for example to implement some business rules)
|
the object which received the signal |
|
user data set when the signal handler was connected. |
Returns : |
NULL if set 's contents has been validated, or a GError
otherwise.
|