20#ifndef __STDC_LIMIT_MACROS
21# define __STDC_LIMIT_MACROS
23#ifndef __STDC_CONSTANT_MACROS
24# define __STDC_CONSTANT_MACROS
30#import "OFCollection.h"
31#import "OFEnumerator.h"
32#import "OFJSONRepresentation.h"
33#import "OFMessagePackRepresentation.h"
35OF_ASSUME_NONNULL_BEGIN
37@class OFArray OF_GENERIC(ObjectType);
48typedef void (^OFDictionaryEnumerationBlock)(
id key,
id object,
bool *stop);
57typedef bool (^OFDictionaryFilterBlock)(
id key,
id object);
66typedef id _Nonnull (^OFDictionaryMapBlock)(
id key,
id object);
85#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
112+ (instancetype)dictionaryWithDictionary:
113 (
OFDictionary OF_GENERIC(KeyType, ObjectType) *)dictionary;
122+ (instancetype)dictionaryWithObject: (ObjectType)object forKey: (KeyType)key;
131+ (instancetype)dictionaryWithObjects: (
OFArray OF_GENERIC(ObjectType) *)objects
132 forKeys: (
OFArray OF_GENERIC(KeyType) *)keys;
143 dictionaryWithObjects: (ObjectType const _Nonnull *_Nonnull)objects
144 forKeys: (KeyType const _Nonnull *_Nonnull)keys
145 count: (
size_t)count;
153+ (instancetype)dictionaryWithKeysAndObjects: (KeyType)firstKey, ...
161- (instancetype)
init OF_DESIGNATED_INITIALIZER;
170- (instancetype)initWithDictionary:
171 (
OFDictionary OF_GENERIC(KeyType, ObjectType) *)dictionary;
181- (instancetype)initWithObject: (ObjectType)object forKey: (KeyType)key;
191- (instancetype)initWithObjects: (
OFArray OF_GENERIC(ObjectType) *)objects
192 forKeys: (
OFArray OF_GENERIC(KeyType) *)keys;
203- (instancetype)initWithObjects: (ObjectType const _Nonnull *_Nonnull)objects
204 forKeys: (KeyType const _Nonnull *_Nonnull)keys
205 count: (
size_t)count OF_DESIGNATED_INITIALIZER;
214- (instancetype)initWithKeysAndObjects: (KeyType)firstKey, ... OF_SENTINEL;
224- (instancetype)initWithKey: (KeyType)firstKey arguments: (va_list)arguments;
236- (nullable ObjectType)objectForKey: (KeyType)key;
237- (nullable ObjectType)objectForKeyedSubscript: (KeyType)key;
250- (nullable id)valueForKey: (
OFString *)key;
261- (void)setValue: (nullable
id)value forKey: (
OFString *)key;
270- (bool)containsObject: (ObjectType)object;
280- (bool)containsObjectIdenticalTo: (ObjectType)object;
302- (void)enumerateKeysAndObjectsUsingBlock: (OFDictionaryEnumerationBlock)block;
312 mappedDictionaryUsingBlock: (OFDictionaryMapBlock)block;
323 filteredDictionaryUsingBlock: (OFDictionaryFilterBlock)block;
325#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
335#if !defined(NSINTEGER_DEFINED) && !__has_feature(modules)
An abstract class for storing objects in an array.
Definition OFArray.h:109
An abstract class for storing objects in a dictionary.
Definition OFDictionary.h:84
instancetype init()
Initializes an already allocated OFDictionary to be empty.
Definition OFDictionary.m:185
OFArray * allObjects
An array of all objects.
Definition OFDictionary.h:97
OFArray * allKeys
An array of all keys.
Definition OFDictionary.h:92
instancetype dictionary()
Creates a new OFDictionary.
Definition OFDictionary.m:140
OFEnumerator * keyEnumerator()
Returns an OFEnumerator to enumerate through the dictionary's keys.
Definition OFDictionary.m:521
OFEnumerator * objectEnumerator()
Returns an OFEnumerator to enumerate through the dictionary's objects.
Definition OFDictionary.m:526
A class which provides methods to enumerate through collections.
Definition OFEnumerator.h:103
The root class for all other classes inside ObjFW.
Definition OFObject.h:692
A class for handling strings.
Definition OFString.h:143
A protocol with methods common for all collections.
Definition OFCollection.h:29
A protocol for the creation of copies.
Definition OFObject.h:1350
A protocol implemented by classes that support encoding to a JSON representation.
Definition OFJSONRepresentation.h:49
A protocol implemented by classes that support encoding to a MessagePack representation.
Definition OFMessagePackRepresentation.h:33
A protocol for the creation of mutable copies.
Definition OFObject.h:1371