1 | /* |
---|
2 | * This file Copyright (C) 2007 Charles Kerr <charles@rebelbase.com> |
---|
3 | * |
---|
4 | * This file is licensed by the GPL version 2. Works owned by the |
---|
5 | * Transmission project are granted a special exemption to clause 2(b) |
---|
6 | * so that the bulk of its code can remain under the MIT license. |
---|
7 | * This exemption does not extend to derived works not owned by |
---|
8 | * the Transmission project. |
---|
9 | * |
---|
10 | * $Id: |
---|
11 | */ |
---|
12 | |
---|
13 | #ifndef _TR_POINTERS_H_ |
---|
14 | #define _TR_POINTERS_H_ |
---|
15 | |
---|
16 | /** |
---|
17 | * A simple pointer array that resizes itself dynamically. |
---|
18 | */ |
---|
19 | typedef struct tr_ptrArray_s tr_ptrArray_t; |
---|
20 | |
---|
21 | tr_ptrArray_t * tr_ptrArrayNew ( void ); |
---|
22 | void tr_ptrArrayFree ( tr_ptrArray_t* ); |
---|
23 | void** tr_ptrArrayPeek ( tr_ptrArray_t*, int * size ); |
---|
24 | void** tr_ptrArrayBase ( tr_ptrArray_t* ); |
---|
25 | void tr_ptrArrayClear ( tr_ptrArray_t* ); |
---|
26 | int tr_ptrArrayInsert ( tr_ptrArray_t*, void*, int pos ); |
---|
27 | int tr_ptrArrayAppend ( tr_ptrArray_t*, void* ); |
---|
28 | void tr_ptrArrayErase ( tr_ptrArray_t*, int begin, int end ); |
---|
29 | int tr_ptrArraySize ( const tr_ptrArray_t* ); |
---|
30 | int tr_ptrArrayEmpty ( const tr_ptrArray_t* ); |
---|
31 | |
---|
32 | int tr_ptrArrayInsertSorted( tr_ptrArray_t*, void*, |
---|
33 | int compare(const void*,const void*) ); |
---|
34 | void* tr_ptrArrayRemoveSorted( tr_ptrArray_t*, void*, |
---|
35 | int compare(const void*,const void*) ); |
---|
36 | void* tr_ptrArrayFindSorted ( tr_ptrArray_t*, void*, |
---|
37 | int compare(const void*,const void*) ); |
---|
38 | |
---|
39 | #endif |
---|