grel.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* GLIB - Library of useful routines for C programming
  2. * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /*
  18. * Modified by the GLib Team and others 1997-2000. See the AUTHORS
  19. * file for a list of people on the GLib Team. See the ChangeLog
  20. * files for a list of changes. These files are distributed with
  21. * GLib at ftp://ftp.gtk.org/pub/gtk/.
  22. */
  23. #ifndef __G_REL_H__
  24. #define __G_REL_H__
  25. #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
  26. #error "Only <glib.h> can be included directly."
  27. #endif
  28. #include <glib/gtypes.h>
  29. G_BEGIN_DECLS
  30. typedef struct _GRelation GRelation;
  31. typedef struct _GTuples GTuples;
  32. struct _GTuples
  33. {
  34. guint len;
  35. };
  36. /* GRelation
  37. *
  38. * Indexed Relations. Imagine a really simple table in a
  39. * database. Relations are not ordered. This data type is meant for
  40. * maintaining a N-way mapping.
  41. *
  42. * g_relation_new() creates a relation with FIELDS fields
  43. *
  44. * g_relation_destroy() frees all resources
  45. * g_tuples_destroy() frees the result of g_relation_select()
  46. *
  47. * g_relation_index() indexes relation FIELD with the provided
  48. * equality and hash functions. this must be done before any
  49. * calls to insert are made.
  50. *
  51. * g_relation_insert() inserts a new tuple. you are expected to
  52. * provide the right number of fields.
  53. *
  54. * g_relation_delete() deletes all relations with KEY in FIELD
  55. * g_relation_select() returns ...
  56. * g_relation_count() counts ...
  57. */
  58. GLIB_DEPRECATED_IN_2_26
  59. GRelation* g_relation_new (gint fields);
  60. GLIB_DEPRECATED_IN_2_26
  61. void g_relation_destroy (GRelation *relation);
  62. GLIB_DEPRECATED_IN_2_26
  63. void g_relation_index (GRelation *relation,
  64. gint field,
  65. GHashFunc hash_func,
  66. GEqualFunc key_equal_func);
  67. GLIB_DEPRECATED_IN_2_26
  68. void g_relation_insert (GRelation *relation,
  69. ...);
  70. GLIB_DEPRECATED_IN_2_26
  71. gint g_relation_delete (GRelation *relation,
  72. gconstpointer key,
  73. gint field);
  74. GLIB_DEPRECATED_IN_2_26
  75. GTuples* g_relation_select (GRelation *relation,
  76. gconstpointer key,
  77. gint field);
  78. GLIB_DEPRECATED_IN_2_26
  79. gint g_relation_count (GRelation *relation,
  80. gconstpointer key,
  81. gint field);
  82. GLIB_DEPRECATED_IN_2_26
  83. gboolean g_relation_exists (GRelation *relation,
  84. ...);
  85. GLIB_DEPRECATED_IN_2_26
  86. void g_relation_print (GRelation *relation);
  87. GLIB_DEPRECATED_IN_2_26
  88. void g_tuples_destroy (GTuples *tuples);
  89. GLIB_DEPRECATED_IN_2_26
  90. gpointer g_tuples_index (GTuples *tuples,
  91. gint index_,
  92. gint field);
  93. G_END_DECLS
  94. #endif /* __G_REL_H__ */