diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2023-04-26 19:58:45 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2023-04-26 19:58:45 (GMT) |
commit | a1ff7646ce6f829dd192e2e2246def2ea583e93b (patch) | |
tree | 092c83cebf8e711ac2da851a3f3c2cbdfb52aeac /plugins | |
parent | f06602ac36b4ad7974d836aad76ed236a7a0c942 (diff) |
Provide access to the first node of a collection.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/yaml/collection.c | 30 | ||||
-rw-r--r-- | plugins/yaml/collection.h | 3 |
2 files changed, 33 insertions, 0 deletions
diff --git a/plugins/yaml/collection.c b/plugins/yaml/collection.c index 376e894..03c3992 100644 --- a/plugins/yaml/collection.c +++ b/plugins/yaml/collection.c @@ -275,6 +275,36 @@ GYamlNode **g_yaml_collection_get_nodes(const GYamlCollection *collec, size_t *c /****************************************************************************** * * +* Paramètres : collec = noeud d'arborescence Yaml à consulter. * +* * +* Description : Fournit le premier noeud intégré dans une collection. * +* * +* Retour : Noeud issu d'une collection Yaml. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GYamlNode *g_yaml_collection_get_first_node(const GYamlCollection *collec) +{ + GYamlNode *result; /* Elément à retourner */ + + if (collec->count == 0) + result = NULL; + + else + { + result = collec->nodes[0]; + g_object_ref(G_OBJECT(result)); + } + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : node = noeud d'arborescence Yaml à consulter. * * path = chemin d'accès à parcourir. * * prepare = indication sur une préparation d'un prochain appel.* diff --git a/plugins/yaml/collection.h b/plugins/yaml/collection.h index 4d74d29..4bf0f2d 100644 --- a/plugins/yaml/collection.h +++ b/plugins/yaml/collection.h @@ -63,6 +63,9 @@ void g_yaml_collection_add_node(GYamlCollection *, GYamlNode *); /* Fournit la liste des noeuds intégrés dans une collection. */ GYamlNode **g_yaml_collection_get_nodes(const GYamlCollection *, size_t *); +/* Fournit le premier noeud intégré dans une collection. */ +GYamlNode *g_yaml_collection_get_first_node(const GYamlCollection *); + #endif /* PLUGINS_YAML_COLLECTION_H */ |