ObjFW
|
00001 /* 00002 * Copyright (c) 2008, 2009, 2010, 2011, 2012 00003 * Jonathan Schleifer <js@webkeks.org> 00004 * 00005 * All rights reserved. 00006 * 00007 * This file is part of ObjFW. It may be distributed under the terms of the 00008 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in 00009 * the packaging of this file. 00010 * 00011 * Alternatively, it may be distributed under the terms of the GNU General 00012 * Public License, either version 2 or 3, which can be found in the file 00013 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this 00014 * file. 00015 */ 00016 00017 #ifndef __STDC_LIMIT_MACROS 00018 # define __STDC_LIMIT_MACROS 00019 #endif 00020 #ifndef __STDC_CONSTANT_MACROS 00021 # define __STDC_CONSTANT_MACROS 00022 #endif 00023 00024 #include <stdarg.h> 00025 00026 #import "OFObject.h" 00027 #import "OFCollection.h" 00028 #import "OFEnumerator.h" 00029 #import "OFSerialization.h" 00030 #import "OFJSONEncoding.h" 00031 00032 @class OFArray; 00033 00034 #ifdef OF_HAVE_BLOCKS 00035 typedef void (^of_dictionary_enumeration_block_t)(id key, id object, 00036 BOOL *stop); 00037 typedef BOOL (^of_dictionary_filter_block_t)(id key, id object); 00038 typedef id (^of_dictionary_map_block_t)(id key, id object); 00039 #endif 00040 00049 @interface OFDictionary: OFObject <OFCopying, OFMutableCopying, OFCollection, 00050 OFSerialization, OFJSON> 00056 + dictionary; 00057 00064 + dictionaryWithDictionary: (OFDictionary*)dictionary; 00065 00073 + dictionaryWithObject: (id)object 00074 forKey: (id)key; 00075 00083 + dictionaryWithObjects: (OFArray*)objects 00084 forKeys: (OFArray*)keys; 00085 00092 + dictionaryWithKeysAndObjects: (id)firstKey, ...; 00093 00099 - init; 00100 00108 - initWithDictionary: (OFDictionary*)dictionary; 00109 00118 - initWithObject: (id)object 00119 forKey: (id)key; 00120 00129 - initWithObjects: (OFArray*)objects 00130 forKeys: (OFArray*)keys; 00131 00139 - initWithKeysAndObjects: (id)firstKey, ...; 00140 00149 - initWithKey: (id)firstKey 00150 arguments: (va_list)arguments; 00151 00161 - (id)objectForKey: (id)key; 00162 00171 - (BOOL)containsObjectIdenticalTo: (id)object; 00172 00178 - (OFArray*)allKeys; 00179 00185 - (OFArray*)allObjects; 00186 00192 - (OFEnumerator*)keyEnumerator; 00193 00194 #ifdef OF_HAVE_BLOCKS 00195 00200 - (void)enumerateKeysAndObjectsUsingBlock: 00201 (of_dictionary_enumeration_block_t)block; 00202 00210 - (OFDictionary*)mappedDictionaryUsingBlock: (of_dictionary_map_block_t)block; 00211 00220 - (OFDictionary*)filteredDictionaryUsingBlock: 00221 (of_dictionary_filter_block_t)block; 00222 #endif 00223 00224 #if defined(OF_SET_M) || defined(OF_COUNTED_SET_M) 00225 - _initWithDictionary: (OFDictionary*)dictionary 00226 copyKeys: (BOOL)copyKeys; 00227 #endif 00228 @end 00229 00230 #import "OFMutableDictionary.h"