2007-08-14 20:45:23 +00:00
|
|
|
/*
|
2008-01-01 17:20:20 +00:00
|
|
|
* This file Copyright (C) 2007-2008 Charles Kerr <charles@rebelbase.com>
|
2007-08-14 20:45:23 +00:00
|
|
|
*
|
|
|
|
* This file is licensed by the GPL version 2. Works owned by the
|
|
|
|
* Transmission project are granted a special exemption to clause 2(b)
|
|
|
|
* so that the bulk of its code can remain under the MIT license.
|
|
|
|
* This exemption does not extend to derived works not owned by
|
|
|
|
* the Transmission project.
|
2007-08-18 17:05:51 +00:00
|
|
|
*
|
2007-08-18 17:19:49 +00:00
|
|
|
* $Id$
|
2007-08-14 20:45:23 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _TR_POINTERS_H_
|
|
|
|
#define _TR_POINTERS_H_
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A simple pointer array that resizes itself dynamically.
|
|
|
|
*/
|
2007-09-20 16:32:01 +00:00
|
|
|
typedef struct tr_ptrArray tr_ptrArray;
|
2007-08-14 20:45:23 +00:00
|
|
|
|
2007-09-30 23:55:49 +00:00
|
|
|
typedef void (*PtrArrayForeachFunc)(void *);
|
2007-08-14 20:45:23 +00:00
|
|
|
|
2007-09-30 23:55:49 +00:00
|
|
|
tr_ptrArray * tr_ptrArrayNew ( void );
|
2007-10-02 14:35:02 +00:00
|
|
|
tr_ptrArray * tr_ptrArrayDup ( tr_ptrArray* );
|
2007-09-30 23:55:49 +00:00
|
|
|
void tr_ptrArrayForeach ( tr_ptrArray*, PtrArrayForeachFunc func );
|
|
|
|
void tr_ptrArrayFree ( tr_ptrArray*, PtrArrayForeachFunc func );
|
2007-09-20 16:32:01 +00:00
|
|
|
void* tr_ptrArrayNth ( tr_ptrArray*, int n );
|
2008-01-31 02:24:43 +00:00
|
|
|
void* tr_ptrArrayBack ( tr_ptrArray* );
|
2007-09-20 16:32:01 +00:00
|
|
|
void** tr_ptrArrayPeek ( tr_ptrArray*, int * size );
|
|
|
|
void** tr_ptrArrayBase ( tr_ptrArray* );
|
|
|
|
void tr_ptrArrayClear ( tr_ptrArray* );
|
|
|
|
int tr_ptrArrayInsert ( tr_ptrArray*, void*, int pos );
|
|
|
|
int tr_ptrArrayAppend ( tr_ptrArray*, void* );
|
2008-01-31 02:24:43 +00:00
|
|
|
void* tr_ptrArrayPop ( tr_ptrArray* );
|
2007-09-20 16:32:01 +00:00
|
|
|
void tr_ptrArrayErase ( tr_ptrArray*, int begin, int end );
|
|
|
|
int tr_ptrArraySize ( const tr_ptrArray* );
|
|
|
|
int tr_ptrArrayEmpty ( const tr_ptrArray* );
|
|
|
|
int tr_ptrArrayInsertSorted ( tr_ptrArray*, void*,
|
|
|
|
int compare(const void*,const void*) );
|
|
|
|
void* tr_ptrArrayRemoveSorted ( tr_ptrArray*, void*,
|
|
|
|
int compare(const void*,const void*) );
|
|
|
|
void* tr_ptrArrayFindSorted ( tr_ptrArray*, const void*,
|
|
|
|
int compare(const void*,const void*) );
|
2007-08-14 20:45:23 +00:00
|
|
|
|
|
|
|
#endif
|