-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDKCollection.h
More file actions
80 lines (54 loc) · 2.46 KB
/
Copy pathDKCollection.h
File metadata and controls
80 lines (54 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// =======================================================================================
//
// DKCollection.h
// Duck Object Library -- See LICENSE for legal information.
//
// Copyright (c) 2014-2026 Derek W. Nylen
//
// =======================================================================================
#ifndef _DK_COLLECTION_H_
#define _DK_COLLECTION_H_
#ifdef __cplusplus
extern "C"
{
#endif
DK_API DKDeclareInterfaceSelector( Collection );
DK_API DKDeclareInterfaceSelector( KeyedCollection );
typedef DKIndex (*DKGetCountMethod)( DKObjectRef _self );
typedef bool (*DKContainsMethod)( DKObjectRef _self, DKObjectRef object );
typedef int (*DKForeachObjectMethod)( DKObjectRef _self, DKApplierFunction callback, void * context );
typedef int (*DKForeachKeyAndObjectMethod)( DKObjectRef _self, DKKeyedApplierFunction callback, void * context );
struct DKCollectionInterface
{
const DKInterface _interface;
DKGetCountMethod getCount;
DKContainsMethod containsObject;
DKForeachObjectMethod foreachObject;
};
typedef const struct DKCollectionInterface * DKCollectionInterfaceRef;
struct DKKeyedCollectionInterface
{
const DKInterface _interface;
DKGetCountMethod getCount;
DKContainsMethod containsObject;
DKForeachObjectMethod foreachObject;
DKContainsMethod containsKey;
DKForeachObjectMethod foreachKey;
DKForeachKeyAndObjectMethod foreachKeyAndObject;
};
typedef const struct DKKeyedCollectionInterface * DKKeyedCollectionInterfaceRef;
DK_API DKIndex DKGetCount( DKObjectRef _self );
DK_API DKObjectRef DKGetAnyKey( DKObjectRef _self );
DK_API DKObjectRef DKGetAnyObject( DKObjectRef _self );
DK_API bool DKContainsKey( DKObjectRef _self, DKObjectRef key );
DK_API bool DKContainsObject( DKObjectRef _self, DKObjectRef object );
DK_API int DKForeachKey( DKObjectRef _self, DKApplierFunction callback, void * context );
DK_API int DKForeachObject( DKObjectRef _self, DKApplierFunction callback, void * context );
DK_API int DKForeachKeyAndObject( DKObjectRef _self, DKKeyedApplierFunction callback, void * context );
DK_API DKStringRef DKCollectionGetDescription( DKObjectRef _self );
DK_API DKStringRef DKKeyedCollectionGetDescription( DKObjectRef _self );
DK_API DKListRef DKKeyedCollectionGetSortedEntries( DKObjectRef _self, DKCompareFunction cmp );
#ifdef __cplusplus
}
#endif
#endif // _DK_COLLECTION_H_