2
Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
4
{ Pascal Translation Updated: Peter N Lewis, <peter@stairways.com.au>, September 2005 }
6
Modified for use with Free Pascal
8
Please report any bugs to <gpc@microbizz.nl>
19
{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
20
{$setc GAP_INTERFACES_VERSION := $0200}
22
{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
23
{$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
26
{$ifc defined CPUPOWERPC and defined CPUI386}
27
{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
29
{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
30
{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
33
{$ifc not defined __ppc__ and defined CPUPOWERPC}
38
{$ifc not defined __i386__ and defined CPUI386}
44
{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
45
{$error Conflicting definitions for __ppc__ and __i386__}
48
{$ifc defined __ppc__ and __ppc__}
49
{$setc TARGET_CPU_PPC := TRUE}
50
{$setc TARGET_CPU_X86 := FALSE}
51
{$elifc defined __i386__ and __i386__}
52
{$setc TARGET_CPU_PPC := FALSE}
53
{$setc TARGET_CPU_X86 := TRUE}
55
{$error Neither __ppc__ nor __i386__ is defined.}
57
{$setc TARGET_CPU_PPC_64 := FALSE}
59
{$ifc defined FPC_BIG_ENDIAN}
60
{$setc TARGET_RT_BIG_ENDIAN := TRUE}
61
{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
62
{$elifc defined FPC_LITTLE_ENDIAN}
63
{$setc TARGET_RT_BIG_ENDIAN := FALSE}
64
{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
66
{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
68
{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
69
{$setc CALL_NOT_IN_CARBON := FALSE}
70
{$setc OLDROUTINENAMES := FALSE}
71
{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
72
{$setc OPAQUE_UPP_TYPES := TRUE}
73
{$setc OTCARBONAPPLICATION := TRUE}
74
{$setc OTKERNEL := FALSE}
75
{$setc PM_USE_SESSION_APIS := TRUE}
76
{$setc TARGET_API_MAC_CARBON := TRUE}
77
{$setc TARGET_API_MAC_OS8 := FALSE}
78
{$setc TARGET_API_MAC_OSX := TRUE}
79
{$setc TARGET_CARBON := TRUE}
80
{$setc TARGET_CPU_68K := FALSE}
81
{$setc TARGET_CPU_MIPS := FALSE}
82
{$setc TARGET_CPU_SPARC := FALSE}
83
{$setc TARGET_OS_MAC := TRUE}
84
{$setc TARGET_OS_UNIX := FALSE}
85
{$setc TARGET_OS_WIN32 := FALSE}
86
{$setc TARGET_RT_MAC_68881 := FALSE}
87
{$setc TARGET_RT_MAC_CFM := FALSE}
88
{$setc TARGET_RT_MAC_MACHO := TRUE}
89
{$setc TYPED_FUNCTION_POINTERS := TRUE}
90
{$setc TYPE_BOOL := FALSE}
91
{$setc TYPE_EXTENDED := FALSE}
92
{$setc TYPE_LONGLONG := TRUE}
99
CFDictionary implements a container which pairs pointer-sized keys
100
with pointer-sized values. Values are accessed via arbitrary
101
user-defined keys. A CFDictionary differs from a CFArray in that
102
the key used to access a particular value in the dictionary remains
103
the same as values are added to or removed from the dictionary,
104
unless a value associated with its particular key is replaced or
105
removed. In a CFArray, the key (or index) used to retrieve a
106
particular value can change over time as values are added to or
107
deleted from the array. Also unlike an array, there is no ordering
108
among values in a dictionary. To enable later retrieval of a value,
109
the key of the key-value pair should be constant (or treated as
110
constant); if the key changes after being used to put a value in
111
the dictionary, the value may not be retrievable. The keys of a
112
dictionary form a set; that is, no two keys which are equal to
113
one another are present in the dictionary at any time.
115
Dictionaries come in two flavors, immutable, which cannot have
116
values added to them or removed from them after the dictionary is
117
created, and mutable, to which you can add values or from which
118
remove values. Mutable dictionaries have two subflavors,
119
fixed-capacity, for which there is a maximum number set at creation
120
time of values which can be put into the dictionary, and variable
121
capacity, which can have an unlimited number of values (or rather,
122
limited only by constraints external to CFDictionary, like the
123
amount of available memory). Fixed-capacity dictionaries can be
124
somewhat higher performing, if you can put a definate upper limit
125
on the number of values that might be put into the dictionary.
127
As with all CoreFoundation collection types, dictionaries maintain
128
hard references on the values you put in them, but the retaining and
129
releasing functions are user-defined callbacks that can actually do
130
whatever the user wants (for example, nothing).
132
Although a particular implementation of CFDictionary may not use
133
hashing and a hash table for storage of the values, the keys have
134
a hash-code generating function defined for them, and a function
135
to test for equality of two keys. These two functions together
136
must maintain the invariant that if equal(X, Y), then hash(X) ==
137
hash(Y). Note that the converse will not generally be true (but
138
the contrapositive, if hash(X) != hash(Y), then !equal(X, Y),
139
will be as required by Boolean logic). If the hash() and equal()
140
key callbacks are NULL, the key is used as a pointer-sized integer,
141
and pointer equality is used. Care should be taken to provide a
142
hash() callback which will compute sufficiently dispersed hash
143
codes for the key set for best performance.
145
Computational Complexity
146
The access time for a value in the dictionary is guaranteed to be at
147
worst O(lg N) for any implementation, current and future, but will
148
often be O(1) (constant time). Insertion or deletion operations
149
will typically be constant time as well, but are O(N*lg N) in the
150
worst case in some implementations. Access of values through a key
151
is faster than accessing values directly (if there are any such
152
operations). Dictionaries will tend to use significantly more memory
153
than a array with the same number of values.
158
@typedef CFDictionaryKeyCallBacks
159
Structure containing the callbacks for keys of a CFDictionary.
160
@field version The version number of the structure type being passed
161
in as a parameter to the CFDictionary creation functions.
162
This structure is version 0.
163
@field retain The callback used to add a retain for the dictionary
164
on keys as they are used to put values into the dictionary.
165
This callback returns the value to use as the key in the
166
dictionary, which is usually the value parameter passed to
167
this callback, but may be a different value if a different
168
value should be used as the key. The dictionary's allocator
169
is passed as the first argument.
170
@field release The callback used to remove a retain previously added
171
for the dictionary from keys as their values are removed from
172
the dictionary. The dictionary's allocator is passed as the
174
@field copyDescription The callback used to create a descriptive
175
string representation of each key in the dictionary. This
176
is used by the CFCopyDescription() function.
177
@field equal The callback used to compare keys in the dictionary for
179
@field hash The callback used to compute a hash code for keys as they
180
are used to access, add, or remove values in the dictionary.
183
CFDictionaryRetainCallBack = function( allocator: CFAllocatorRef; value: {const} UnivPtr ): UnivPtr;
184
CFDictionaryReleaseCallBack = procedure( allocator: CFAllocatorRef; value: {const} UnivPtr );
185
CFDictionaryCopyDescriptionCallBack = function( value: {const} UnivPtr ): CFStringRef;
186
CFDictionaryEqualCallBack = function( value1: {const} UnivPtr; value2: {const} UnivPtr ): Boolean;
187
CFDictionaryHashCallBack = function( value: {const} UnivPtr ): CFHashCode;
188
CFDictionaryKeyCallBacks = record
190
retain: CFDictionaryRetainCallBack;
191
release: CFDictionaryReleaseCallBack;
192
copyDescription: CFDictionaryCopyDescriptionCallBack;
193
equal: CFDictionaryEqualCallBack;
194
hash: CFDictionaryHashCallBack;
196
CFDictionaryKeyCallBacksPtr = ^CFDictionaryKeyCallBacks;
199
@constant kCFTypeDictionaryKeyCallBacks
200
Predefined CFDictionaryKeyCallBacks structure containing a
201
set of callbacks appropriate for use when the keys of a
202
CFDictionary are all CFTypes.
204
var kCFTypeDictionaryKeyCallBacks: CFDictionaryKeyCallBacks; external name '_kCFTypeDictionaryKeyCallBacks'; (* attribute const *)
207
@constant kCFCopyStringDictionaryKeyCallBacks
208
Predefined CFDictionaryKeyCallBacks structure containing a
209
set of callbacks appropriate for use when the keys of a
210
CFDictionary are all CFStrings, which may be mutable and
211
need to be copied in order to serve as constant keys for
212
the values in the dictionary.
214
var kCFCopyStringDictionaryKeyCallBacks: CFDictionaryKeyCallBacks; external name '_kCFCopyStringDictionaryKeyCallBacks'; (* attribute const *)
217
@typedef CFDictionaryValueCallBacks
218
Structure containing the callbacks for values of a CFDictionary.
219
@field version The version number of the structure type being passed
220
in as a parameter to the CFDictionary creation functions.
221
This structure is version 0.
222
@field retain The callback used to add a retain for the dictionary
223
on values as they are put into the dictionary.
224
This callback returns the value to use as the value in the
225
dictionary, which is usually the value parameter passed to
226
this callback, but may be a different value if a different
227
value should be added to the dictionary. The dictionary's
228
allocator is passed as the first argument.
229
@field release The callback used to remove a retain previously added
230
for the dictionary from values as they are removed from
231
the dictionary. The dictionary's allocator is passed as the
233
@field copyDescription The callback used to create a descriptive
234
string representation of each value in the dictionary. This
235
is used by the CFCopyDescription() function.
236
@field equal The callback used to compare values in the dictionary for
237
equality in some operations.
240
CFDictionaryValueCallBacks = record
242
retain: CFDictionaryRetainCallBack;
243
release: CFDictionaryReleaseCallBack;
244
copyDescription: CFDictionaryCopyDescriptionCallBack;
245
equal: CFDictionaryEqualCallBack;
247
CFDictionaryValueCallBacksPtr = ^CFDictionaryValueCallBacks;
250
@constant kCFTypeDictionaryValueCallBacks
251
Predefined CFDictionaryValueCallBacks structure containing a set
252
of callbacks appropriate for use when the values in a CFDictionary
255
var kCFTypeDictionaryValueCallBacks: CFDictionaryValueCallBacks; external name '_kCFTypeDictionaryValueCallBacks'; (* attribute const *)
258
@typedef CFDictionaryApplierFunction
259
Type of the callback function used by the apply functions of
261
@param key The current key for the value.
262
@param value The current value from the dictionary.
263
@param context The user-defined context parameter given to the apply
267
CFDictionaryApplierFunction = procedure( key: {const} UnivPtr; value: {const} UnivPtr; context: UnivPtr );
270
@typedef CFDictionaryRef
271
This is the type of a reference to immutable CFDictionarys.
274
CFDictionaryRef = ^SInt32; { an opaque 32-bit type }
275
CFDictionaryRefPtr = ^CFDictionaryRef;
278
@typedef CFMutableDictionaryRef
279
This is the type of a reference to mutable CFDictionarys.
282
CFMutableDictionaryRef = CFDictionaryRef;
283
CFMutableDictionaryRefPtr = ^CFMutableDictionaryRef;
286
@function CFDictionaryGetTypeID
287
Returns the type identifier of all CFDictionary instances.
289
function CFDictionaryGetTypeID: CFTypeID; external name '_CFDictionaryGetTypeID';
292
@function CFDictionaryCreate
293
Creates a new immutable dictionary with the given values.
294
@param allocator The CFAllocator which should be used to allocate
295
memory for the dictionary and its storage for values. This
296
parameter may be NULL in which case the current default
297
CFAllocator is used. If this reference is not a valid
298
CFAllocator, the behavior is undefined.
299
@param keys A C array of the pointer-sized keys to be used for
300
the parallel C array of values to be put into the dictionary.
301
This parameter may be NULL if the numValues parameter is 0.
302
This C array is not changed or freed by this function. If
303
this parameter is not a valid pointer to a C array of at
304
least numValues pointers, the behavior is undefined.
305
@param values A C array of the pointer-sized values to be in the
306
dictionary. This parameter may be NULL if the numValues
307
parameter is 0. This C array is not changed or freed by
308
this function. If this parameter is not a valid pointer to
309
a C array of at least numValues pointers, the behavior is
311
@param numValues The number of values to copy from the keys and
312
values C arrays into the CFDictionary. This number will be
313
the count of the dictionary. If this parameter is
314
negative, or greater than the number of values actually
315
in the keys or values C arrays, the behavior is undefined.
316
@param keyCallBacks A pointer to a CFDictionaryKeyCallBacks structure
317
initialized with the callbacks for the dictionary to use on
318
each key in the dictionary. The retain callback will be used
319
within this function, for example, to retain all of the new
320
keys from the keys C array. A copy of the contents of the
321
callbacks structure is made, so that a pointer to a structure
322
on the stack can be passed in, or can be reused for multiple
323
dictionary creations. If the version field of this
324
callbacks structure is not one of the defined ones for
325
CFDictionary, the behavior is undefined. The retain field may
326
be NULL, in which case the CFDictionary will do nothing to add
327
a retain to the keys of the contained values. The release field
328
may be NULL, in which case the CFDictionary will do nothing
329
to remove the dictionary's retain (if any) on the keys when the
330
dictionary is destroyed or a key-value pair is removed. If the
331
copyDescription field is NULL, the dictionary will create a
332
simple description for a key. If the equal field is NULL, the
333
dictionary will use pointer equality to test for equality of
334
keys. If the hash field is NULL, a key will be converted from
335
a pointer to an integer to compute the hash code. This callbacks
336
parameter itself may be NULL, which is treated as if a valid
337
structure of version 0 with all fields NULL had been passed in.
338
Otherwise, if any of the fields are not valid pointers to
339
functions of the correct type, or this parameter is not a
340
valid pointer to a CFDictionaryKeyCallBacks callbacks structure,
341
the behavior is undefined. If any of the keys put into the
342
dictionary is not one understood by one of the callback functions
343
the behavior when that callback function is used is undefined.
344
@param valueCallBacks A pointer to a CFDictionaryValueCallBacks structure
345
initialized with the callbacks for the dictionary to use on
346
each value in the dictionary. The retain callback will be used
347
within this function, for example, to retain all of the new
348
values from the values C array. A copy of the contents of the
349
callbacks structure is made, so that a pointer to a structure
350
on the stack can be passed in, or can be reused for multiple
351
dictionary creations. If the version field of this callbacks
352
structure is not one of the defined ones for CFDictionary, the
353
behavior is undefined. The retain field may be NULL, in which
354
case the CFDictionary will do nothing to add a retain to values
355
as they are put into the dictionary. The release field may be
356
NULL, in which case the CFDictionary will do nothing to remove
357
the dictionary's retain (if any) on the values when the
358
dictionary is destroyed or a key-value pair is removed. If the
359
copyDescription field is NULL, the dictionary will create a
360
simple description for a value. If the equal field is NULL, the
361
dictionary will use pointer equality to test for equality of
362
values. This callbacks parameter itself may be NULL, which is
363
treated as if a valid structure of version 0 with all fields
364
NULL had been passed in. Otherwise,
365
if any of the fields are not valid pointers to functions
366
of the correct type, or this parameter is not a valid
367
pointer to a CFDictionaryValueCallBacks callbacks structure,
368
the behavior is undefined. If any of the values put into the
369
dictionary is not one understood by one of the callback functions
370
the behavior when that callback function is used is undefined.
371
@result A reference to the new immutable CFDictionary.
373
function CFDictionaryCreate( allocator: CFAllocatorRef; {const} keys: UnivPtrPtr; {const} values: UnivPtrPtr; numValues: CFIndex; {const} keyCallBacks: CFDictionaryKeyCallBacksPtr { can be NULL }; {const} valueCallBacks: CFDictionaryValueCallBacksPtr { can be NULL } ): CFDictionaryRef; external name '_CFDictionaryCreate';
376
@function CFDictionaryCreateCopy
377
Creates a new immutable dictionary with the key-value pairs from
378
the given dictionary.
379
@param allocator The CFAllocator which should be used to allocate
380
memory for the dictionary and its storage for values. This
381
parameter may be NULL in which case the current default
382
CFAllocator is used. If this reference is not a valid
383
CFAllocator, the behavior is undefined.
384
@param theDict The dictionary which is to be copied. The keys and values
385
from the dictionary are copied as pointers into the new
386
dictionary (that is, the values themselves are copied, not
387
that which the values point to, if anything). However, the
388
keys and values are also retained by the new dictionary using
389
the retain function of the original dictionary.
390
The count of the new dictionary will be the same as the
391
given dictionary. The new dictionary uses the same callbacks
392
as the dictionary to be copied. If this parameter is
393
not a valid CFDictionary, the behavior is undefined.
394
@result A reference to the new immutable CFDictionary.
396
function CFDictionaryCreateCopy( allocator: CFAllocatorRef; theDict: CFDictionaryRef ): CFDictionaryRef; external name '_CFDictionaryCreateCopy';
399
@function CFDictionaryCreateMutable
400
Creates a new mutable dictionary.
401
@param allocator The CFAllocator which should be used to allocate
402
memory for the dictionary and its storage for values. This
403
parameter may be NULL in which case the current default
404
CFAllocator is used. If this reference is not a valid
405
CFAllocator, the behavior is undefined.
406
@param capacity The maximum number of values that can be contained by
407
the CFDictionary. The dictionary starts empty, and can grow
408
to this number of values (and it can have less). If this
409
parameter is 0, the dictionary's maximum capacity is unlimited
410
(or rather, only limited by address space and available memory
411
constraints). If this parameter is negative, the behavior is
413
@param keyCallBacks A pointer to a CFDictionaryKeyCallBacks structure
414
initialized with the callbacks for the dictionary to use on
415
each key in the dictionary. A copy of the contents of the
416
callbacks structure is made, so that a pointer to a structure
417
on the stack can be passed in, or can be reused for multiple
418
dictionary creations. If the version field of this
419
callbacks structure is not one of the defined ones for
420
CFDictionary, the behavior is undefined. The retain field may
421
be NULL, in which case the CFDictionary will do nothing to add
422
a retain to the keys of the contained values. The release field
423
may be NULL, in which case the CFDictionary will do nothing
424
to remove the dictionary's retain (if any) on the keys when the
425
dictionary is destroyed or a key-value pair is removed. If the
426
copyDescription field is NULL, the dictionary will create a
427
simple description for a key. If the equal field is NULL, the
428
dictionary will use pointer equality to test for equality of
429
keys. If the hash field is NULL, a key will be converted from
430
a pointer to an integer to compute the hash code. This callbacks
431
parameter itself may be NULL, which is treated as if a valid
432
structure of version 0 with all fields NULL had been passed in.
433
Otherwise, if any of the fields are not valid pointers to
434
functions of the correct type, or this parameter is not a
435
valid pointer to a CFDictionaryKeyCallBacks callbacks structure,
436
the behavior is undefined. If any of the keys put into the
437
dictionary is not one understood by one of the callback functions
438
the behavior when that callback function is used is undefined.
439
@param valueCallBacks A pointer to a CFDictionaryValueCallBacks structure
440
initialized with the callbacks for the dictionary to use on
441
each value in the dictionary. The retain callback will be used
442
within this function, for example, to retain all of the new
443
values from the values C array. A copy of the contents of the
444
callbacks structure is made, so that a pointer to a structure
445
on the stack can be passed in, or can be reused for multiple
446
dictionary creations. If the version field of this callbacks
447
structure is not one of the defined ones for CFDictionary, the
448
behavior is undefined. The retain field may be NULL, in which
449
case the CFDictionary will do nothing to add a retain to values
450
as they are put into the dictionary. The release field may be
451
NULL, in which case the CFDictionary will do nothing to remove
452
the dictionary's retain (if any) on the values when the
453
dictionary is destroyed or a key-value pair is removed. If the
454
copyDescription field is NULL, the dictionary will create a
455
simple description for a value. If the equal field is NULL, the
456
dictionary will use pointer equality to test for equality of
457
values. This callbacks parameter itself may be NULL, which is
458
treated as if a valid structure of version 0 with all fields
459
NULL had been passed in. Otherwise,
460
if any of the fields are not valid pointers to functions
461
of the correct type, or this parameter is not a valid
462
pointer to a CFDictionaryValueCallBacks callbacks structure,
463
the behavior is undefined. If any of the values put into the
464
dictionary is not one understood by one of the callback functions
465
the behavior when that callback function is used is undefined.
466
@result A reference to the new mutable CFDictionary.
468
function CFDictionaryCreateMutable( allocator: CFAllocatorRef; capacity: CFIndex; {const} keyCallBacks: CFDictionaryKeyCallBacksPtr { can be NULL }; {const} valueCallBacks: CFDictionaryValueCallBacksPtr { can be NULL } ): CFMutableDictionaryRef; external name '_CFDictionaryCreateMutable';
471
@function CFDictionaryCreateMutableCopy
472
Creates a new mutable dictionary with the key-value pairs from
473
the given dictionary.
474
@param allocator The CFAllocator which should be used to allocate
475
memory for the dictionary and its storage for values. This
476
parameter may be NULL in which case the current default
477
CFAllocator is used. If this reference is not a valid
478
CFAllocator, the behavior is undefined.
479
@param capacity The maximum number of values that can be contained
480
by the CFDictionary. The dictionary starts empty, and can grow
481
to this number of values (and it can have less). If this
482
parameter is 0, the dictionary's maximum capacity is unlimited
483
(or rather, only limited by address space and available memory
484
constraints). This parameter must be greater than or equal
485
to the count of the dictionary which is to be copied, or the
486
behavior is undefined. If this parameter is negative, the
487
behavior is undefined.
488
@param theDict The dictionary which is to be copied. The keys and values
489
from the dictionary are copied as pointers into the new
490
dictionary (that is, the values themselves are copied, not
491
that which the values point to, if anything). However, the
492
keys and values are also retained by the new dictionary using
493
the retain function of the original dictionary.
494
The count of the new dictionary will be the same as the
495
given dictionary. The new dictionary uses the same callbacks
496
as the dictionary to be copied. If this parameter is
497
not a valid CFDictionary, the behavior is undefined.
498
@result A reference to the new mutable CFDictionary.
500
function CFDictionaryCreateMutableCopy( allocator: CFAllocatorRef; capacity: CFIndex; theDict: CFDictionaryRef ): CFMutableDictionaryRef; external name '_CFDictionaryCreateMutableCopy';
503
@function CFDictionaryGetCount
504
Returns the number of values currently in the dictionary.
505
@param theDict The dictionary to be queried. If this parameter is
506
not a valid CFDictionary, the behavior is undefined.
507
@result The number of values in the dictionary.
509
function CFDictionaryGetCount( theDict: CFDictionaryRef ): CFIndex; external name '_CFDictionaryGetCount';
512
@function CFDictionaryGetCountOfKey
513
Counts the number of times the given key occurs in the dictionary.
514
@param theDict The dictionary to be searched. If this parameter is
515
not a valid CFDictionary, the behavior is undefined.
516
@param key The key for which to find matches in the dictionary. The
517
hash() and equal() key callbacks provided when the dictionary
518
was created are used to compare. If the hash() key callback
519
was NULL, the key is treated as a pointer and converted to
520
an integer. If the equal() key callback was NULL, pointer
521
equality (in C, ==) is used. If key, or any of the keys in
522
the dictionary, are not understood by the equal() callback,
523
the behavior is undefined.
524
@result Returns 1 if a matching key is used by the dictionary,
527
function CFDictionaryGetCountOfKey( theDict: CFDictionaryRef; key: {const} UnivPtr ): CFIndex; external name '_CFDictionaryGetCountOfKey';
530
@function CFDictionaryGetCountOfValue
531
Counts the number of times the given value occurs in the dictionary.
532
@param theDict The dictionary to be searched. If this parameter is
533
not a valid CFDictionary, the behavior is undefined.
534
@param value The value for which to find matches in the dictionary. The
535
equal() callback provided when the dictionary was created is
536
used to compare. If the equal() value callback was NULL, pointer
537
equality (in C, ==) is used. If value, or any of the values in
538
the dictionary, are not understood by the equal() callback,
539
the behavior is undefined.
540
@result The number of times the given value occurs in the dictionary.
542
function CFDictionaryGetCountOfValue( theDict: CFDictionaryRef; value: {const} UnivPtr ): CFIndex; external name '_CFDictionaryGetCountOfValue';
545
@function CFDictionaryContainsKey
546
Reports whether or not the key is in the dictionary.
547
@param theDict The dictionary to be searched. If this parameter is
548
not a valid CFDictionary, the behavior is undefined.
549
@param key The key for which to find matches in the dictionary. The
550
hash() and equal() key callbacks provided when the dictionary
551
was created are used to compare. If the hash() key callback
552
was NULL, the key is treated as a pointer and converted to
553
an integer. If the equal() key callback was NULL, pointer
554
equality (in C, ==) is used. If key, or any of the keys in
555
the dictionary, are not understood by the equal() callback,
556
the behavior is undefined.
557
@result true, if the key is in the dictionary, otherwise false.
559
function CFDictionaryContainsKey( theDict: CFDictionaryRef; key: {const} UnivPtr ): Boolean; external name '_CFDictionaryContainsKey';
562
@function CFDictionaryContainsValue
563
Reports whether or not the value is in the dictionary.
564
@param theDict The dictionary to be searched. If this parameter is
565
not a valid CFDictionary, the behavior is undefined.
566
@param value The value for which to find matches in the dictionary. The
567
equal() callback provided when the dictionary was created is
568
used to compare. If the equal() callback was NULL, pointer
569
equality (in C, ==) is used. If value, or any of the values
570
in the dictionary, are not understood by the equal() callback,
571
the behavior is undefined.
572
@result true, if the value is in the dictionary, otherwise false.
574
function CFDictionaryContainsValue( theDict: CFDictionaryRef; value: {const} UnivPtr ): Boolean; external name '_CFDictionaryContainsValue';
577
@function CFDictionaryGetValue
578
Retrieves the value associated with the given key.
579
@param theDict The dictionary to be queried. If this parameter is
580
not a valid CFDictionary, the behavior is undefined.
581
@param key The key for which to find a match in the dictionary. The
582
hash() and equal() key callbacks provided when the dictionary
583
was created are used to compare. If the hash() key callback
584
was NULL, the key is treated as a pointer and converted to
585
an integer. If the equal() key callback was NULL, pointer
586
equality (in C, ==) is used. If key, or any of the keys in
587
the dictionary, are not understood by the equal() callback,
588
the behavior is undefined.
589
@result The value with the given key in the dictionary, or NULL if
590
no key-value pair with a matching key exists. Since NULL
591
can be a valid value in some dictionaries, the function
592
CFDictionaryGetValueIfPresent() must be used to distinguish
593
NULL-no-found from NULL-is-the-value.
595
function CFDictionaryGetValue( theDict: CFDictionaryRef; key: {const} UnivPtr ): UnivPtr; external name '_CFDictionaryGetValue';
598
@function CFDictionaryGetValueIfPresent
599
Retrieves the value associated with the given key.
600
@param theDict The dictionary to be queried. If this parameter is
601
not a valid CFDictionary, the behavior is undefined.
602
@param key The key for which to find a match in the dictionary. The
603
hash() and equal() key callbacks provided when the dictionary
604
was created are used to compare. If the hash() key callback
605
was NULL, the key is treated as a pointer and converted to
606
an integer. If the equal() key callback was NULL, pointer
607
equality (in C, ==) is used. If key, or any of the keys in
608
the dictionary, are not understood by the equal() callback,
609
the behavior is undefined.
610
@param value A pointer to memory which should be filled with the
611
pointer-sized value if a matching key is found. If no key
612
match is found, the contents of the storage pointed to by
613
this parameter are undefined. This parameter may be NULL,
614
in which case the value from the dictionary is not returned
615
(but the return value of this function still indicates
616
whether or not the key-value pair was present).
617
@result true, if a matching key was found, false otherwise.
619
function CFDictionaryGetValueIfPresent( theDict: CFDictionaryRef; key: {const} UnivPtr; {const} value: UnivPtrPtr ): Boolean; external name '_CFDictionaryGetValueIfPresent';
622
@function CFDictionaryGetKeysAndValues
623
Fills the two buffers with the keys and values from the dictionary.
624
@param theDict The dictionary to be queried. If this parameter is
625
not a valid CFDictionary, the behavior is undefined.
626
@param keys A C array of pointer-sized values to be filled with keys
627
from the dictionary. The keys and values C arrays are parallel
628
to each other (that is, the items at the same indices form a
629
key-value pair from the dictionary). This parameter may be NULL
630
if the keys are not desired. If this parameter is not a valid
631
pointer to a C array of at least CFDictionaryGetCount() pointers,
632
or NULL, the behavior is undefined.
633
@param values A C array of pointer-sized values to be filled with values
634
from the dictionary. The keys and values C arrays are parallel
635
to each other (that is, the items at the same indices form a
636
key-value pair from the dictionary). This parameter may be NULL
637
if the values are not desired. If this parameter is not a valid
638
pointer to a C array of at least CFDictionaryGetCount() pointers,
639
or NULL, the behavior is undefined.
641
procedure CFDictionaryGetKeysAndValues( theDict: CFDictionaryRef; {const} keys: UnivPtrPtr; {const} values: UnivPtrPtr ); external name '_CFDictionaryGetKeysAndValues';
644
@function CFDictionaryApplyFunction
645
Calls a function once for each value in the dictionary.
646
@param theDict The dictionary to be queried. If this parameter is
647
not a valid CFDictionary, the behavior is undefined.
648
@param applier The callback function to call once for each value in
649
the dictionary. If this parameter is not a
650
pointer to a function of the correct prototype, the behavior
651
is undefined. If there are keys or values which the
652
applier function does not expect or cannot properly apply
653
to, the behavior is undefined.
654
@param context A pointer-sized user-defined value, which is passed
655
as the third parameter to the applier function, but is
656
otherwise unused by this function. If the context is not
657
what is expected by the applier function, the behavior is
660
procedure CFDictionaryApplyFunction( theDict: CFDictionaryRef; applier: CFDictionaryApplierFunction; context: UnivPtr ); external name '_CFDictionaryApplyFunction';
663
@function CFDictionaryAddValue
664
Adds the key-value pair to the dictionary if no such key already exists.
665
@param theDict The dictionary to which the value is to be added. If this
666
parameter is not a valid mutable CFDictionary, the behavior is
667
undefined. If the dictionary is a fixed-capacity dictionary and
668
it is full before this operation, the behavior is undefined.
669
@param key The key of the value to add to the dictionary. The key is
670
retained by the dictionary using the retain callback provided
671
when the dictionary was created. If the key is not of the sort
672
expected by the retain callback, the behavior is undefined. If
673
a key which matches this key is already present in the dictionary,
674
this function does nothing ("add if absent").
675
@param value The value to add to the dictionary. The value is retained
676
by the dictionary using the retain callback provided when the
677
dictionary was created. If the value is not of the sort expected
678
by the retain callback, the behavior is undefined.
680
procedure CFDictionaryAddValue( theDict: CFMutableDictionaryRef; key: {const} UnivPtr; value: {const} UnivPtr ); external name '_CFDictionaryAddValue';
683
@function CFDictionarySetValue
684
Sets the value of the key in the dictionary.
685
@param theDict The dictionary to which the value is to be set. If this
686
parameter is not a valid mutable CFDictionary, the behavior is
687
undefined. If the dictionary is a fixed-capacity dictionary and
688
it is full before this operation, and the key does not exist in
689
the dictionary, the behavior is undefined.
690
@param key The key of the value to set into the dictionary. If a key
691
which matches this key is already present in the dictionary, only
692
the value is changed ("add if absent, replace if present"). If
693
no key matches the given key, the key-value pair is added to the
694
dictionary. If added, the key is retained by the dictionary,
695
using the retain callback provided
696
when the dictionary was created. If the key is not of the sort
697
expected by the key retain callback, the behavior is undefined.
698
@param value The value to add to or replace into the dictionary. The value
699
is retained by the dictionary using the retain callback provided
700
when the dictionary was created, and the previous value if any is
701
released. If the value is not of the sort expected by the
702
retain or release callbacks, the behavior is undefined.
704
procedure CFDictionarySetValue( theDict: CFMutableDictionaryRef; key: {const} UnivPtr; value: {const} UnivPtr ); external name '_CFDictionarySetValue';
707
@function CFDictionaryReplaceValue
708
Replaces the value of the key in the dictionary.
709
@param theDict The dictionary to which the value is to be replaced. If this
710
parameter is not a valid mutable CFDictionary, the behavior is
712
@param key The key of the value to replace in the dictionary. If a key
713
which matches this key is present in the dictionary, the value
714
is changed to the given value, otherwise this function does
715
nothing ("replace if present").
716
@param value The value to replace into the dictionary. The value
717
is retained by the dictionary using the retain callback provided
718
when the dictionary was created, and the previous value is
719
released. If the value is not of the sort expected by the
720
retain or release callbacks, the behavior is undefined.
722
procedure CFDictionaryReplaceValue( theDict: CFMutableDictionaryRef; key: {const} UnivPtr; value: {const} UnivPtr ); external name '_CFDictionaryReplaceValue';
725
@function CFDictionaryRemoveValue
726
Removes the value of the key from the dictionary.
727
@param theDict The dictionary from which the value is to be removed. If this
728
parameter is not a valid mutable CFDictionary, the behavior is
730
@param key The key of the value to remove from the dictionary. If a key
731
which matches this key is present in the dictionary, the key-value
732
pair is removed from the dictionary, otherwise this function does
733
nothing ("remove if present").
735
procedure CFDictionaryRemoveValue( theDict: CFMutableDictionaryRef; key: {const} UnivPtr ); external name '_CFDictionaryRemoveValue';
738
@function CFDictionaryRemoveAllValues
739
Removes all the values from the dictionary, making it empty.
740
@param theDict The dictionary from which all of the values are to be
741
removed. If this parameter is not a valid mutable
742
CFDictionary, the behavior is undefined.
744
procedure CFDictionaryRemoveAllValues( theDict: CFMutableDictionaryRef ); external name '_CFDictionaryRemoveAllValues';