You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

123 lines
5.2 KiB

  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, write to the
  16. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17. * Boston, MA 02111-1307, USA.
  18. */
  19. /*
  20. * Modified by the GLib Team and others 1997-2000. See the AUTHORS
  21. * file for a list of people on the GLib Team. See the ChangeLog
  22. * files for a list of changes. These files are distributed with
  23. * GLib at ftp://ftp.gtk.org/pub/gtk/.
  24. */
  25. #if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
  26. #error "Only <glib.h> can be included directly."
  27. #endif
  28. #ifndef __G_DATASET_H__
  29. #define __G_DATASET_H__
  30. #include <glib/gquark.h>
  31. G_BEGIN_DECLS
  32. typedef struct _GData GData;
  33. typedef void (*GDataForeachFunc) (GQuark key_id,
  34. gpointer data,
  35. gpointer user_data);
  36. /* Keyed Data List
  37. */
  38. void g_datalist_init (GData **datalist);
  39. void g_datalist_clear (GData **datalist);
  40. gpointer g_datalist_id_get_data (GData **datalist,
  41. GQuark key_id);
  42. void g_datalist_id_set_data_full (GData **datalist,
  43. GQuark key_id,
  44. gpointer data,
  45. GDestroyNotify destroy_func);
  46. gpointer g_datalist_id_remove_no_notify (GData **datalist,
  47. GQuark key_id);
  48. void g_datalist_foreach (GData **datalist,
  49. GDataForeachFunc func,
  50. gpointer user_data);
  51. /**
  52. * G_DATALIST_FLAGS_MASK:
  53. *
  54. * A bitmask that restricts the possible flags passed to
  55. * g_datalist_set_flags(). Passing a flags value where
  56. * flags & ~G_DATALIST_FLAGS_MASK != 0 is an error.
  57. */
  58. #define G_DATALIST_FLAGS_MASK 0x3
  59. void g_datalist_set_flags (GData **datalist,
  60. guint flags);
  61. void g_datalist_unset_flags (GData **datalist,
  62. guint flags);
  63. guint g_datalist_get_flags (GData **datalist);
  64. #define g_datalist_id_set_data(dl, q, d) \
  65. g_datalist_id_set_data_full ((dl), (q), (d), NULL)
  66. #define g_datalist_id_remove_data(dl, q) \
  67. g_datalist_id_set_data ((dl), (q), NULL)
  68. #define g_datalist_get_data(dl, k) \
  69. (g_datalist_id_get_data ((dl), g_quark_try_string (k)))
  70. #define g_datalist_set_data_full(dl, k, d, f) \
  71. g_datalist_id_set_data_full ((dl), g_quark_from_string (k), (d), (f))
  72. #define g_datalist_remove_no_notify(dl, k) \
  73. g_datalist_id_remove_no_notify ((dl), g_quark_try_string (k))
  74. #define g_datalist_set_data(dl, k, d) \
  75. g_datalist_set_data_full ((dl), (k), (d), NULL)
  76. #define g_datalist_remove_data(dl, k) \
  77. g_datalist_id_set_data ((dl), g_quark_try_string (k), NULL)
  78. /* Location Associated Keyed Data
  79. */
  80. void g_dataset_destroy (gconstpointer dataset_location);
  81. gpointer g_dataset_id_get_data (gconstpointer dataset_location,
  82. GQuark key_id);
  83. void g_dataset_id_set_data_full (gconstpointer dataset_location,
  84. GQuark key_id,
  85. gpointer data,
  86. GDestroyNotify destroy_func);
  87. gpointer g_dataset_id_remove_no_notify (gconstpointer dataset_location,
  88. GQuark key_id);
  89. void g_dataset_foreach (gconstpointer dataset_location,
  90. GDataForeachFunc func,
  91. gpointer user_data);
  92. #define g_dataset_id_set_data(l, k, d) \
  93. g_dataset_id_set_data_full ((l), (k), (d), NULL)
  94. #define g_dataset_id_remove_data(l, k) \
  95. g_dataset_id_set_data ((l), (k), NULL)
  96. #define g_dataset_get_data(l, k) \
  97. (g_dataset_id_get_data ((l), g_quark_try_string (k)))
  98. #define g_dataset_set_data_full(l, k, d, f) \
  99. g_dataset_id_set_data_full ((l), g_quark_from_string (k), (d), (f))
  100. #define g_dataset_remove_no_notify(l, k) \
  101. g_dataset_id_remove_no_notify ((l), g_quark_try_string (k))
  102. #define g_dataset_set_data(l, k, d) \
  103. g_dataset_set_data_full ((l), (k), (d), NULL)
  104. #define g_dataset_remove_data(l, k) \
  105. g_dataset_id_set_data ((l), g_quark_try_string (k), NULL)
  106. G_END_DECLS
  107. #endif /* __G_DATASET_H__ */