GNUstep CoreBase Library 0.2
CFBag.h
1/* CFBag.h
2
3 Copyright (C) 2010 Free Software Foundation, Inc.
4
5 Written by: Stefan Bidigaray
6 Date: January, 2010
7
8 This file is part of CoreBase.
9
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
14
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public
21 License along with this library; see the file COPYING.LIB.
22 If not, see <http://www.gnu.org/licenses/> or write to the
23 Free Software Foundation, 51 Franklin Street, Fifth Floor,
24 Boston, MA 02110-1301, USA.
25*/
26
27#ifndef __COREFOUNDATION_CFBAG_H__
28#define __COREFOUNDATION_CFBAG_H__
29
30#include <CoreFoundation/CFBase.h>
31
32CF_EXTERN_C_BEGIN
34typedef const struct __CFBag *CFBagRef;
36typedef struct __CFBag *CFMutableBagRef;
37
41typedef void (*CFBagApplierFunction) (const void *value, void *context);
42
43typedef CFStringRef (*CFBagCopyDescriptionCallBack) (const void *value);
44typedef Boolean (*CFBagEqualCallBack) (const void *value1, const void *value2);
45typedef CFHashCode (*CFBagHashCallBack) (const void *value);
46typedef void (*CFBagReleaseCallBack) (CFAllocatorRef alloc, const void *value);
47typedef const void *(*CFBagRetainCallBack) (CFAllocatorRef alloc,
48 const void *value);
49
50typedef struct CFBagCallBacks CFBagCallBacks;
52{
53 CFIndex version;
54 CFBagRetainCallBack retain;
55 CFBagReleaseCallBack release;
56 CFBagCopyDescriptionCallBack copyDescription;
57 CFBagEqualCallBack equal;
58 CFBagHashCallBack hash;
59};
60
61CF_EXPORT const CFBagCallBacks kCFCopyStringBagCallBacks;
62CF_EXPORT const CFBagCallBacks kCFTypeBagCallBacks;
63
64
65
69CF_EXPORT CFBagRef
70CFBagCreate (CFAllocatorRef alloc, const void **values, CFIndex numValues,
71 const CFBagCallBacks * callBacks);
72
73CF_EXPORT CFBagRef CFBagCreateCopy (CFAllocatorRef alloc, CFBagRef bag);
79CF_EXPORT Boolean CFBagContainsValue (CFBagRef bag, const void *value);
80
81CF_EXPORT CFIndex CFBagGetCount (CFBagRef bag);
82
83CF_EXPORT CFIndex CFBagGetCountOfValue (CFBagRef bag, const void *value);
84
85CF_EXPORT void CFBagGetValues (CFBagRef bag, const void **values);
86
87CF_EXPORT const void *CFBagGetValue (CFBagRef bag, const void *value);
88
89CF_EXPORT Boolean
90CFBagGetValueIfPresent (CFBagRef bag, const void *candidate,
91 const void **value);
97CF_EXPORT void
98CFBagApplyFunction (CFBagRef bag, CFBagApplierFunction applier, void *context);
104CF_EXPORT CFTypeID CFBagGetTypeID (void);
114CF_EXPORT CFMutableBagRef
115CFBagCreateMutable (CFAllocatorRef alloc, CFIndex capacity,
116 const CFBagCallBacks * callBacks);
117
118CF_EXPORT CFMutableBagRef
119CFBagCreateMutableCopy (CFAllocatorRef alloc, CFIndex capacity, CFBagRef bag);
125CF_EXPORT void CFBagAddValue (CFMutableBagRef bag, const void *value);
126
127CF_EXPORT void CFBagRemoveAllValues (CFMutableBagRef bag);
128
129CF_EXPORT void CFBagRemoveValue (CFMutableBagRef bag, const void *value);
130
131CF_EXPORT void CFBagReplaceValue (CFMutableBagRef bag, const void *value);
132
133CF_EXPORT void CFBagSetValue (CFMutableBagRef bag, const void *value);
137CF_EXTERN_C_END
138#endif /* __COREFOUNDATION_CFBAG_H__ */
signed long CFIndex
Definition CFBase.h:165
unsigned long CFHashCode
Definition CFBase.h:159
const struct __CFAllocator * CFAllocatorRef
A reference to a CFAllocator object.
Definition CFBase.h:301
Definition CFBag.h:52