ObjFW  Diff

Differences From Artifact [4a69123110]:

To Artifact [c3a18a2f55]:


34
35
36
37
38
39
40

41
42
43
44
45
46
47
	OFMutableDictionary *_dictionary;
}
@end

@interface SimpleMutableDictionary: OFMutableDictionary
{
	OFMutableDictionary *_dictionary;

}
@end

@implementation SimpleDictionary
- (instancetype)init
{
	self = [super init];







>







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	OFMutableDictionary *_dictionary;
}
@end

@interface SimpleMutableDictionary: OFMutableDictionary
{
	OFMutableDictionary *_dictionary;
	unsigned long _mutations;
}
@end

@implementation SimpleDictionary
- (instancetype)init
{
	self = [super init];
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141


142
143



144
145
146
147


148
















149
150
151
152
153
154
155
	return [_dictionary count];
}

- (OFEnumerator *)keyEnumerator
{
	return [_dictionary keyEnumerator];
}

- (OFEnumerator *)objectEnumerator
{
	return [_dictionary objectEnumerator];
}

- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
			   objects: (id *)objects
			     count: (int)count
{
	return [_dictionary countByEnumeratingWithState: state
						objects: objects
						  count: count];
}
@end

@implementation SimpleMutableDictionary
+ (void)initialize
{
	if (self == [SimpleMutableDictionary class])
		[self inheritMethodsFromClass: [SimpleDictionary class]];
}

- (void)setObject: (id)object
	   forKey: (id)key
{


	[_dictionary setObject: object
			forKey: key];



}

- (void)removeObjectForKey: (id)key
{


	[_dictionary removeObjectForKey: key];
















}
@end

@implementation TestsAppDelegate (OFDictionaryTests)
- (void)dictionaryTestsWithClass: (Class)dictionaryClass
		    mutableClass: (Class)mutableDictionaryClass
{







<
<
<
<
<
<
<
<
<
<
<
<
<
<












>
>


>
>
>




>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







110
111
112
113
114
115
116














117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
	return [_dictionary count];
}

- (OFEnumerator *)keyEnumerator
{
	return [_dictionary keyEnumerator];
}














@end

@implementation SimpleMutableDictionary
+ (void)initialize
{
	if (self == [SimpleMutableDictionary class])
		[self inheritMethodsFromClass: [SimpleDictionary class]];
}

- (void)setObject: (id)object
	   forKey: (id)key
{
	bool existed = ([_dictionary objectForKey: key] == nil);

	[_dictionary setObject: object
			forKey: key];

	if (existed)
		_mutations++;
}

- (void)removeObjectForKey: (id)key
{
	bool existed = ([_dictionary objectForKey: key] == nil);

	[_dictionary removeObjectForKey: key];

	if (existed)
		_mutations++;
}

- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
			   objects: (id *)objects
			     count: (int)count
{
	int ret = [super countByEnumeratingWithState: state
					     objects: objects
					       count: count];

	state->mutationsPtr = &_mutations;

	return ret;
}
@end

@implementation TestsAppDelegate (OFDictionaryTests)
- (void)dictionaryTestsWithClass: (Class)dictionaryClass
		    mutableClass: (Class)mutableDictionaryClass
{