gslist.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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_SLIST_H__
  24. #define __G_SLIST_H__
  25. #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
  26. #error "Only <glib.h> can be included directly."
  27. #endif
  28. #include <glib/gmem.h>
  29. #include <glib/gnode.h>
  30. G_BEGIN_DECLS
  31. typedef struct _GSList GSList;
  32. struct _GSList
  33. {
  34. gpointer data;
  35. GSList *next;
  36. };
  37. /* Singly linked lists
  38. */
  39. GLIB_AVAILABLE_IN_ALL
  40. GSList* g_slist_alloc (void) G_GNUC_WARN_UNUSED_RESULT;
  41. GLIB_AVAILABLE_IN_ALL
  42. void g_slist_free (GSList *list);
  43. GLIB_AVAILABLE_IN_ALL
  44. void g_slist_free_1 (GSList *list);
  45. #define g_slist_free1 g_slist_free_1
  46. GLIB_AVAILABLE_IN_ALL
  47. void g_slist_free_full (GSList *list,
  48. GDestroyNotify free_func);
  49. GLIB_AVAILABLE_IN_ALL
  50. GSList* g_slist_append (GSList *list,
  51. gpointer data) G_GNUC_WARN_UNUSED_RESULT;
  52. GLIB_AVAILABLE_IN_ALL
  53. GSList* g_slist_prepend (GSList *list,
  54. gpointer data) G_GNUC_WARN_UNUSED_RESULT;
  55. GLIB_AVAILABLE_IN_ALL
  56. GSList* g_slist_insert (GSList *list,
  57. gpointer data,
  58. gint position) G_GNUC_WARN_UNUSED_RESULT;
  59. GLIB_AVAILABLE_IN_ALL
  60. GSList* g_slist_insert_sorted (GSList *list,
  61. gpointer data,
  62. GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT;
  63. GLIB_AVAILABLE_IN_ALL
  64. GSList* g_slist_insert_sorted_with_data (GSList *list,
  65. gpointer data,
  66. GCompareDataFunc func,
  67. gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
  68. GLIB_AVAILABLE_IN_ALL
  69. GSList* g_slist_insert_before (GSList *slist,
  70. GSList *sibling,
  71. gpointer data) G_GNUC_WARN_UNUSED_RESULT;
  72. GLIB_AVAILABLE_IN_ALL
  73. GSList* g_slist_concat (GSList *list1,
  74. GSList *list2) G_GNUC_WARN_UNUSED_RESULT;
  75. GLIB_AVAILABLE_IN_ALL
  76. GSList* g_slist_remove (GSList *list,
  77. gconstpointer data) G_GNUC_WARN_UNUSED_RESULT;
  78. GLIB_AVAILABLE_IN_ALL
  79. GSList* g_slist_remove_all (GSList *list,
  80. gconstpointer data) G_GNUC_WARN_UNUSED_RESULT;
  81. GLIB_AVAILABLE_IN_ALL
  82. GSList* g_slist_remove_link (GSList *list,
  83. GSList *link_) G_GNUC_WARN_UNUSED_RESULT;
  84. GLIB_AVAILABLE_IN_ALL
  85. GSList* g_slist_delete_link (GSList *list,
  86. GSList *link_) G_GNUC_WARN_UNUSED_RESULT;
  87. GLIB_AVAILABLE_IN_ALL
  88. GSList* g_slist_reverse (GSList *list) G_GNUC_WARN_UNUSED_RESULT;
  89. GLIB_AVAILABLE_IN_ALL
  90. GSList* g_slist_copy (GSList *list) G_GNUC_WARN_UNUSED_RESULT;
  91. GLIB_AVAILABLE_IN_2_34
  92. GSList* g_slist_copy_deep (GSList *list,
  93. GCopyFunc func,
  94. gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
  95. GLIB_AVAILABLE_IN_ALL
  96. GSList* g_slist_nth (GSList *list,
  97. guint n);
  98. GLIB_AVAILABLE_IN_ALL
  99. GSList* g_slist_find (GSList *list,
  100. gconstpointer data);
  101. GLIB_AVAILABLE_IN_ALL
  102. GSList* g_slist_find_custom (GSList *list,
  103. gconstpointer data,
  104. GCompareFunc func);
  105. GLIB_AVAILABLE_IN_ALL
  106. gint g_slist_position (GSList *list,
  107. GSList *llink);
  108. GLIB_AVAILABLE_IN_ALL
  109. gint g_slist_index (GSList *list,
  110. gconstpointer data);
  111. GLIB_AVAILABLE_IN_ALL
  112. GSList* g_slist_last (GSList *list);
  113. GLIB_AVAILABLE_IN_ALL
  114. guint g_slist_length (GSList *list);
  115. GLIB_AVAILABLE_IN_ALL
  116. void g_slist_foreach (GSList *list,
  117. GFunc func,
  118. gpointer user_data);
  119. GLIB_AVAILABLE_IN_ALL
  120. GSList* g_slist_sort (GSList *list,
  121. GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT;
  122. GLIB_AVAILABLE_IN_ALL
  123. GSList* g_slist_sort_with_data (GSList *list,
  124. GCompareDataFunc compare_func,
  125. gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
  126. GLIB_AVAILABLE_IN_ALL
  127. gpointer g_slist_nth_data (GSList *list,
  128. guint n);
  129. #define g_slist_next(slist) ((slist) ? (((GSList *)(slist))->next) : NULL)
  130. G_END_DECLS
  131. #endif /* __G_SLIST_H__ */