source: trunk/libtransmission/ptrarray.h @ 6795

Last change on this file since 6795 was 6795, checked in by charles, 13 years ago

run libT, cli, daemon, gtk through the source-code formatter "uncrustify" as promised/threatened

  • Property svn:keywords set to Date Rev Author Id
File size: 3.4 KB
Line 
1/******************************************************************************
2 * $Id: ptrarray.h 6795 2008-09-23 19:11:04Z charles $
3 *
4 * This file Copyright (C) 2007-2008 Charles Kerr <charles@rebelbase.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *****************************************************************************/
24
25#ifndef _TR_PTR_ARRAY_H_
26#define _TR_PTR_ARRAY_H_
27
28/**
29 * A simple pointer array that resizes itself dynamically.
30 */
31typedef struct tr_ptrArray tr_ptrArray;
32
33typedef void ( *PtrArrayForeachFunc )( void * );
34
35tr_ptrArray * tr_ptrArrayNew( void );
36
37tr_ptrArray * tr_ptrArrayDup( tr_ptrArray* );
38
39void          tr_ptrArrayForeach(
40                        tr_ptrArray*,
41    PtrArrayForeachFunc func );
42
43void          tr_ptrArrayFree(
44                        tr_ptrArray*,
45    PtrArrayForeachFunc func );
46
47void*         tr_ptrArrayNth(             tr_ptrArray*,
48                                      int n );
49
50void*         tr_ptrArrayBack( tr_ptrArray* );
51
52void**        tr_ptrArrayPeek(                   tr_ptrArray*,
53                                           int * size );
54
55void**        tr_ptrArrayBase( tr_ptrArray* );
56
57void          tr_ptrArrayClear( tr_ptrArray* );
58
59int           tr_ptrArrayInsert(             tr_ptrArray*,
60                                             void*,
61                                         int pos );
62
63int           tr_ptrArrayAppend( tr_ptrArray*,
64                                 void* );
65
66void*         tr_ptrArrayPop( tr_ptrArray* );
67
68void          tr_ptrArrayErase(             tr_ptrArray*,
69                                        int begin,
70                                        int end );
71
72int           tr_ptrArraySize( const tr_ptrArray* );
73
74int           tr_ptrArrayEmpty( const tr_ptrArray* );
75
76int           tr_ptrArrayInsertSorted( tr_ptrArray*,
77                                       void*,
78                                        int compare(const void*,
79                                                    const void*) );
80
81void*         tr_ptrArrayRemoveSorted( tr_ptrArray*,
82                                       void*,
83                                        int compare(const void*,
84                                                    const void*) );
85
86void*         tr_ptrArrayFindSorted(                   tr_ptrArray*,
87                                                 const void*,
88                                                  int compare(const void*,
89                                                              const void*) );
90
91#endif
Note: See TracBrowser for help on using the repository browser.