~ubuntu-branches/ubuntu/utopic/rhythmbox/utopic-proposed

« back to all changes in this revision

Viewing changes to lib/gsequence.h

Tags: upstream-0.9.2
ImportĀ upstreamĀ versionĀ 0.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* GLIB - Library of useful routines for C programming
2
 
 * Copyright (C) 2002  Soeren Sandmann (sandmann@daimi.au.dk)
3
 
 *
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.
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, write to the
17
 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
 
 * Boston, MA 02111-1307, USA.
19
 
 */
20
 
 
21
 
#include <glib.h>
22
 
 
23
 
#ifndef __GSEQUENCE_H__
24
 
#define __GSEQUENCE_H__
25
 
 
26
 
typedef struct _GSequence      GSequence;
27
 
typedef struct _GSequenceNode *GSequencePtr;
28
 
 
29
 
/* GSequence */
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,
34
 
                                            gpointer                 cmp_data);
35
 
void         g_sequence_append             (GSequence               *seq,
36
 
                                            gpointer                 data);
37
 
void         g_sequence_prepend            (GSequence               *seq,
38
 
                                            gpointer                 data);
39
 
void         g_sequence_insert             (GSequencePtr             ptr,
40
 
                                            gpointer                 data);
41
 
void         g_sequence_remove             (GSequencePtr             ptr);
42
 
GSequencePtr g_sequence_insert_sorted      (GSequence               *seq,
43
 
                                            gpointer                 data,
44
 
                                            GCompareDataFunc         cmp_func,
45
 
                                            gpointer                 cmp_data);
46
 
void         g_sequence_insert_sequence    (GSequencePtr             ptr,
47
 
                                            GSequence               *other_seq);
48
 
void         g_sequence_concatenate        (GSequence               *seq1,
49
 
                                            GSequence               *seq);
50
 
void         g_sequence_remove_range       (GSequencePtr             begin,
51
 
                                            GSequencePtr             end,
52
 
                                            GSequence              **removed);
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,
57
 
                                            gint                     pos);
58
 
 
59
 
/* GSequencePtr */
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,
66
 
                                            guint                    leap);
67
 
void         g_sequence_ptr_sort_changed   (GSequencePtr             ptr,
68
 
                                            GCompareDataFunc         cmp_func,
69
 
                                            gpointer                 cmp_data);
70
 
gpointer     g_sequence_ptr_get_data       (GSequencePtr             ptr);
71
 
 
72
 
/* search */
73
 
 
74
 
/* return TRUE if you want to be called again with two
75
 
 * smaller segments
76
 
 */
77
 
typedef gboolean (* GSequenceSearchFunc) (GSequencePtr begin,
78
 
                                          GSequencePtr end,
79
 
                                          gpointer     data);
80
 
 
81
 
void         g_sequence_search             (GSequence               *seq,
82
 
                                            GSequenceSearchFunc      f,
83
 
                                            gpointer                 data);
84
 
 
85
 
/* debug */
86
 
gint         g_sequence_calc_tree_height   (GSequence               *seq);
87
 
 
88
 
#endif /* __GSEQUENCE_H__ */