1
2
3
4
5
6
7
8
9
|
/*
* Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
|
|
|
1
2
3
4
5
6
7
8
9
|
/*
* Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#import "OFMessagePackRepresentation.h"
OF_ASSUME_NONNULL_BEGIN
@class OFArray OF_GENERIC(ObjectType);
#ifdef OF_HAVE_BLOCKS
typedef void (^OFDictionaryEnumerationBlock)(id key, id object, bool *stop);
typedef bool (^OFDictionaryFilterBlock)(id key, id object);
typedef id _Nonnull (^OFDictionaryMapBlock)(id key, id object);
#endif
/**
* @class OFDictionary OFDictionary.h ObjFW/OFDictionary.h
*
* @brief An abstract class for storing objects in a dictionary.
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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
|
#import "OFMessagePackRepresentation.h"
OF_ASSUME_NONNULL_BEGIN
@class OFArray OF_GENERIC(ObjectType);
#ifdef OF_HAVE_BLOCKS
/**
* @brief A block for enumerating an OFDictionary.
*
* @param key The current key
* @param object The object for the current key
* @param stop A pointer to a variable that can be set to true to stop the
* enumeration.
*/
typedef void (^OFDictionaryEnumerationBlock)(id key, id object, bool *stop);
/**
* @brief A block for filtering an OFDictionary.
*
* @param key The key to inspect
* @param object The object for the key to inspect
* @return Whether the object should be in the filtered dictionary.
*/
typedef bool (^OFDictionaryFilterBlock)(id key, id object);
/**
* @brief A block for mapping keys to objects in an OFDictionary.
*
* @param key The key to map
* @param object The current object for the key
* @return The object to map the key to
*/
typedef id _Nonnull (^OFDictionaryMapBlock)(id key, id object);
#endif
/**
* @class OFDictionary OFDictionary.h ObjFW/OFDictionary.h
*
* @brief An abstract class for storing objects in a dictionary.
|
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
/**
* @brief Creates a new OFDictionary with the specified keys and objects.
*
* @param keys An array of keys
* @param objects An array of objects
* @return A new autoreleased OFDictionary
*/
+ (instancetype)
dictionaryWithObjects: (OFArray OF_GENERIC(ObjectType) *)objects
forKeys: (OFArray OF_GENERIC(KeyType) *)keys;
/**
* @brief Creates a new OFDictionary with the specified keys and objects.
*
* @param keys An array of keys
* @param objects An array of objects
* @param count The number of objects in the arrays
|
<
|
|
|
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
/**
* @brief Creates a new OFDictionary with the specified keys and objects.
*
* @param keys An array of keys
* @param objects An array of objects
* @return A new autoreleased OFDictionary
*/
+ (instancetype)dictionaryWithObjects: (OFArray OF_GENERIC(ObjectType) *)objects
forKeys: (OFArray OF_GENERIC(KeyType) *)keys;
/**
* @brief Creates a new OFDictionary with the specified keys and objects.
*
* @param keys An array of keys
* @param objects An array of objects
* @param count The number of objects in the arrays
|