mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
docs: Move the GRelation SECTION
Move it to the struct docs. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Helps: #3037
This commit is contained in:
parent
3981c1c704
commit
924e164a73
@ -48,61 +48,53 @@
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* SECTION:relations
|
||||
* @title: Relations and Tuples
|
||||
* @short_description: tables of data which can be indexed on any
|
||||
* number of fields
|
||||
* GRelation:
|
||||
*
|
||||
* A #GRelation is a table of data which can be indexed on any number
|
||||
* of fields, rather like simple database tables. A #GRelation contains
|
||||
* A `GRelation` is a table of data which can be indexed on any number
|
||||
* of fields, rather like simple database tables. A `GRelation` contains
|
||||
* a number of records, called tuples. Each record contains a number of
|
||||
* fields. Records are not ordered, so it is not possible to find the
|
||||
* record at a particular index.
|
||||
*
|
||||
* Note that #GRelation tables are currently limited to 2 fields.
|
||||
* Note that `GRelation` tables are currently limited to 2 fields.
|
||||
*
|
||||
* To create a GRelation, use g_relation_new().
|
||||
* To create a `GRelation`, use [func@GLib.Relation.new].
|
||||
*
|
||||
* To specify which fields should be indexed, use g_relation_index().
|
||||
* To specify which fields should be indexed, use [method@GLib.Relation.index].
|
||||
* Note that this must be called before any tuples are added to the
|
||||
* #GRelation.
|
||||
* `GRelation`.
|
||||
*
|
||||
* To add records to a #GRelation use g_relation_insert().
|
||||
* To add records to a `GRelation` use [method@GLib.Relation.insert].
|
||||
*
|
||||
* To determine if a given record appears in a #GRelation, use
|
||||
* g_relation_exists(). Note that fields are compared directly, so
|
||||
* To determine if a given record appears in a `GRelation`, use
|
||||
* [method@GLib.Relation.exists]. Note that fields are compared directly, so
|
||||
* pointers must point to the exact same position (i.e. different
|
||||
* copies of the same string will not match.)
|
||||
*
|
||||
* To count the number of records which have a particular value in a
|
||||
* given field, use g_relation_count().
|
||||
* given field, use [method@GLib.Relation.count].
|
||||
*
|
||||
* To get all the records which have a particular value in a given
|
||||
* field, use g_relation_select(). To access fields of the resulting
|
||||
* records, use g_tuples_index(). To free the resulting records use
|
||||
* g_tuples_destroy().
|
||||
* field, use [method@GLib.Relation.select]. To access fields of the resulting
|
||||
* records, use [method@GLib.Tuples.index]. To free the resulting records use
|
||||
* [method@GLib.Tuples.destroy].
|
||||
*
|
||||
* To delete all records which have a particular value in a given
|
||||
* field, use g_relation_delete().
|
||||
* field, use [method@GLib.Relation.delete].
|
||||
*
|
||||
* To destroy the #GRelation, use g_relation_destroy().
|
||||
* To destroy the `GRelation`, use [method@GLib.Relation.destroy].
|
||||
*
|
||||
* To help debug #GRelation objects, use g_relation_print().
|
||||
* To help debug `GRelation` objects, use [method@GLib.Relation.print].
|
||||
*
|
||||
* GRelation has been marked as deprecated, since this API has never
|
||||
* `GRelation` has been marked as deprecated, since this API has never
|
||||
* been fully implemented, is not very actively maintained and rarely
|
||||
* used.
|
||||
*
|
||||
* Deprecated: 2.26: Rarely used API
|
||||
**/
|
||||
|
||||
typedef struct _GRealTuples GRealTuples;
|
||||
|
||||
/**
|
||||
* GRelation:
|
||||
*
|
||||
* The #GRelation struct is an opaque data structure to represent a
|
||||
* [Relation][glib-Relations-and-Tuples]. It should
|
||||
* only be accessed via the following functions.
|
||||
**/
|
||||
struct _GRelation
|
||||
{
|
||||
gint fields;
|
||||
@ -122,6 +114,8 @@ struct _GRelation
|
||||
* #GRelation by g_relation_select(). It only contains one public
|
||||
* member - the number of records that matched. To access the matched
|
||||
* records, you must use g_tuples_index().
|
||||
*
|
||||
* Deprecated: 2.26: Rarely used API
|
||||
**/
|
||||
struct _GRealTuples
|
||||
{
|
||||
|
@ -43,29 +43,6 @@ struct _GTuples
|
||||
guint len;
|
||||
};
|
||||
|
||||
/* GRelation
|
||||
*
|
||||
* Indexed Relations. Imagine a really simple table in a
|
||||
* database. Relations are not ordered. This data type is meant for
|
||||
* maintaining a N-way mapping.
|
||||
*
|
||||
* g_relation_new() creates a relation with FIELDS fields
|
||||
*
|
||||
* g_relation_destroy() frees all resources
|
||||
* g_tuples_destroy() frees the result of g_relation_select()
|
||||
*
|
||||
* g_relation_index() indexes relation FIELD with the provided
|
||||
* equality and hash functions. this must be done before any
|
||||
* calls to insert are made.
|
||||
*
|
||||
* g_relation_insert() inserts a new tuple. you are expected to
|
||||
* provide the right number of fields.
|
||||
*
|
||||
* g_relation_delete() deletes all relations with KEY in FIELD
|
||||
* g_relation_select() returns ...
|
||||
* g_relation_count() counts ...
|
||||
*/
|
||||
|
||||
GLIB_DEPRECATED_IN_2_26
|
||||
GRelation* g_relation_new (gint fields);
|
||||
GLIB_DEPRECATED_IN_2_26
|
||||
|
Loading…
Reference in New Issue
Block a user