2 * Copyright (c) 2010 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
25 Copyright (c) 1998-2009, Apple Inc. All rights reserved.
28 #if !defined(__COREFOUNDATION_CFBAG__)
29 #define __COREFOUNDATION_CFBAG__ 1
31 #include <CoreFoundation/CFBase.h>
35 typedef const void * (*CFBagRetainCallBack
)(CFAllocatorRef allocator
, const void *value
);
36 typedef void (*CFBagReleaseCallBack
)(CFAllocatorRef allocator
, const void *value
);
37 typedef CFStringRef (*CFBagCopyDescriptionCallBack
)(const void *value
);
38 typedef Boolean (*CFBagEqualCallBack
)(const void *value1
, const void *value2
);
39 typedef CFHashCode (*CFBagHashCallBack
)(const void *value
);
42 CFBagRetainCallBack retain
;
43 CFBagReleaseCallBack release
;
44 CFBagCopyDescriptionCallBack copyDescription
;
45 CFBagEqualCallBack equal
;
46 CFBagHashCallBack hash
;
50 const CFBagCallBacks kCFTypeBagCallBacks
;
52 const CFBagCallBacks kCFCopyStringBagCallBacks
;
54 typedef void (*CFBagApplierFunction
)(const void *value
, void *context
);
56 typedef const struct __CFBag
* CFBagRef
;
57 typedef struct __CFBag
* CFMutableBagRef
;
60 CFTypeID
CFBagGetTypeID(void);
63 CFBagRef
CFBagCreate(CFAllocatorRef allocator
, const void **values
, CFIndex numValues
, const CFBagCallBacks
*callBacks
);
66 CFBagRef
CFBagCreateCopy(CFAllocatorRef allocator
, CFBagRef theBag
);
69 CFMutableBagRef
CFBagCreateMutable(CFAllocatorRef allocator
, CFIndex capacity
, const CFBagCallBacks
*callBacks
);
72 CFMutableBagRef
CFBagCreateMutableCopy(CFAllocatorRef allocator
, CFIndex capacity
, CFBagRef theBag
);
75 CFIndex
CFBagGetCount(CFBagRef theBag
);
78 CFIndex
CFBagGetCountOfValue(CFBagRef theBag
, const void *value
);
81 Boolean
CFBagContainsValue(CFBagRef theBag
, const void *value
);
84 const void *CFBagGetValue(CFBagRef theBag
, const void *value
);
87 Boolean
CFBagGetValueIfPresent(CFBagRef theBag
, const void *candidate
, const void **value
);
90 void CFBagGetValues(CFBagRef theBag
, const void **values
);
93 void CFBagApplyFunction(CFBagRef theBag
, CFBagApplierFunction applier
, void *context
);
96 void CFBagAddValue(CFMutableBagRef theBag
, const void *value
);
99 void CFBagReplaceValue(CFMutableBagRef theBag
, const void *value
);
102 void CFBagSetValue(CFMutableBagRef theBag
, const void *value
);
105 void CFBagRemoveValue(CFMutableBagRef theBag
, const void *value
);
108 void CFBagRemoveAllValues(CFMutableBagRef theBag
);
112 #endif /* ! __COREFOUNDATION_CFBAG__ */