gsequence.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /* GLIB - Library of useful routines for C programming
  2. * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
  3. * Soeren Sandmann ([email protected])
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef __G_SEQUENCE_H__
  19. #define __G_SEQUENCE_H__
  20. #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
  21. #error "Only <glib.h> can be included directly."
  22. #endif
  23. #include <glib/gtypes.h>
  24. G_BEGIN_DECLS
  25. typedef struct _GSequence GSequence;
  26. typedef struct _GSequenceNode GSequenceIter;
  27. typedef gint (* GSequenceIterCompareFunc) (GSequenceIter *a,
  28. GSequenceIter *b,
  29. gpointer data);
  30. /* GSequence */
  31. GLIB_AVAILABLE_IN_ALL
  32. GSequence * g_sequence_new (GDestroyNotify data_destroy);
  33. GLIB_AVAILABLE_IN_ALL
  34. void g_sequence_free (GSequence *seq);
  35. GLIB_AVAILABLE_IN_ALL
  36. gint g_sequence_get_length (GSequence *seq);
  37. GLIB_AVAILABLE_IN_ALL
  38. void g_sequence_foreach (GSequence *seq,
  39. GFunc func,
  40. gpointer user_data);
  41. GLIB_AVAILABLE_IN_ALL
  42. void g_sequence_foreach_range (GSequenceIter *begin,
  43. GSequenceIter *end,
  44. GFunc func,
  45. gpointer user_data);
  46. GLIB_AVAILABLE_IN_ALL
  47. void g_sequence_sort (GSequence *seq,
  48. GCompareDataFunc cmp_func,
  49. gpointer cmp_data);
  50. GLIB_AVAILABLE_IN_ALL
  51. void g_sequence_sort_iter (GSequence *seq,
  52. GSequenceIterCompareFunc cmp_func,
  53. gpointer cmp_data);
  54. /* Getting iters */
  55. GLIB_AVAILABLE_IN_ALL
  56. GSequenceIter *g_sequence_get_begin_iter (GSequence *seq);
  57. GLIB_AVAILABLE_IN_ALL
  58. GSequenceIter *g_sequence_get_end_iter (GSequence *seq);
  59. GLIB_AVAILABLE_IN_ALL
  60. GSequenceIter *g_sequence_get_iter_at_pos (GSequence *seq,
  61. gint pos);
  62. GLIB_AVAILABLE_IN_ALL
  63. GSequenceIter *g_sequence_append (GSequence *seq,
  64. gpointer data);
  65. GLIB_AVAILABLE_IN_ALL
  66. GSequenceIter *g_sequence_prepend (GSequence *seq,
  67. gpointer data);
  68. GLIB_AVAILABLE_IN_ALL
  69. GSequenceIter *g_sequence_insert_before (GSequenceIter *iter,
  70. gpointer data);
  71. GLIB_AVAILABLE_IN_ALL
  72. void g_sequence_move (GSequenceIter *src,
  73. GSequenceIter *dest);
  74. GLIB_AVAILABLE_IN_ALL
  75. void g_sequence_swap (GSequenceIter *a,
  76. GSequenceIter *b);
  77. GLIB_AVAILABLE_IN_ALL
  78. GSequenceIter *g_sequence_insert_sorted (GSequence *seq,
  79. gpointer data,
  80. GCompareDataFunc cmp_func,
  81. gpointer cmp_data);
  82. GLIB_AVAILABLE_IN_ALL
  83. GSequenceIter *g_sequence_insert_sorted_iter (GSequence *seq,
  84. gpointer data,
  85. GSequenceIterCompareFunc iter_cmp,
  86. gpointer cmp_data);
  87. GLIB_AVAILABLE_IN_ALL
  88. void g_sequence_sort_changed (GSequenceIter *iter,
  89. GCompareDataFunc cmp_func,
  90. gpointer cmp_data);
  91. GLIB_AVAILABLE_IN_ALL
  92. void g_sequence_sort_changed_iter (GSequenceIter *iter,
  93. GSequenceIterCompareFunc iter_cmp,
  94. gpointer cmp_data);
  95. GLIB_AVAILABLE_IN_ALL
  96. void g_sequence_remove (GSequenceIter *iter);
  97. GLIB_AVAILABLE_IN_ALL
  98. void g_sequence_remove_range (GSequenceIter *begin,
  99. GSequenceIter *end);
  100. GLIB_AVAILABLE_IN_ALL
  101. void g_sequence_move_range (GSequenceIter *dest,
  102. GSequenceIter *begin,
  103. GSequenceIter *end);
  104. GLIB_AVAILABLE_IN_ALL
  105. GSequenceIter *g_sequence_search (GSequence *seq,
  106. gpointer data,
  107. GCompareDataFunc cmp_func,
  108. gpointer cmp_data);
  109. GLIB_AVAILABLE_IN_ALL
  110. GSequenceIter *g_sequence_search_iter (GSequence *seq,
  111. gpointer data,
  112. GSequenceIterCompareFunc iter_cmp,
  113. gpointer cmp_data);
  114. GLIB_AVAILABLE_IN_ALL
  115. GSequenceIter *g_sequence_lookup (GSequence *seq,
  116. gpointer data,
  117. GCompareDataFunc cmp_func,
  118. gpointer cmp_data);
  119. GLIB_AVAILABLE_IN_ALL
  120. GSequenceIter *g_sequence_lookup_iter (GSequence *seq,
  121. gpointer data,
  122. GSequenceIterCompareFunc iter_cmp,
  123. gpointer cmp_data);
  124. /* Dereferencing */
  125. GLIB_AVAILABLE_IN_ALL
  126. gpointer g_sequence_get (GSequenceIter *iter);
  127. GLIB_AVAILABLE_IN_ALL
  128. void g_sequence_set (GSequenceIter *iter,
  129. gpointer data);
  130. /* Operations on GSequenceIter * */
  131. GLIB_AVAILABLE_IN_ALL
  132. gboolean g_sequence_iter_is_begin (GSequenceIter *iter);
  133. GLIB_AVAILABLE_IN_ALL
  134. gboolean g_sequence_iter_is_end (GSequenceIter *iter);
  135. GLIB_AVAILABLE_IN_ALL
  136. GSequenceIter *g_sequence_iter_next (GSequenceIter *iter);
  137. GLIB_AVAILABLE_IN_ALL
  138. GSequenceIter *g_sequence_iter_prev (GSequenceIter *iter);
  139. GLIB_AVAILABLE_IN_ALL
  140. gint g_sequence_iter_get_position (GSequenceIter *iter);
  141. GLIB_AVAILABLE_IN_ALL
  142. GSequenceIter *g_sequence_iter_move (GSequenceIter *iter,
  143. gint delta);
  144. GLIB_AVAILABLE_IN_ALL
  145. GSequence * g_sequence_iter_get_sequence (GSequenceIter *iter);
  146. /* Search */
  147. GLIB_AVAILABLE_IN_ALL
  148. gint g_sequence_iter_compare (GSequenceIter *a,
  149. GSequenceIter *b);
  150. GLIB_AVAILABLE_IN_ALL
  151. GSequenceIter *g_sequence_range_get_midpoint (GSequenceIter *begin,
  152. GSequenceIter *end);
  153. G_END_DECLS
  154. #endif /* __G_SEQUENCE_H__ */