1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 2002 Soeren Sandmann (sandmann@daimi.au.dk)
4 * arch-tag: Definitions for GSequence - a fast ordered-sequence
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.
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.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301 USA.
23 #ifndef __GSEQUENCE_H__
24 #define __GSEQUENCE_H__
26 typedef struct _GSequence GSequence
;
27 typedef struct _GSequenceNode
*GSequencePtr
;
30 GSequence
* g_sequence_new (GDestroyNotify data_destroy
);
31 void g_sequence_free (GSequence
*seq
);
32 void g_sequence_sort (GSequence
*seq
,
33 GCompareDataFunc cmp_func
,
35 void g_sequence_append (GSequence
*seq
,
37 void g_sequence_prepend (GSequence
*seq
,
39 void g_sequence_insert (GSequencePtr ptr
,
41 void g_sequence_remove (GSequencePtr ptr
);
42 GSequencePtr
g_sequence_insert_sorted (GSequence
*seq
,
44 GCompareDataFunc cmp_func
,
46 void g_sequence_insert_sequence (GSequencePtr ptr
,
47 GSequence
*other_seq
);
48 void g_sequence_concatenate (GSequence
*seq1
,
50 void g_sequence_remove_range (GSequencePtr begin
,
53 gint
g_sequence_get_length (GSequence
*seq
);
54 GSequencePtr
g_sequence_get_end_ptr (GSequence
*seq
);
55 GSequencePtr
g_sequence_get_begin_ptr (GSequence
*seq
);
56 GSequencePtr
g_sequence_get_ptr_at_pos (GSequence
*seq
,
60 gboolean
g_sequence_ptr_is_end (GSequencePtr ptr
);
61 gboolean
g_sequence_ptr_is_begin (GSequencePtr ptr
);
62 gint
g_sequence_ptr_get_position (GSequencePtr ptr
);
63 GSequencePtr
g_sequence_ptr_next (GSequencePtr ptr
);
64 GSequencePtr
g_sequence_ptr_prev (GSequencePtr ptr
);
65 GSequencePtr
g_sequence_ptr_move (GSequencePtr ptr
,
67 void g_sequence_ptr_sort_changed (GSequencePtr ptr
,
68 GCompareDataFunc cmp_func
,
70 gpointer
g_sequence_ptr_get_data (GSequencePtr ptr
);
74 /* return TRUE if you want to be called again with two
77 typedef gboolean (* GSequenceSearchFunc
) (GSequencePtr begin
,
81 void g_sequence_search (GSequence
*seq
,
82 GSequenceSearchFunc f
,
86 gint
g_sequence_calc_tree_height (GSequence
*seq
);
88 #endif /* __GSEQUENCE_H__ */