Top |
Functions
Properties
gchar * | description | Read / Write |
gpointer | holders | Write / Construct Only |
gchar * | id | Read / Write |
gchar * | name | Read / Write |
gboolean | validate-changes | Read / Write |
Object Hierarchy
GBoxed ├── GdaSetGroup ├── GdaSetNode ╰── GdaSetSource GObject ╰── GdaSet ╰── GdaDataModelIter
Description
The GdaSet object is a container for several values (as GdaHolder objects). Each GdaSet object also
maintains some publicly accessible information about the GdaHolder objects, through the GdaSetNode, GdaSetSource and
GdaSetGroup structures (see gda_set_get_node()
, gda_set_get_source()
and 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.Functions
gda_set_node_new ()
GdaSetNode *
gda_set_node_new (GdaHolder *holder
);
Creates a new GdaSetNode struct.
Return: (transfer full): a new GdaSetNode struct.
Since: 5.2
gda_set_node_free ()
void
gda_set_node_free (GdaSetNode *node
);
Frees any resources taken by node
struct. If node
is NULL
, then nothing happens.
Since: 5.2
gda_set_node_copy ()
GdaSetNode *
gda_set_node_copy (GdaSetNode *node
);
Copy constructor.
Since: 5.2
gda_set_node_set_holder ()
void gda_set_node_set_holder (GdaSetNode *node
,GdaHolder *holder
);
Set a GdaHolder to node
.
Since: 5.2
gda_set_node_get_data_model ()
GdaDataModel *
gda_set_node_get_data_model (GdaSetNode *node
);
Since: 5.2
gda_set_node_set_data_model ()
void gda_set_node_set_data_model (GdaSetNode *node
,GdaDataModel *model
);
Set a GdaDataModel to be used by node
. model
increment its reference
counting when set. Internally referenced column number is set to first column
in model
.
Parameters
node |
a GdaSetNode struct to set data model to |
|
model |
a GdaDataModel to be used by |
[allow-none] |
Since: 5.2
gda_set_node_get_source_column ()
gint
gda_set_node_get_source_column (GdaSetNode *node
);
Returns
the number of column referenced in a given GdaDataModel. If negative
no column is referenced or no GdaDataModel is used by node
.
Since: 5.2
gda_set_node_set_source_column ()
void gda_set_node_set_source_column (GdaSetNode *node
,gint column
);
Set column number in the GdaDataModel used node
. If no GdaDataModel is set
then column is set to invalid (-1);
Since: 5.2
gda_set_group_new ()
GdaSetGroup *
gda_set_group_new (GdaSetNode *node
);
Creates a new GdaSetGroup struct. If source
is NULL
then new group contains
just one GdaSetNode.
Return: (transfer full): a new GdaSetGroup struct.
Since: 5.2
gda_set_group_free ()
void
gda_set_group_free (GdaSetGroup *sg
);
Frees any resources taken by sg
struct. If sg
is NULL
, then nothing happens.
Since: 5.2
gda_set_group_copy ()
GdaSetGroup *
gda_set_group_copy (GdaSetGroup *sg
);
Copy constructor.
Since: 5.2
gda_set_group_add_node ()
void gda_set_group_add_node (GdaSetGroup *sg
,GdaSetNode *node
);
Since: 5.2
gda_set_group_get_node ()
GdaSetNode *
gda_set_group_get_node (GdaSetGroup *sg
);
This method always return first GdaSetNode in sg
.
Since: 5.2
gda_set_group_get_nodes ()
GSList *
gda_set_group_get_nodes (GdaSetGroup *sg
);
Returns a GSList with the GdaSetNode grouped by sg
. You must use
g_slist_free on returned list.
Since: 5.2
gda_set_group_set_source ()
void gda_set_group_set_source (GdaSetGroup *sg
,GdaSetSource *source
);
Since: 5.2
gda_set_source_new ()
GdaSetSource *
gda_set_source_new (GdaDataModel *model
);
Creates a new GdaSetSource struct.
Return: (transfer full): a new GdaSetSource struct.
Since: 5.2
gda_set_source_free ()
void
gda_set_source_free (GdaSetSource *s
);
Frees any resources taken by s
struct. If s
is NULL
, then nothing happens.
Since: 5.2
gda_set_source_copy ()
GdaSetSource *
gda_set_source_copy (GdaSetSource *s
);
Copy constructor.
Since: 5.2
gda_set_source_add_node ()
void gda_set_source_add_node (GdaSetSource *s
,GdaSetNode *node
);
Set a GdaDataModel
Since: 5.2
gda_set_source_get_data_model ()
GdaDataModel *
gda_set_source_get_data_model (GdaSetSource *s
);
Since: 5.2
gda_set_source_set_data_model ()
void gda_set_source_set_data_model (GdaSetSource *s
,GdaDataModel *model
);
Set a GdaDataModel
Since: 5.2
gda_set_new ()
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.
gda_set_new_inline ()
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 only 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.
Parameters
nb |
the number of value holders which will be contained in the new GdaSet |
|
... |
a serie of a (const gchar*) id, (GType) type, and value |
gda_set_new_from_spec_string ()
GdaSet * gda_set_new_from_spec_string (const gchar *xml_spec
,GError **error
);
Creates a new GdaSet object from the xml_spec
specifications
gda_set_new_from_spec_node ()
GdaSet * gda_set_new_from_spec_node (xmlNodePtr xml_spec
,GError **error
);
Creates a new GdaSet object from the xml_spec
specifications
Parameters
xml_spec |
a xmlNodePtr for a <parameters> tag |
|
error |
a place to store the error, or |
[allow-none] |
gda_set_set_holder_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
gda_set_get_holder_value ()
const GValue * gda_set_get_holder_value (GdaSet *set
,const gchar *holder_id
);
Get the value of the GdaHolder which ID is holder_id
gda_set_get_holder ()
GdaHolder * gda_set_get_holder (GdaSet *set
,const gchar *holder_id
);
Finds a GdaHolder using its ID
gda_set_get_nth_holder ()
GdaHolder * gda_set_get_nth_holder (GdaSet *set
,gint pos
);
Finds a GdaHolder using its position
Since: 4.2
gda_set_add_holder ()
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
).
gda_set_remove_holder ()
void gda_set_remove_holder (GdaSet *set
,GdaHolder *holder
);
Removes a GdaHolder from the list of holders managed by set
gda_set_merge_with_set ()
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
.
gda_set_is_valid ()
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.
gda_set_replace_source_model ()
void gda_set_replace_source_model (GdaSet *set
,GdaSetSource *source
,GdaDataModel *model
);
Replaces source->data_model
with model
, which must have the same
characteristics as source->data_model
(same column types)
Also for each GdaHolder for which source->data_model
is a source model,
this method calls gda_holder_set_source_model()
with model
to replace
the source by the new model
Since: 4.2
gda_set_get_node ()
GdaSetNode * gda_set_get_node (GdaSet *set
,GdaHolder *holder
);
Finds a GdaSetNode holding information for holder
, don't modify the returned structure
gda_set_get_source_for_model ()
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 (the returned structure should not be modified).
gda_set_get_source ()
GdaSetSource * gda_set_get_source (GdaSet *set
,GdaHolder *holder
);
Finds a GdaSetSource which contains the GdaDataModel restricting the possible values of
holder
, don't modify the returned structure.
gda_set_get_group ()
GdaSetGroup * gda_set_get_group (GdaSet *set
,GdaHolder *holder
);
Finds a GdaSetGroup which lists a GdaSetNode containing holder
,
don't modify the returned structure.
Property Details
The “description”
property
“description” gchar *
Description.
Flags: Read / Write
Default value: NULL
The “holders”
property
“holders” gpointer
GdaHolder objects the set should contain.
Flags: Write / Construct Only
Signal Details
The “holder-attr-changed”
signal
void user_function (GdaSet *set, GdaHolder *holder, gchar *attr_name, GValue *attr_value, gpointer user_data)
Gets emitted when an attribute for any of the GdaHolder objects managed by set
has changed
Parameters
set |
the GdaSet |
|
holder |
the GdaHolder for which an attribute changed |
|
attr_name |
attribute's name |
|
attr_value |
attribute's value |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First
The “holder-changed”
signal
void user_function (GdaSet *gdaset, GdaHolder *arg1, gpointer user_data)
Flags: Run First
The “holder-type-set”
signal
void user_function (GdaSet *set, GdaHolder *holder, gpointer user_data)
Gets emitted when holder
in set
has its type finally set, in case
it was GDA_TYPE_NULL
Flags: Run First
Since: 4.2
The “public-data-changed”
signal
void user_function (GdaSet *set, gpointer user_data)
Gets emitted when set
's public data (GdaSetNode, GdaSetGroup or GdaSetSource values) have changed
Flags: Run First
The “source-model-changed”
signal
void user_function (GdaSet *set, gpointer source, gpointer user_data)
Gets emitted when the data model in source
has changed
Parameters
set |
the GdaSet |
|
source |
the GdaSetSource for which the |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First
Since: 4.2
The “validate-holder-change”
signal
GError* user_function (GdaSet *set, GdaHolder *holder, GValue *new_value, gpointer user_data)
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)
Flags: Run Last
The “validate-set”
signal
GError* user_function (GdaSet *set, gpointer user_data)
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)
Flags: Run Last