1/* 2 * Copyright (c) 2014 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 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 11 * file. 12 * 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. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 24/* CFBag.h 25 Copyright (c) 1998-2013, Apple Inc. All rights reserved. 26*/ 27 28#if !defined(__COREFOUNDATION_CFBAG__) 29#define __COREFOUNDATION_CFBAG__ 1 30 31#include <CoreFoundation/CFBase.h> 32 33CF_IMPLICIT_BRIDGING_ENABLED 34CF_EXTERN_C_BEGIN 35 36typedef const void * (*CFBagRetainCallBack)(CFAllocatorRef allocator, const void *value); 37typedef void (*CFBagReleaseCallBack)(CFAllocatorRef allocator, const void *value); 38typedef CFStringRef (*CFBagCopyDescriptionCallBack)(const void *value); 39typedef Boolean (*CFBagEqualCallBack)(const void *value1, const void *value2); 40typedef CFHashCode (*CFBagHashCallBack)(const void *value); 41typedef struct { 42 CFIndex version; 43 CFBagRetainCallBack retain; 44 CFBagReleaseCallBack release; 45 CFBagCopyDescriptionCallBack copyDescription; 46 CFBagEqualCallBack equal; 47 CFBagHashCallBack hash; 48} CFBagCallBacks; 49 50CF_EXPORT 51const CFBagCallBacks kCFTypeBagCallBacks; 52CF_EXPORT 53const CFBagCallBacks kCFCopyStringBagCallBacks; 54 55typedef void (*CFBagApplierFunction)(const void *value, void *context); 56 57typedef const struct __CFBag * CFBagRef; 58typedef struct __CFBag * CFMutableBagRef; 59 60CF_EXPORT 61CFTypeID CFBagGetTypeID(void); 62 63CF_EXPORT 64CFBagRef CFBagCreate(CFAllocatorRef allocator, const void **values, CFIndex numValues, const CFBagCallBacks *callBacks); 65 66CF_EXPORT 67CFBagRef CFBagCreateCopy(CFAllocatorRef allocator, CFBagRef theBag); 68 69CF_EXPORT 70CFMutableBagRef CFBagCreateMutable(CFAllocatorRef allocator, CFIndex capacity, const CFBagCallBacks *callBacks); 71 72CF_EXPORT 73CFMutableBagRef CFBagCreateMutableCopy(CFAllocatorRef allocator, CFIndex capacity, CFBagRef theBag); 74 75CF_EXPORT 76CFIndex CFBagGetCount(CFBagRef theBag); 77 78CF_EXPORT 79CFIndex CFBagGetCountOfValue(CFBagRef theBag, const void *value); 80 81CF_EXPORT 82Boolean CFBagContainsValue(CFBagRef theBag, const void *value); 83 84CF_EXPORT 85const void *CFBagGetValue(CFBagRef theBag, const void *value); 86 87CF_EXPORT 88Boolean CFBagGetValueIfPresent(CFBagRef theBag, const void *candidate, const void **value); 89 90CF_EXPORT 91void CFBagGetValues(CFBagRef theBag, const void **values); 92 93CF_EXPORT 94void CFBagApplyFunction(CFBagRef theBag, CFBagApplierFunction applier, void *context); 95 96CF_EXPORT 97void CFBagAddValue(CFMutableBagRef theBag, const void *value); 98 99CF_EXPORT 100void CFBagReplaceValue(CFMutableBagRef theBag, const void *value); 101 102CF_EXPORT 103void CFBagSetValue(CFMutableBagRef theBag, const void *value); 104 105CF_EXPORT 106void CFBagRemoveValue(CFMutableBagRef theBag, const void *value); 107 108CF_EXPORT 109void CFBagRemoveAllValues(CFMutableBagRef theBag); 110 111CF_EXTERN_C_END 112CF_IMPLICIT_BRIDGING_DISABLED 113 114#endif /* ! __COREFOUNDATION_CFBAG__ */ 115 116