20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include <ctype.h>
#import "OFObject.h"
#import "OFObject+KeyValueCoding.h"
#import "OFString.h"
#import "OFNumber.h"
#import "OFOutOfMemoryException.h"
#import "OFUndefinedKeyException.h"
int _OFObject_KeyValueCoding_reference;
static char OF_INLINE
nextType(const char **typeEncoding)
|
>
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include <ctype.h>
#import "OFObject.h"
#import "OFObject+KeyValueCoding.h"
#import "OFString.h"
#import "OFNumber.h"
#import "OFInvalidArgumentException.h"
#import "OFOutOfMemoryException.h"
#import "OFUndefinedKeyException.h"
int _OFObject_KeyValueCoding_reference;
static char OF_INLINE
nextType(const char **typeEncoding)
|
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
valueType = nextType(&typeEncoding);
if (*typeEncoding != 0) {
[self setValue: value
forUndefinedKey: key];
return;
}
switch (valueType) {
case '@':
case '#':
{
void (*setter)(id, SEL, id) = (void(*)(id, SEL, id))
[self methodForSelector: selector];
|
>
>
>
>
>
|
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
valueType = nextType(&typeEncoding);
if (*typeEncoding != 0) {
[self setValue: value
forUndefinedKey: key];
return;
}
if (valueType != '@' && valueType != '#' && value == nil) {
[self setNilValueForKey: key];
return;
}
switch (valueType) {
case '@':
case '#':
{
void (*setter)(id, SEL, id) = (void(*)(id, SEL, id))
[self methodForSelector: selector];
|
182
183
184
185
186
187
188
189
|
- (void)setValue: (id)value
forUndefinedKey: (OFString*)key
{
@throw [OFUndefinedKeyException exceptionWithObject: self
key: key
value: value];
}
@end
|
>
>
>
>
>
|
188
189
190
191
192
193
194
195
196
197
198
199
200
|
- (void)setValue: (id)value
forUndefinedKey: (OFString*)key
{
@throw [OFUndefinedKeyException exceptionWithObject: self
key: key
value: value];
}
- (void)setNilValueForKey: (OFString*)key
{
@throw [OFInvalidArgumentException exception];
}
@end
|