2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
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
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.
23 * @APPLE_LICENSE_HEADER_END@
26 Copyright (c) 1998-2003, Apple, Inc. All rights reserved.
29 #if !defined(__COREFOUNDATION_CFBAG__)
30 #define __COREFOUNDATION_CFBAG__ 1
32 #include <CoreFoundation/CFBase.h>
34 #if defined(__cplusplus)
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
);
45 CFBagRetainCallBack retain
;
46 CFBagReleaseCallBack release
;
47 CFBagCopyDescriptionCallBack copyDescription
;
48 CFBagEqualCallBack equal
;
49 CFBagHashCallBack hash
;
53 const CFBagCallBacks kCFTypeBagCallBacks
;
55 const CFBagCallBacks kCFCopyStringBagCallBacks
;
57 typedef void (*CFBagApplierFunction
)(const void *value
, void *context
);
59 typedef const struct __CFBag
* CFBagRef
;
60 typedef struct __CFBag
* CFMutableBagRef
;
63 CFTypeID
CFBagGetTypeID(void);
66 CFBagRef
CFBagCreate(CFAllocatorRef allocator
, const void **values
, CFIndex numValues
, const CFBagCallBacks
*callBacks
);
69 CFBagRef
CFBagCreateCopy(CFAllocatorRef allocator
, CFBagRef theBag
);
72 CFMutableBagRef
CFBagCreateMutable(CFAllocatorRef allocator
, CFIndex capacity
, const CFBagCallBacks
*callBacks
);
75 CFMutableBagRef
CFBagCreateMutableCopy(CFAllocatorRef allocator
, CFIndex capacity
, CFBagRef theBag
);
78 CFIndex
CFBagGetCount(CFBagRef theBag
);
81 CFIndex
CFBagGetCountOfValue(CFBagRef theBag
, const void *value
);
84 Boolean
CFBagContainsValue(CFBagRef theBag
, const void *value
);
87 const void *CFBagGetValue(CFBagRef theBag
, const void *value
);
90 Boolean
CFBagGetValueIfPresent(CFBagRef theBag
, const void *candidate
, const void **value
);
93 void CFBagGetValues(CFBagRef theBag
, const void **values
);
96 void CFBagApplyFunction(CFBagRef theBag
, CFBagApplierFunction applier
, void *context
);
99 void CFBagAddValue(CFMutableBagRef theBag
, const void *value
);
102 void CFBagReplaceValue(CFMutableBagRef theBag
, const void *value
);
105 void CFBagSetValue(CFMutableBagRef theBag
, const void *value
);
108 void CFBagRemoveValue(CFMutableBagRef theBag
, const void *value
);
111 void CFBagRemoveAllValues(CFMutableBagRef theBag
);
113 #if defined(__cplusplus)
117 #endif /* ! __COREFOUNDATION_CFBAG__ */