summaryrefslogtreecommitdiff
path: root/src/libmowgli/container/index.h
blob: 85e9e72bd88e32f8ffbb50ea52647688ad9d276c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * Copyright 2009-2011 John Lindgren
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice is present in all copies.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef __MOWGLI_INDEX_H__
#define __MOWGLI_INDEX_H__

struct mowgli_index_;

typedef struct mowgli_index_ mowgli_index_t;

mowgli_index_t * mowgli_index_create (void);
void mowgli_index_destroy (mowgli_index_t * index);
int mowgli_index_count (mowgli_index_t * index);
void mowgli_index_allocate (mowgli_index_t * index, int size);
void mowgli_index_set (mowgli_index_t * index, int at, void * value);
void * mowgli_index_get (mowgli_index_t * index, int at);
void mowgli_index_insert (mowgli_index_t * index, int at, void * value);
void mowgli_index_append (mowgli_index_t * index, void * value);
void mowgli_index_copy_set (mowgli_index_t * source, int from, mowgli_index_t * target,
 int to, int count);
void mowgli_index_copy_insert (mowgli_index_t * source, int from, mowgli_index_t * target,
 int to, int count);
void mowgli_index_copy_append (mowgli_index_t * source, int from, mowgli_index_t * target,
 int count);
void mowgli_index_merge_insert (mowgli_index_t * first, int at, mowgli_index_t * second);
void mowgli_index_merge_append (mowgli_index_t * first, mowgli_index_t * second);
void mowgli_index_move (mowgli_index_t * index, int from, int to, int count);
void mowgli_index_delete (mowgli_index_t * index, int at, int count);
void mowgli_index_sort (mowgli_index_t * index, int (* compare) (const void * a,
 const void * b));
void mowgli_index_sort_with_data (mowgli_index_t * index, int (* compare)
 (const void * a, const void * b, void * data), void * data);

#endif