]> git.saurik.com Git - apple/cf.git/blob - Collections.subproj/CFBag.h
CF-299.35.tar.gz
[apple/cf.git] / Collections.subproj / CFBag.h
1 /*
2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /* CFBag.h
26 Copyright (c) 1998-2003, Apple, Inc. All rights reserved.
27 */
28
29 #if !defined(__COREFOUNDATION_CFBAG__)
30 #define __COREFOUNDATION_CFBAG__ 1
31
32 #include <CoreFoundation/CFBase.h>
33
34 #if defined(__cplusplus)
35 extern "C" {
36 #endif
37
38 typedef const void * (*CFBagRetainCallBack)(CFAllocatorRef allocator, const void *value);
39 typedef void (*CFBagReleaseCallBack)(CFAllocatorRef allocator, const void *value);
40 typedef CFStringRef (*CFBagCopyDescriptionCallBack)(const void *value);
41 typedef Boolean (*CFBagEqualCallBack)(const void *value1, const void *value2);
42 typedef CFHashCode (*CFBagHashCallBack)(const void *value);
43 typedef struct {
44 CFIndex version;
45 CFBagRetainCallBack retain;
46 CFBagReleaseCallBack release;
47 CFBagCopyDescriptionCallBack copyDescription;
48 CFBagEqualCallBack equal;
49 CFBagHashCallBack hash;
50 } CFBagCallBacks;
51
52 CF_EXPORT
53 const CFBagCallBacks kCFTypeBagCallBacks;
54 CF_EXPORT
55 const CFBagCallBacks kCFCopyStringBagCallBacks;
56
57 typedef void (*CFBagApplierFunction)(const void *value, void *context);
58
59 typedef const struct __CFBag * CFBagRef;
60 typedef struct __CFBag * CFMutableBagRef;
61
62 CF_EXPORT
63 CFTypeID CFBagGetTypeID(void);
64
65 CF_EXPORT
66 CFBagRef CFBagCreate(CFAllocatorRef allocator, const void **values, CFIndex numValues, const CFBagCallBacks *callBacks);
67
68 CF_EXPORT
69 CFBagRef CFBagCreateCopy(CFAllocatorRef allocator, CFBagRef theBag);
70
71 CF_EXPORT
72 CFMutableBagRef CFBagCreateMutable(CFAllocatorRef allocator, CFIndex capacity, const CFBagCallBacks *callBacks);
73
74 CF_EXPORT
75 CFMutableBagRef CFBagCreateMutableCopy(CFAllocatorRef allocator, CFIndex capacity, CFBagRef theBag);
76
77 CF_EXPORT
78 CFIndex CFBagGetCount(CFBagRef theBag);
79
80 CF_EXPORT
81 CFIndex CFBagGetCountOfValue(CFBagRef theBag, const void *value);
82
83 CF_EXPORT
84 Boolean CFBagContainsValue(CFBagRef theBag, const void *value);
85
86 CF_EXPORT
87 const void *CFBagGetValue(CFBagRef theBag, const void *value);
88
89 CF_EXPORT
90 Boolean CFBagGetValueIfPresent(CFBagRef theBag, const void *candidate, const void **value);
91
92 CF_EXPORT
93 void CFBagGetValues(CFBagRef theBag, const void **values);
94
95 CF_EXPORT
96 void CFBagApplyFunction(CFBagRef theBag, CFBagApplierFunction applier, void *context);
97
98 CF_EXPORT
99 void CFBagAddValue(CFMutableBagRef theBag, const void *value);
100
101 CF_EXPORT
102 void CFBagReplaceValue(CFMutableBagRef theBag, const void *value);
103
104 CF_EXPORT
105 void CFBagSetValue(CFMutableBagRef theBag, const void *value);
106
107 CF_EXPORT
108 void CFBagRemoveValue(CFMutableBagRef theBag, const void *value);
109
110 CF_EXPORT
111 void CFBagRemoveAllValues(CFMutableBagRef theBag);
112
113 #if defined(__cplusplus)
114 }
115 #endif
116
117 #endif /* ! __COREFOUNDATION_CFBAG__ */
118