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
|
/*
* Copyright (c) 2008 - 2009
* Jonathan Schleifer <js@webkeks.org>
*
* 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 included in
* the packaging of this file.
*/
#include <stdarg.h>
#import "OFObject.h"
#import "OFEnumerator.h"
@class OFArray;
struct of_dictionary_bucket
{
OFObject <OFCopying> *key;
OFObject *object;
uint32_t hash;
};
/**
* The OFDictionary class is a class for using hash tables.
*/
@interface OFDictionary: OFObject <OFCopying, OFMutableCopying,
OFFastEnumeration>
{
struct of_dictionary_bucket *data;
size_t size;
size_t count;
|
|
>
>
|
|
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
|
/*
* Copyright (c) 2008 - 2010
* Jonathan Schleifer <js@webkeks.org>
*
* 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 included in
* the packaging of this file.
*/
#include <stdarg.h>
#import "OFObject.h"
#import "OFEnumerator.h"
@class OFArray;
/// \cond internal
struct of_dictionary_bucket
{
OFObject <OFCopying> *key;
OFObject *object;
uint32_t hash;
};
/// \endcond
/**
* \brief A class for storing objects in a hash table.
*/
@interface OFDictionary: OFObject <OFCopying, OFMutableCopying,
OFFastEnumeration>
{
struct of_dictionary_bucket *data;
size_t size;
size_t count;
|
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
/**
* \return An OFEnumerator to enumerate through the dictionary's keys
*/
- (OFEnumerator*)keyEnumerator;
@end
@interface OFDictionaryEnumerator: OFEnumerator
{
struct of_dictionary_bucket *data;
size_t size;
unsigned long mutations;
unsigned long *mutations_ptr;
size_t pos;
}
- initWithData: (struct of_dictionary_bucket*)data
size: (size_t)size
mutationsPointer: (unsigned long*)mutations_ptr;
@end
@interface OFDictionaryObjectEnumerator: OFDictionaryEnumerator
@end
@interface OFDictionaryKeyEnumerator: OFDictionaryEnumerator
@end
#import "OFMutableDictionary.h"
|
>
>
|
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
/**
* \return An OFEnumerator to enumerate through the dictionary's keys
*/
- (OFEnumerator*)keyEnumerator;
@end
/// \cond internal
@interface OFDictionaryEnumerator: OFEnumerator
{
struct of_dictionary_bucket *data;
size_t size;
unsigned long mutations;
unsigned long *mutations_ptr;
size_t pos;
}
- initWithData: (struct of_dictionary_bucket*)data
size: (size_t)size
mutationsPointer: (unsigned long*)mutations_ptr;
@end
@interface OFDictionaryObjectEnumerator: OFDictionaryEnumerator
@end
@interface OFDictionaryKeyEnumerator: OFDictionaryEnumerator
@end
/// \endcond
#import "OFMutableDictionary.h"
|