File: CFArray.h

package info (click to toggle)
gcc-arm-none-eabi 15%3A14.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,099,328 kB
  • sloc: cpp: 3,627,108; ansic: 2,571,498; ada: 834,230; f90: 235,082; makefile: 79,231; asm: 74,984; xml: 51,692; exp: 39,736; sh: 33,298; objc: 15,629; python: 15,069; fortran: 14,429; pascal: 7,003; awk: 5,070; perl: 3,106; ml: 285; lisp: 253; lex: 204; haskell: 135
file content (191 lines) | stat: -rw-r--r-- 5,862 bytes parent folder | download | duplicates (2)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/* CFArray.h
   
   Copyright (C) 2010 Free Software Foundation, Inc.
   
   Written by: Stefan Bidigaray
   Date: January, 2010
   
   This file is part of CoreBase.
   
   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with this library; see the file COPYING.LIB.
   If not, see <http://www.gnu.org/licenses/> or write to the 
   Free Software Foundation, 51 Franklin Street, Fifth Floor, 
   Boston, MA 02110-1301, USA.
*/


#ifndef __COREFOUNDATION_CFARRAY_H__
#define __COREFOUNDATION_CFARRAY_H__

#include "CFBase.h"

CF_EXTERN_C_BEGIN
/** \ingroup CFArrayRef
    \brief Reference to an immutable array object.
 */
typedef const struct __CFArray *CFArrayRef;
/**
    \ingroup CFMutableArrayRef
    \brief Reference to a mutable array object.
 */
typedef struct __CFArray *CFMutableArrayRef;

/** \defgroup CFArrayRef CFArray Reference
    \brief A CFArray and its mutable type, \ref CFMutableArrayRef
      "CFMutableArray", are simple, low overhead, ordered containers for
      objects.
    \details
      <code>\#include <CoreFoundation/CFArray.h></code>
    \{
 */

/** \name Callbacks
    \{
 */
typedef void (*CFArrayApplierFunction) (const void *value, void *context);
typedef CFStringRef (*CFArrayCopyDescriptionCallBack) (const void *value);
typedef void (*CFArrayReleaseCallBack) (CFAllocatorRef allocator,
                                        const void *value);
typedef const void *(*CFArrayRetainCallBack) (CFAllocatorRef allocator,
                                              const void *value);
typedef Boolean (*CFArrayEqualCallBack) (const void *value1,
                                         const void *value2);
/** \} */

/** \brief Structure with CFArray callbacks.
 */
typedef struct _CFArrayCallBacks CFArrayCallBacks;
struct _CFArrayCallBacks
{
  CFIndex version; /**< Structure's version number.  Current version is 0. */
  CFArrayRetainCallBack retain;
    /**< The callback used to retain values added to the array.  If NULL,
	 values are not retained. */
  CFArrayReleaseCallBack release;
  CFArrayCopyDescriptionCallBack copyDescription;
  CFArrayEqualCallBack equal;
};

/** \name Predefined Callback Structures
    \{
 */
CF_EXPORT const CFArrayCallBacks kCFTypeArrayCallBacks;
/** \} */



/** \name Creating an Array
    \{
 */
CF_EXPORT CFArrayRef
CFArrayCreate (CFAllocatorRef allocator, const void **values,
               CFIndex numValues, const CFArrayCallBacks * callBacks);

CF_EXPORT CFArrayRef
CFArrayCreateCopy (CFAllocatorRef allocator, CFArrayRef theArray);
/** \} */

/** \name Examining an Array
    \{
 */
CF_EXPORT CFIndex
CFArrayBSearchValues (CFArrayRef theArray, CFRange range, const void *value,
                      CFComparatorFunction comparator, void *context);

CF_EXPORT Boolean
CFArrayContainsValue (CFArrayRef theArray, CFRange range, const void *value);

CF_EXPORT CFIndex CFArrayGetCount (CFArrayRef theArray);

CF_EXPORT CFIndex
CFArrayGetCountOfValue (CFArrayRef theArray, CFRange range, const void *value);

CF_EXPORT CFIndex
CFArrayGetFirstIndexOfValue (CFArrayRef theArray, CFRange range,
                             const void *value);

CF_EXPORT CFIndex
CFArrayGetLastIndexOfValue (CFArrayRef theArray, CFRange range,
                            const void *value);

CF_EXPORT void
CFArrayGetValues (CFArrayRef theArray, CFRange range, const void **values);

CF_EXPORT const void *CFArrayGetValueAtIndex (CFArrayRef theArray, CFIndex idx);
/** \} */

/** \name Applying a Function to Elements
    \{
 */
CF_EXPORT void
CFArrayApplyFunction (CFArrayRef theArray, CFRange range,
                      CFArrayApplierFunction applier, void *context);
/** \} */

/** \name Getting the CFArray Type ID
    \{
 */
CF_EXPORT CFTypeID CFArrayGetTypeID (void);
/** \} */

/** \} */

/** \defgroup CFMutableArrayRef CFMutableArray Reference
    \details <code>\#include <CoreFoundation/CFArray.h></code>
    \{
 */
CF_EXPORT void
CFArrayAppendArray (CFMutableArrayRef theArray, CFArrayRef otherArray,
                    CFRange otherRange);

CF_EXPORT void
CFArrayAppendValue (CFMutableArrayRef theArray, const void *value);

CF_EXPORT CFMutableArrayRef
CFArrayCreateMutable (CFAllocatorRef allocator, CFIndex capacity,
                      const CFArrayCallBacks * callBacks);

CF_EXPORT CFMutableArrayRef
CFArrayCreateMutableCopy (CFAllocatorRef allocator, CFIndex capacity,
                          CFArrayRef theArray);

CF_EXPORT void
CFArrayExchangeValuesAtIndices (CFMutableArrayRef theArray, CFIndex idx1,
                                CFIndex idx2);

CF_EXPORT void
CFArrayInsertValueAtIndex (CFMutableArrayRef theArray, CFIndex idx,
                           const void *value);

CF_EXPORT void CFArrayRemoveAllValues (CFMutableArrayRef theArray);

CF_EXPORT void
CFArrayRemoveValueAtIndex (CFMutableArrayRef theArray, CFIndex idx);

CF_EXPORT void
CFArrayReplaceValues (CFMutableArrayRef theArray, CFRange range,
                      const void **newValues, CFIndex newCount);

CF_EXPORT void
CFArraySetValueAtIndex (CFMutableArrayRef theArray, CFIndex idx,
                        const void *value);

CF_EXPORT void
CFArraySortValues (CFMutableArrayRef theArray, CFRange range,
                   CFComparatorFunction comparator, void *context);

/** \} */

CF_EXTERN_C_END
#endif /* __COREFOUNDATION_CFARRAY_H__ */