1 {	CFArray.h
2 	Copyright (c) 1998-2013, Apple Inc. All rights reserved.
3 }
4 {
5     Modified for use with Free Pascal
6     Version 308
7     Please report any bugs to <gpc@microbizz.nl>
8 }
9 
10 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
11 {$mode macpas}
12 {$modeswitch cblocks}
13 {$packenum 1}
14 {$macro on}
15 {$inline on}
16 {$calling mwpascal}
17 
18 unit CFArray;
19 interface
20 {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
21 {$setc GAP_INTERFACES_VERSION := $0308}
22 
23 {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
24     {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
25 {$endc}
26 
27 {$ifc defined CPUPOWERPC and defined CPUI386}
28 	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
29 {$endc}
30 {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
31 	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
32 {$endc}
33 
34 {$ifc not defined __ppc__ and defined CPUPOWERPC32}
35 	{$setc __ppc__ := 1}
36 {$elsec}
37 	{$setc __ppc__ := 0}
38 {$endc}
39 {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
40 	{$setc __ppc64__ := 1}
41 {$elsec}
42 	{$setc __ppc64__ := 0}
43 {$endc}
44 {$ifc not defined __i386__ and defined CPUI386}
45 	{$setc __i386__ := 1}
46 {$elsec}
47 	{$setc __i386__ := 0}
48 {$endc}
49 {$ifc not defined __x86_64__ and defined CPUX86_64}
50 	{$setc __x86_64__ := 1}
51 {$elsec}
52 	{$setc __x86_64__ := 0}
53 {$endc}
54 {$ifc not defined __arm__ and defined CPUARM}
55 	{$setc __arm__ := 1}
56 {$elsec}
57 	{$setc __arm__ := 0}
58 {$endc}
59 {$ifc not defined __arm64__ and defined CPUAARCH64}
60   {$setc __arm64__ := 1}
61 {$elsec}
62   {$setc __arm64__ := 0}
63 {$endc}
64 
65 {$ifc defined cpu64}
66   {$setc __LP64__ := 1}
67 {$elsec}
68   {$setc __LP64__ := 0}
69 {$endc}
70 
71 
72 {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
73 	{$error Conflicting definitions for __ppc__ and __i386__}
74 {$endc}
75 
76 {$ifc defined __ppc__ and __ppc__}
77 	{$setc TARGET_CPU_PPC := TRUE}
78 	{$setc TARGET_CPU_PPC64 := FALSE}
79 	{$setc TARGET_CPU_X86 := FALSE}
80 	{$setc TARGET_CPU_X86_64 := FALSE}
81 	{$setc TARGET_CPU_ARM := FALSE}
82 	{$setc TARGET_CPU_ARM64 := FALSE}
83 	{$setc TARGET_OS_MAC := TRUE}
84 	{$setc TARGET_OS_IPHONE := FALSE}
85 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
86 	{$setc TARGET_OS_EMBEDDED := FALSE}
87 {$elifc defined __ppc64__ and __ppc64__}
88 	{$setc TARGET_CPU_PPC := FALSE}
89 	{$setc TARGET_CPU_PPC64 := TRUE}
90 	{$setc TARGET_CPU_X86 := FALSE}
91 	{$setc TARGET_CPU_X86_64 := FALSE}
92 	{$setc TARGET_CPU_ARM := FALSE}
93 	{$setc TARGET_CPU_ARM64 := FALSE}
94 	{$setc TARGET_OS_MAC := TRUE}
95 	{$setc TARGET_OS_IPHONE := FALSE}
96 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
97 	{$setc TARGET_OS_EMBEDDED := FALSE}
98 {$elifc defined __i386__ and __i386__}
99 	{$setc TARGET_CPU_PPC := FALSE}
100 	{$setc TARGET_CPU_PPC64 := FALSE}
101 	{$setc TARGET_CPU_X86 := TRUE}
102 	{$setc TARGET_CPU_X86_64 := FALSE}
103 	{$setc TARGET_CPU_ARM := FALSE}
104 	{$setc TARGET_CPU_ARM64 := FALSE}
105 {$ifc defined iphonesim}
106  	{$setc TARGET_OS_MAC := FALSE}
107 	{$setc TARGET_OS_IPHONE := TRUE}
108 	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
109 {$elsec}
110 	{$setc TARGET_OS_MAC := TRUE}
111 	{$setc TARGET_OS_IPHONE := FALSE}
112 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
113 {$endc}
114 	{$setc TARGET_OS_EMBEDDED := FALSE}
115 {$elifc defined __x86_64__ and __x86_64__}
116 	{$setc TARGET_CPU_PPC := FALSE}
117 	{$setc TARGET_CPU_PPC64 := FALSE}
118 	{$setc TARGET_CPU_X86 := FALSE}
119 	{$setc TARGET_CPU_X86_64 := TRUE}
120 	{$setc TARGET_CPU_ARM := FALSE}
121 	{$setc TARGET_CPU_ARM64 := FALSE}
122 {$ifc defined iphonesim}
123  	{$setc TARGET_OS_MAC := FALSE}
124 	{$setc TARGET_OS_IPHONE := TRUE}
125 	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
126 {$elsec}
127 	{$setc TARGET_OS_MAC := TRUE}
128 	{$setc TARGET_OS_IPHONE := FALSE}
129 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
130 {$endc}
131 	{$setc TARGET_OS_EMBEDDED := FALSE}
132 {$elifc defined __arm__ and __arm__}
133 	{$setc TARGET_CPU_PPC := FALSE}
134 	{$setc TARGET_CPU_PPC64 := FALSE}
135 	{$setc TARGET_CPU_X86 := FALSE}
136 	{$setc TARGET_CPU_X86_64 := FALSE}
137 	{$setc TARGET_CPU_ARM := TRUE}
138 	{$setc TARGET_CPU_ARM64 := FALSE}
139 	{$setc TARGET_OS_MAC := FALSE}
140 	{$setc TARGET_OS_IPHONE := TRUE}
141 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
142 	{$setc TARGET_OS_EMBEDDED := TRUE}
143 {$elifc defined __arm64__ and __arm64__}
144 	{$setc TARGET_CPU_PPC := FALSE}
145 	{$setc TARGET_CPU_PPC64 := FALSE}
146 	{$setc TARGET_CPU_X86 := FALSE}
147 	{$setc TARGET_CPU_X86_64 := FALSE}
148 	{$setc TARGET_CPU_ARM := FALSE}
149 	{$setc TARGET_CPU_ARM64 := TRUE}
150 {$ifc defined ios}
151 	{$setc TARGET_OS_MAC := FALSE}
152 	{$setc TARGET_OS_IPHONE := TRUE}
153 	{$setc TARGET_OS_EMBEDDED := TRUE}
154 {$elsec}
155 	{$setc TARGET_OS_MAC := TRUE}
156 	{$setc TARGET_OS_IPHONE := FALSE}
157 	{$setc TARGET_OS_EMBEDDED := FALSE}
158 {$endc}
159 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
160 {$elsec}
161 	{$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
162 {$endc}
163 
164 {$ifc defined __LP64__ and __LP64__ }
165   {$setc TARGET_CPU_64 := TRUE}
166 {$elsec}
167   {$setc TARGET_CPU_64 := FALSE}
168 {$endc}
169 
170 {$ifc defined FPC_BIG_ENDIAN}
171 	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
172 	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
173 {$elifc defined FPC_LITTLE_ENDIAN}
174 	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
175 	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
176 {$elsec}
177 	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
178 {$endc}
179 {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
180 {$setc CALL_NOT_IN_CARBON := FALSE}
181 {$setc OLDROUTINENAMES := FALSE}
182 {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
183 {$setc OPAQUE_UPP_TYPES := TRUE}
184 {$setc OTCARBONAPPLICATION := TRUE}
185 {$setc OTKERNEL := FALSE}
186 {$setc PM_USE_SESSION_APIS := TRUE}
187 {$setc TARGET_API_MAC_CARBON := TRUE}
188 {$setc TARGET_API_MAC_OS8 := FALSE}
189 {$setc TARGET_API_MAC_OSX := TRUE}
190 {$setc TARGET_CARBON := TRUE}
191 {$setc TARGET_CPU_68K := FALSE}
192 {$setc TARGET_CPU_MIPS := FALSE}
193 {$setc TARGET_CPU_SPARC := FALSE}
194 {$setc TARGET_OS_UNIX := FALSE}
195 {$setc TARGET_OS_WIN32 := FALSE}
196 {$setc TARGET_RT_MAC_68881 := FALSE}
197 {$setc TARGET_RT_MAC_CFM := FALSE}
198 {$setc TARGET_RT_MAC_MACHO := TRUE}
199 {$setc TYPED_FUNCTION_POINTERS := TRUE}
200 {$setc TYPE_BOOL := FALSE}
201 {$setc TYPE_EXTENDED := FALSE}
202 {$setc TYPE_LONGLONG := TRUE}
203 uses MacTypes,CFBase;
204 {$endc} {not MACOSALLINCLUDE}
205 
206 {$ALIGN POWER}
207 
208 
209 {!
210 	@header CFArray
211 	CFArray implements an ordered, compact container of pointer-sized
212 	values. Values are accessed via integer keys (indices), from the
213 	range 0 to N-1, where N is the number of values in the array when
214 	an operation is performed. The array is said to be "compact" because
215 	deleted or inserted values do not leave a gap in the key space --
216 	the values with higher-numbered indices have their indices
217 	renumbered lower (or higher, in the case of insertion) so that the
218 	set of valid indices is always in the integer range [0, N-1]. Thus,
219 	the index to access a particular value in the array may change over
220 	time as other values are inserted into or deleted from the array.
221 
222 	Arrays come in two flavors, immutable, which cannot have values
223 	added to them or removed from them after the array is created, and
224 	mutable, to which you can add values or from which remove values.
225 
226 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
227 	Mutable arrays have two subflavors, fixed-capacity, for which there
228 	is a maximum number set at creation time of values which can be put
229 	into the array, and variable capacity, which can have an unlimited
230 	number of values (or rather, limited only by constraints external
231 	to CFArray, like the amount of available memory). Fixed-capacity
232 	arrays can be somewhat higher performing, if you can put a definite
233 	upper limit on the number of values that might be put into the
234 	array.
235 #else
236 	Mutable arrays can have an unlimited number of values (or rather,
237 	limited only by constraints external to CFArray, like the amount
238 	of available memory).
239 #endif
240 
241 	As with all CoreFoundation collection types, arrays maintain hard
242 	references on the values you put in them, but the retaining and
243 	releasing functions are user-defined callbacks that can actually do
244 	whatever the user wants (for example, nothing).
245 
246 	Computational Complexity
247 	The access time for a value in the array is guaranteed to be at
248 	worst O(lg N) for any implementation, current and future, but will
249 	often be O(1) (constant time). Linear search operations similarly
250 	have a worst case complexity of O(N*lg N), though typically the
251 	bounds will be tighter, and so on. Insertion or deletion operations
252 	will typically be linear in the number of values in the array, but
253 	may be O(N*lg N) clearly in the worst case in some implementations.
254 	There are no favored positions within the array for performance;
255 	that is, it is not necessarily faster to access values with low
256 	indices, or to insert or delete values with high indices, or
257 	whatever.
258 }
259 
260 
261 {!
262 	@typedef CFArrayCallBacks
263 	Structure containing the callbacks of a CFArray.
264 	@field version The version number of the structure type being passed
265 		in as a parameter to the CFArray creation functions. This
266 		structure is version 0.
267 	@field retain The callback used to add a retain for the array on
268 		values as they are put into the array. This callback returns
269 		the value to store in the array, which is usually the value
270 		parameter passed to this callback, but may be a different
271 		value if a different value should be stored in the array.
272 		The array's allocator is passed as the first argument.
273 	@field release The callback used to remove a retain previously added
274 		for the array from values as they are removed from the
275 		array. The array's allocator is passed as the first
276 		argument.
277 	@field copyDescription The callback used to create a descriptive
278 		string representation of each value in the array. This is
279 		used by the CFCopyDescription() function.
280 	@field equal The callback used to compare values in the array for
281 		equality for some operations.
282 }
283 type
allocatornull284 	CFArrayRetainCallBack = function( allocator: CFAllocatorRef; value: {const} UnivPtr ): UnivPtr;
285 	CFArrayReleaseCallBack = procedure( allocator: CFAllocatorRef; value: {const} UnivPtr );
valuenull286 	CFArrayCopyDescriptionCallBack = function( value: {const} UnivPtr ): CFStringRef;
value1null287 	CFArrayEqualCallBack = function( value1: {const} UnivPtr; value2: {const} UnivPtr ): Boolean;
288 	CFArrayCallBacks = record
289 		version: CFIndex;
290 		retain: CFArrayRetainCallBack;
291 		release: CFArrayReleaseCallBack;
292 		copyDescription: CFArrayCopyDescriptionCallBack;
293 		equal: CFArrayEqualCallBack;
294 	end;
295 	CFArrayCallBacksPtr = ^CFArrayCallBacks;
296 
297 {!
298 	@constant kCFTypeArrayCallBacks
299 	Predefined CFArrayCallBacks structure containing a set of callbacks
300 	appropriate for use when the values in a CFArray are all CFTypes.
301 }
302 var kCFTypeArrayCallBacks: CFArrayCallBacks; external name '_kCFTypeArrayCallBacks'; (* attribute const *)
303 
304 {!
305 	@typedef CFArrayApplierFunction
306 	Type of the callback function used by the apply functions of
307 		CFArrays.
308 	@param value The current value from the array.
309 	@param context The user-defined context parameter given to the apply
310 		function.
311 }
312 type
313 	CFArrayApplierFunction = procedure( value: {const} UnivPtr; context: UnivPtr );
314 
315 {!
316 	@typedef CFArrayRef
317 	This is the type of a reference to immutable CFArrays.
318 }
319 type
320 	CFArrayRef = ^__CFArray; { an opaque type }
321 	__CFArray = record end;
322 	CFArrayRefPtr = ^CFArrayRef;
323 
324 {!
325 	@typedef CFMutableArrayRef
326 	This is the type of a reference to mutable CFArrays.
327 }
328 type
329 	CFMutableArrayRef = CFArrayRef;
330 	CFMutableArrayRefPtr = ^CFMutableArrayRef;
331 
332 {!
333 	@function CFArrayGetTypeID
334 	Returns the type identifier of all CFArray instances.
335 }
CFArrayGetTypeIDnull336 function CFArrayGetTypeID: CFTypeID; external name '_CFArrayGetTypeID';
337 
338 {!
339 	@function CFArrayCreate
340 	Creates a new immutable array with the given values.
341 	@param allocator The CFAllocator which should be used to allocate
342 		memory for the array and its storage for values. This
343 		parameter may be NULL in which case the current default
344 		CFAllocator is used. If this reference is not a valid
345 		CFAllocator, the behavior is undefined.
346 	@param values A C array of the pointer-sized values to be in the
347 		array. The values in the array are ordered in the same order
348 		in which they appear in this C array. This parameter may be
349 		NULL if the numValues parameter is 0. This C array is not
350 		changed or freed by this function. If this parameter is not
351 		a valid pointer to a C array of at least numValues pointers,
352 		the behavior is undefined.
353 	@param numValues The number of values to copy from the values C
354 		array into the CFArray. This number will be the count of the
355 		array.
356 		If this parameter is negative, or greater than the number of
357 		values actually in the value's C array, the behavior is
358 		undefined.
359 	@param callBacks A pointer to a CFArrayCallBacks structure
360 		initialized with the callbacks for the array to use on each
361 		value in the array. The retain callback will be used within
362 		this function, for example, to retain all of the new values
363 		from the values C array. A copy of the contents of the
364 		callbacks structure is made, so that a pointer to a
365 		structure on the stack can be passed in, or can be reused
366 		for multiple array creations. If the version field of this
367 		callbacks structure is not one of the defined ones for
368 		CFArray, the behavior is undefined. The retain field may be
369 		NULL, in which case the CFArray will do nothing to add a
370 		retain to the contained values for the array. The release
371 		field may be NULL, in which case the CFArray will do nothing
372 		to remove the array's retain (if any) on the values when the
373 		array is destroyed. If the copyDescription field is NULL,
374 		the array will create a simple description for the value. If
375 		the equal field is NULL, the array will use pointer equality
376 		to test for equality of values. This callbacks parameter
377 		itself may be NULL, which is treated as if a valid structure
378 		of version 0 with all fields NULL had been passed in.
379 		Otherwise, if any of the fields are not valid pointers to
380 		functions of the correct type, or this parameter is not a
381 		valid pointer to a  CFArrayCallBacks callbacks structure,
382 		the behavior is undefined. If any of the values put into the
383 		array is not one understood by one of the callback functions
384 		the behavior when that callback function is used is
385 		undefined.
386 	@result A reference to the new immutable CFArray.
387 }
CFArrayCreatenull388 function CFArrayCreate( allocator: CFAllocatorRef; {const} values: {variable-size-array} UnivPtrPtr; numValues: CFIndex; {const} callBacks: CFArrayCallBacksPtr { can be NULL } ): CFArrayRef; external name '_CFArrayCreate';
389 
390 {!
391 	@function CFArrayCreateCopy
392 	Creates a new immutable array with the values from the given array.
393 	@param allocator The CFAllocator which should be used to allocate
394 		memory for the array and its storage for values. This
395 		parameter may be NULL in which case the current default
396 		CFAllocator is used. If this reference is not a valid
397 		CFAllocator, the behavior is undefined.
398 	@param theArray The array which is to be copied. The values from the
399 		array are copied as pointers into the new array (that is,
400 		the values themselves are copied, not that which the values
401 		point to, if anything). However, the values are also
402 		retained by the new array. The count of the new array will
403 		be the same as the given array. The new array uses the same
404 		callbacks as the array to be copied. If this parameter is
405 		not a valid CFArray, the behavior is undefined.
406 	@result A reference to the new immutable CFArray.
407 }
CFArrayCreateCopynull408 function CFArrayCreateCopy( allocator: CFAllocatorRef; theArray: CFArrayRef ): CFArrayRef; external name '_CFArrayCreateCopy';
409 
410 {!
411 	@function CFArrayCreateMutable
412 	Creates a new empty mutable array.
413 	@param allocator The CFAllocator which should be used to allocate
414 		memory for the array and its storage for values. This
415 		parameter may be NULL in which case the current default
416 		CFAllocator is used. If this reference is not a valid
417 		CFAllocator, the behavior is undefined.
418 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
419 	@param capacity The maximum number of values that can be contained
420 		by the CFArray. The array starts empty, and can grow to this
421 		number of values (and it can have less). If this parameter
422 		is 0, the array's maximum capacity is unlimited (or rather,
423 		only limited by address space and available memory
424 		constraints). If this parameter is negative, the behavior is
425 		undefined.
426 #else
427 	@param capacity A hint about the number of values that will be held
428 		by the CFArray. Pass 0 for no hint. The implementation may
429 		ignore this hint, or may use it to optimize various
430 		operations. An array's actual capacity is only limited by
431 		address space and available memory constraints). If this
432 		parameter is negative, the behavior is undefined.
433 #endif
434 	@param callBacks A pointer to a CFArrayCallBacks structure
435 		initialized with the callbacks for the array to use on each
436 		value in the array. A copy of the contents of the
437 		callbacks structure is made, so that a pointer to a
438 		structure on the stack can be passed in, or can be reused
439 		for multiple array creations. If the version field of this
440 		callbacks structure is not one of the defined ones for
441 		CFArray, the behavior is undefined. The retain field may be
442 		NULL, in which case the CFArray will do nothing to add a
443 		retain to the contained values for the array. The release
444 		field may be NULL, in which case the CFArray will do nothing
445 		to remove the array's retain (if any) on the values when the
446 		array is destroyed. If the copyDescription field is NULL,
447 		the array will create a simple description for the value. If
448 		the equal field is NULL, the array will use pointer equality
449 		to test for equality of values. This callbacks parameter
450 		itself may be NULL, which is treated as if a valid structure
451 		of version 0 with all fields NULL had been passed in.
452 		Otherwise, if any of the fields are not valid pointers to
453 		functions of the correct type, or this parameter is not a
454 		valid pointer to a  CFArrayCallBacks callbacks structure,
455 		the behavior is undefined. If any of the values put into the
456 		array is not one understood by one of the callback functions
457 		the behavior when that callback function is used is
458 		undefined.
459 	@result A reference to the new mutable CFArray.
460 }
CFArrayCreateMutablenull461 function CFArrayCreateMutable( allocator: CFAllocatorRef; capacity: CFIndex; {const} callBacks: CFArrayCallBacksPtr { can be NULL } ): CFMutableArrayRef; external name '_CFArrayCreateMutable';
462 
463 {!
464 	@function CFArrayCreateMutableCopy
465 	Creates a new mutable array with the values from the given array.
466 	@param allocator The CFAllocator which should be used to allocate
467 		memory for the array and its storage for values. This
468 		parameter may be NULL in which case the current default
469 		CFAllocator is used. If this reference is not a valid
470 		CFAllocator, the behavior is undefined.
471 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
472 	@param capacity The maximum number of values that can be contained
473 		by the CFArray. The array starts empty, and can grow to this
474 		number of values (and it can have less). If this parameter
475 		is 0, the array's maximum capacity is unlimited (or rather,
476 		only limited by address space and available memory
477 		constraints). This parameter must be greater than or equal
478 		to the count of the array which is to be copied, or the
479 		behavior is undefined. If this parameter is negative, the
480 		behavior is undefined.
481 #else
482   @param capacity A hint about the number of values that will be held
483     by the CFArray. Pass 0 for no hint. The implementation may
484     ignore this hint, or may use it to optimize various
485     operations. An array's actual capacity is only limited by
486     address space and available memory constraints).
487 		This parameter must be greater than or equal
488 		to the count of the array which is to be copied, or the
489 		behavior is undefined. If this parameter is negative, the
490 		behavior is undefined.
491 #endif
492 	@param theArray The array which is to be copied. The values from the
493 		array are copied as pointers into the new array (that is,
494 		the values themselves are copied, not that which the values
495 		point to, if anything). However, the values are also
496 		retained by the new array. The count of the new array will
497 		be the same as the given array. The new array uses the same
498 		callbacks as the array to be copied. If this parameter is
499 		not a valid CFArray, the behavior is undefined.
500 	@result A reference to the new mutable CFArray.
501 }
CFArrayCreateMutableCopynull502 function CFArrayCreateMutableCopy( allocator: CFAllocatorRef; capacity: CFIndex; theArray: CFArrayRef ): CFMutableArrayRef; external name '_CFArrayCreateMutableCopy';
503 
504 {!
505 	@function CFArrayGetCount
506 	Returns the number of values currently in the array.
507 	@param theArray The array to be queried. If this parameter is not a valid
508 		CFArray, the behavior is undefined.
509 	@result The number of values in the array.
510 }
CFArrayGetCountnull511 function CFArrayGetCount( theArray: CFArrayRef ): CFIndex; external name '_CFArrayGetCount';
512 
513 {!
514 	@function CFArrayGetCountOfValue
515 	Counts the number of times the given value occurs in the array.
516 	@param theArray The array to be searched. If this parameter is not a
517 		valid CFArray, the behavior is undefined.
518 	@param range The range within the array to search. If the range
519 		location or end point (defined by the location plus length
520 		minus 1) is outside the index space of the array (0 to
521 		N-1 inclusive, where N is the count of the array), the
522 		behavior is undefined. If the range length is negative, the
523 		behavior is undefined. The range may be empty (length 0).
524 	@param value The value for which to find matches in the array. The
525 		equal() callback provided when the array was created is
526 		used to compare. If the equal() callback was NULL, pointer
527 		equality (in C, ==) is used. If value, or any of the values
528 		in the array, are not understood by the equal() callback,
529 		the behavior is undefined.
530 	@result The number of times the given value occurs in the array,
531 		within the specified range.
532 }
CFArrayGetCountOfValuenull533 function CFArrayGetCountOfValue( theArray: CFArrayRef; range: CFRange; value: {const} UnivPtr ): CFIndex; external name '_CFArrayGetCountOfValue';
534 
535 {!
536 	@function CFArrayContainsValue
537 	Reports whether or not the value is in the array.
538 	@param theArray The array to be searched. If this parameter is not a
539 		valid CFArray, the behavior is undefined.
540 	@param range The range within the array to search. If the range
541 		location or end point (defined by the location plus length
542 		minus 1) is outside the index space of the array (0 to
543 		N-1 inclusive, where N is the count of the array), the
544 		behavior is undefined. If the range length is negative, the
545 		behavior is undefined. The range may be empty (length 0).
546 	@param value The value for which to find matches in the array. The
547 		equal() callback provided when the array was created is
548 		used to compare. If the equal() callback was NULL, pointer
549 		equality (in C, ==) is used. If value, or any of the values
550 		in the array, are not understood by the equal() callback,
551 		the behavior is undefined.
552 	@result true, if the value is in the specified range of the array,
553 		otherwise false.
554 }
CFArrayContainsValuenull555 function CFArrayContainsValue( theArray: CFArrayRef; range: CFRange; value: {const} UnivPtr ): Boolean; external name '_CFArrayContainsValue';
556 
557 {!
558 	@function CFArrayGetValueAtIndex
559 	Retrieves the value at the given index.
560 	@param theArray The array to be queried. If this parameter is not a
561 		valid CFArray, the behavior is undefined.
562 	@param idx The index of the value to retrieve. If the index is
563 		outside the index space of the array (0 to N-1 inclusive,
564 		where N is the count of the array), the behavior is
565 		undefined.
566 	@result The value with the given index in the array.
567 }
CFArrayGetValueAtIndexnull568 function CFArrayGetValueAtIndex( theArray: CFArrayRef; idx: CFIndex ): UnivPtr; external name '_CFArrayGetValueAtIndex';
569 
570 {!
571 	@function CFArrayGetValues
572 	Fills the buffer with values from the array.
573 	@param theArray The array to be queried. If this parameter is not a
574 		valid CFArray, the behavior is undefined.
575 	@param range The range of values within the array to retrieve. If
576 		the range location or end point (defined by the location
577 		plus length minus 1) is outside the index space of the
578 		array (0 to N-1 inclusive, where N is the count of the
579 		array), the behavior is undefined. If the range length is
580 		negative, the behavior is undefined. The range may be empty
581 		(length 0), in which case no values are put into the buffer.
582 	@param values A C array of pointer-sized values to be filled with
583 		values from the array. The values in the C array are ordered
584 		in the same order in which they appear in the array. If this
585 		parameter is not a valid pointer to a C array of at least
586 		range.length pointers, the behavior is undefined.
587 }
588 procedure CFArrayGetValues( theArray: CFArrayRef; range: CFRange; {const} values: {variable-size-array} UnivPtrPtr ); external name '_CFArrayGetValues';
589 
590 {!
591 	@function CFArrayApplyFunction
592 	Calls a function once for each value in the array.
593 	@param theArray The array to be operated upon. If this parameter is not
594 		a valid CFArray, the behavior is undefined.
595 	@param range The range of values within the array to which to apply
596 		the function. If the range location or end point (defined by
597 		the location plus length minus 1) is outside the index
598 		space of the array (0 to N-1 inclusive, where N is the count
599 		of the array), the behavior is undefined. If the range
600 		length is negative, the behavior is undefined. The range may
601 		be empty (length 0).
602 	@param applier The callback function to call once for each value in
603 		the given range in the array. If this parameter is not a
604 		pointer to a function of the correct prototype, the behavior
605 		is undefined. If there are values in the range which the
606 		applier function does not expect or cannot properly apply
607 		to, the behavior is undefined.
608 	@param context A pointer-sized user-defined value, which is passed
609 		as the second parameter to the applier function, but is
610 		otherwise unused by this function. If the context is not
611 		what is expected by the applier function, the behavior is
612 		undefined.
613 }
614 procedure CFArrayApplyFunction( theArray: CFArrayRef; range: CFRange; applier: CFArrayApplierFunction; context: UnivPtr ); external name '_CFArrayApplyFunction';
615 
616 {!
617 	@function CFArrayGetFirstIndexOfValue
618 	Searches the array for the value.
619 	@param theArray The array to be searched. If this parameter is not a
620 		valid CFArray, the behavior is undefined.
621 	@param range The range within the array to search. If the range
622 		location or end point (defined by the location plus length
623 		minus 1) is outside the index space of the array (0 to
624 		N-1 inclusive, where N is the count of the array), the
625 		behavior is undefined. If the range length is negative, the
626 		behavior is undefined. The range may be empty (length 0).
627 		The search progresses from the smallest index defined by
628 		the range to the largest.
629 	@param value The value for which to find a match in the array. The
630 		equal() callback provided when the array was created is
631 		used to compare. If the equal() callback was NULL, pointer
632 		equality (in C, ==) is used. If value, or any of the values
633 		in the array, are not understood by the equal() callback,
634 		the behavior is undefined.
635 	@result The lowest index of the matching values in the range, or
636 		kCFNotFound if no value in the range matched.
637 }
CFArrayGetFirstIndexOfValuenull638 function CFArrayGetFirstIndexOfValue( theArray: CFArrayRef; range: CFRange; value: {const} UnivPtr ): CFIndex; external name '_CFArrayGetFirstIndexOfValue';
639 
640 {!
641 	@function CFArrayGetLastIndexOfValue
642 	Searches the array for the value.
643 	@param theArray The array to be searched. If this parameter is not a
644 		valid CFArray, the behavior is undefined.
645 	@param range The range within the array to search. If the range
646 		location or end point (defined by the location plus length
647 		minus 1) is outside the index space of the array (0 to
648 		N-1 inclusive, where N is the count of the array), the
649 		behavior is undefined. If the range length is negative, the
650 		behavior is undefined. The range may be empty (length 0).
651 		The search progresses from the largest index defined by the
652 		range to the smallest.
653 	@param value The value for which to find a match in the array. The
654 		equal() callback provided when the array was created is
655 		used to compare. If the equal() callback was NULL, pointer
656 		equality (in C, ==) is used. If value, or any of the values
657 		in the array, are not understood by the equal() callback,
658 		the behavior is undefined.
659 	@result The highest index of the matching values in the range, or
660 		kCFNotFound if no value in the range matched.
661 }
CFArrayGetLastIndexOfValuenull662 function CFArrayGetLastIndexOfValue( theArray: CFArrayRef; range: CFRange; value: {const} UnivPtr ): CFIndex; external name '_CFArrayGetLastIndexOfValue';
663 
664 {!
665 	@function CFArrayBSearchValues
666 	Searches the array for the value using a binary search algorithm.
667 	@param theArray The array to be searched. If this parameter is not a
668 		valid CFArray, the behavior is undefined. If the array is
669 		not sorted from least to greatest according to the
670 		comparator function, the behavior is undefined.
671 	@param range The range within the array to search. If the range
672 		location or end point (defined by the location plus length
673 		minus 1) is outside the index space of the array (0 to
674 		N-1 inclusive, where N is the count of the array), the
675 		behavior is undefined. If the range length is negative, the
676 		behavior is undefined. The range may be empty (length 0).
677 	@param value The value for which to find a match in the array. If
678 		value, or any of the values in the array, are not understood
679 		by the comparator callback, the behavior is undefined.
680 	@param comparator The function with the comparator function type
681 		signature which is used in the binary search operation to
682 		compare values in the array with the given value. If this
683 		parameter is not a pointer to a function of the correct
684 		prototype, the behavior is undefined. If there are values
685 		in the range which the comparator function does not expect
686 		or cannot properly compare, the behavior is undefined.
687 	@param context A pointer-sized user-defined value, which is passed
688 		as the third parameter to the comparator function, but is
689 		otherwise unused by this function. If the context is not
690 		what is expected by the comparator function, the behavior is
691 		undefined.
692 	@result The return value is either 1) the index of a value that
693 		matched, if the target value matches one or more in the
694 		range, 2) greater than or equal to the end point of the
695 		range, if the value is greater than all the values in the
696 		range, or 3) the index of the value greater than the target
697 		value, if the value lies between two of (or less than all
698 		of) the values in the range.
699 }
CFArrayBSearchValuesnull700 function CFArrayBSearchValues( theArray: CFArrayRef; range: CFRange; value: {const} UnivPtr; comparator: CFComparatorFunction; context: UnivPtr ): CFIndex; external name '_CFArrayBSearchValues';
701 
702 {!
703 	@function CFArrayAppendValue
704 	Adds the value to the array giving it a new largest index.
705 	@param theArray The array to which the value is to be added. If this
706 		parameter is not a valid mutable CFArray, the behavior is
707 		undefined.
708 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
709 		If the array is a fixed-capacity array and it
710 		is full before this operation, the behavior is undefined.
711 #endif
712 	@param value The value to add to the array. The value is retained by
713 		the array using the retain callback provided when the array
714 		was created. If the value is not of the sort expected by the
715 		retain callback, the behavior is undefined. The value is
716 		assigned to the index one larger than the previous largest
717 		index, and the count of the array is increased by one.
718 }
719 procedure CFArrayAppendValue( theArray: CFMutableArrayRef; value: {const} UnivPtr ); external name '_CFArrayAppendValue';
720 
721 {!
722 	@function CFArrayInsertValueAtIndex
723 	Adds the value to the array, giving it the given index.
724 	@param theArray The array to which the value is to be added. If this
725 		parameter is not a valid mutable CFArray, the behavior is
726 		undefined.
727 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
728 		If the array is a fixed-capacity array and it
729 		is full before this operation, the behavior is undefined.
730 #endif
731 	@param idx The index to which to add the new value. If the index is
732 		outside the index space of the array (0 to N inclusive,
733 		where N is the count of the array before the operation), the
734 		behavior is undefined. If the index is the same as N, this
735 		function has the same effect as CFArrayAppendValue().
736 	@param value The value to add to the array. The value is retained by
737 		the array using the retain callback provided when the array
738 		was created. If the value is not of the sort expected by the
739 		retain callback, the behavior is undefined. The value is
740 		assigned to the given index, and all values with equal and
741 		larger indices have their indexes increased by one.
742 }
743 procedure CFArrayInsertValueAtIndex( theArray: CFMutableArrayRef; idx: CFIndex; value: {const} UnivPtr ); external name '_CFArrayInsertValueAtIndex';
744 
745 {!
746 	@function CFArraySetValueAtIndex
747 	Changes the value with the given index in the array.
748 	@param theArray The array in which the value is to be changed. If this
749 		parameter is not a valid mutable CFArray, the behavior is
750 		undefined.
751 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
752 		If the array is a fixed-capacity array and it
753 		is full before this operation and the index is the same as
754 		N, the behavior is undefined.
755 #endif
756 	@param idx The index to which to set the new value. If the index is
757 		outside the index space of the array (0 to N inclusive,
758 		where N is the count of the array before the operation), the
759 		behavior is undefined. If the index is the same as N, this
760 		function has the same effect as CFArrayAppendValue().
761 	@param value The value to set in the array. The value is retained by
762 		the array using the retain callback provided when the array
763 		was created, and the previous value with that index is
764 		released. If the value is not of the sort expected by the
765 		retain callback, the behavior is undefined. The indices of
766 		other values is not affected.
767 }
768 procedure CFArraySetValueAtIndex( theArray: CFMutableArrayRef; idx: CFIndex; value: {const} UnivPtr ); external name '_CFArraySetValueAtIndex';
769 
770 {!
771 	@function CFArrayRemoveValueAtIndex
772 	Removes the value with the given index from the array.
773 	@param theArray The array from which the value is to be removed. If
774 		this parameter is not a valid mutable CFArray, the behavior
775 		is undefined.
776 	@param idx The index from which to remove the value. If the index is
777 		outside the index space of the array (0 to N-1 inclusive,
778 		where N is the count of the array before the operation), the
779 		behavior is undefined.
780 }
781 procedure CFArrayRemoveValueAtIndex( theArray: CFMutableArrayRef; idx: CFIndex ); external name '_CFArrayRemoveValueAtIndex';
782 
783 {!
784 	@function CFArrayRemoveAllValues
785 	Removes all the values from the array, making it empty.
786 	@param theArray The array from which all of the values are to be
787 		removed. If this parameter is not a valid mutable CFArray,
788 		the behavior is undefined.
789 }
790 procedure CFArrayRemoveAllValues( theArray: CFMutableArrayRef ); external name '_CFArrayRemoveAllValues';
791 
792 {!
793 	@function CFArrayReplaceValues
794 	Replaces a range of values in the array.
795 	@param theArray The array from which all of the values are to be
796 		removed. If this parameter is not a valid mutable CFArray,
797 		the behavior is undefined.
798 	@param range The range of values within the array to replace. If the
799 		range location or end point (defined by the location plus
800 		length minus 1) is outside the index space of the array (0
801 		to N inclusive, where N is the count of the array), the
802 		behavior is undefined. If the range length is negative, the
803 		behavior is undefined. The range may be empty (length 0),
804 		in which case the new values are merely inserted at the
805 		range location.
806 	@param newValues A C array of the pointer-sized values to be placed
807 		into the array. The new values in the array are ordered in
808 		the same order in which they appear in this C array. This
809 		parameter may be NULL if the newCount parameter is 0. This
810 		C array is not changed or freed by this function. If this
811 		parameter is not a valid pointer to a C array of at least
812 		newCount pointers, the behavior is undefined.
813 	@param newCount The number of values to copy from the values C
814 		array into the CFArray. If this parameter is different than
815 		the range length, the excess newCount values will be
816 		inserted after the range, or the excess range values will be
817 		deleted. This parameter may be 0, in which case no new
818 		values are replaced into the array and the values in the
819 		range are simply removed. If this parameter is negative, or
820 		greater than the number of values actually in the newValues
821 		C array, the behavior is undefined.
822 }
823 procedure CFArrayReplaceValues( theArray: CFMutableArrayRef; range: CFRange; {const} newValues: {variable-size-array} UnivPtrPtr; newCount: CFIndex ); external name '_CFArrayReplaceValues';
824 
825 {!
826 	@function CFArrayExchangeValuesAtIndices
827 	Exchanges the values at two indices of the array.
828 	@param theArray The array of which the values are to be swapped. If
829 		this parameter is not a valid mutable CFArray, the behavior
830 		is undefined.
831 	@param idx1 The first index whose values should be swapped. If the
832 		index is outside the index space of the array (0 to N-1
833 		inclusive, where N is the count of the array before the
834 		operation), the behavior is undefined.
835 	@param idx2 The second index whose values should be swapped. If the
836 		index is outside the index space of the array (0 to N-1
837 		inclusive, where N is the count of the array before the
838 		operation), the behavior is undefined.
839 }
840 procedure CFArrayExchangeValuesAtIndices( theArray: CFMutableArrayRef; idx1: CFIndex; idx2: CFIndex ); external name '_CFArrayExchangeValuesAtIndices';
841 
842 {!
843 	@function CFArraySortValues
844 	Sorts the values in the array using the given comparison function.
845 	@param theArray The array whose values are to be sorted. If this
846 		parameter is not a valid mutable CFArray, the behavior is
847 		undefined.
848 	@param range The range of values within the array to sort. If the
849 		range location or end point (defined by the location plus
850 		length minus 1) is outside the index space of the array (0
851 		to N-1 inclusive, where N is the count of the array), the
852 		behavior is undefined. If the range length is negative, the
853 		behavior is undefined. The range may be empty (length 0).
854 	@param comparator The function with the comparator function type
855 		signature which is used in the sort operation to compare
856 		values in the array with the given value. If this parameter
857 		is not a pointer to a function of the correct prototype, the
858 		the behavior is undefined. If there are values in the array
859 		which the comparator function does not expect or cannot
860 		properly compare, the behavior is undefined. The values in
861 		the range are sorted from least to greatest according to
862 		this function.
863 	@param context A pointer-sized user-defined value, which is passed
864 		as the third parameter to the comparator function, but is
865 		otherwise unused by this function. If the context is not
866 		what is expected by the comparator function, the behavior is
867 		undefined.
868 }
869 procedure CFArraySortValues( theArray: CFMutableArrayRef; range: CFRange; comparator: CFComparatorFunction; context: UnivPtr ); external name '_CFArraySortValues';
870 
871 {!
872 	@function CFArrayAppendArray
873 	Adds the values from an array to another array.
874 	@param theArray The array to which values from the otherArray are to
875 		be added. If this parameter is not a valid mutable CFArray,
876 		the behavior is undefined.
877 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
878 		If the array is a fixed-capacity
879 		array and adding range.length values from the otherArray
880 		exceeds the capacity of the array, the behavior is
881 		undefined.
882 #endif
883 	@param otherArray The array providing the values to be added to the
884 		array. If this parameter is not a valid CFArray, the
885 		behavior is undefined.
886 	@param otherRange The range within the otherArray from which to add
887 		the values to the array. If the range location or end point
888 		(defined by the location plus length minus 1) is outside
889 		the index space of the otherArray (0 to N-1 inclusive, where
890 		N is the count of the otherArray), the behavior is
891 		undefined. The new values are retained by the array using
892 		the retain callback provided when the array was created. If
893 		the values are not of the sort expected by the retain
894 		callback, the behavior is undefined. The values are assigned
895 		to the indices one larger than the previous largest index
896 		in the array, and beyond, and the count of the array is
897 		increased by range.length. The values are assigned new
898 		indices in the array from smallest to largest index in the
899 		order in which they appear in the otherArray.
900 }
901 procedure CFArrayAppendArray( theArray: CFMutableArrayRef; otherArray: CFArrayRef; otherRange: CFRange ); external name '_CFArrayAppendArray';
902 
903 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
904 
905 end.
906 {$endc} {not MACOSALLINCLUDE}
907