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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFValue.h"
#import "OFMethodSignature.h"
#import "OFString.h"
#import "OFValue_bytes.h"
#import "OFValue_dimension.h"
#import "OFValue_nonretainedObject.h"
#import "OFValue_point.h"
#import "OFValue_pointer.h"
#import "OFValue_range.h"
#import "OFValue_rectangle.h"
#import "OFOutOfMemoryException.h"
static struct {
Class isa;
} placeholder;
@interface OFValue_placeholder: OFValue
@end
@implementation OFValue_placeholder
- (instancetype)initWithBytes: (const void *)bytes
objCType: (const char *)objCType
{
return (id)[[OFValue_bytes alloc] initWithBytes: bytes
objCType: objCType];
}
- (instancetype)initWithPointer: (const void *)pointer
{
return (id)[[OFValue_pointer alloc] initWithPointer: pointer];
}
- (instancetype)initWithNonretainedObject: (id)object
{
return (id)[[OFValue_nonretainedObject alloc]
initWithNonretainedObject: object];
}
- (instancetype)initWithRange: (of_range_t)range
{
return (id)[[OFValue_range alloc] initWithRange: range];
}
- (instancetype)initWithPoint: (of_point_t)point
{
return (id)[[OFValue_point alloc] initWithPoint: point];
}
- (instancetype)initWithDimension: (of_dimension_t)dimension
{
return (id)[[OFValue_dimension alloc] initWithDimension: dimension];
}
- (instancetype)initWithRectangle: (of_rectangle_t)rectangle
{
return (id)[[OFValue_rectangle alloc] initWithRectangle: rectangle];
}
@end
@implementation OFValue
+ (void)initialize
{
if (self == [OFValue class])
placeholder.isa = [OFValue_placeholder class];
}
+ (instancetype)alloc
{
if (self == [OFValue class])
return (id)&placeholder;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFValue.h"
#import "OFBytesValue.h"
#import "OFDimensionValue.h"
#import "OFMethodSignature.h"
#import "OFNonretainedObjectValue.h"
#import "OFPointValue.h"
#import "OFPointerValue.h"
#import "OFRangeValue.h"
#import "OFRectangleValue.h"
#import "OFString.h"
#import "OFOutOfMemoryException.h"
static struct {
Class isa;
} placeholder;
@interface OFValuePlaceholder: OFValue
@end
@implementation OFValuePlaceholder
- (instancetype)initWithBytes: (const void *)bytes
objCType: (const char *)objCType
{
return (id)[[OFBytesValue alloc] initWithBytes: bytes
objCType: objCType];
}
- (instancetype)initWithPointer: (const void *)pointer
{
return (id)[[OFPointerValue alloc] initWithPointer: pointer];
}
- (instancetype)initWithNonretainedObject: (id)object
{
return (id)[[OFNonretainedObjectValue alloc]
initWithNonretainedObject: object];
}
- (instancetype)initWithRange: (of_range_t)range
{
return (id)[[OFRangeValue alloc] initWithRange: range];
}
- (instancetype)initWithPoint: (of_point_t)point
{
return (id)[[OFPointValue alloc] initWithPoint: point];
}
- (instancetype)initWithDimension: (of_dimension_t)dimension
{
return (id)[[OFDimensionValue alloc] initWithDimension: dimension];
}
- (instancetype)initWithRectangle: (of_rectangle_t)rectangle
{
return (id)[[OFRectangleValue alloc] initWithRectangle: rectangle];
}
@end
@implementation OFValue
+ (void)initialize
{
if (self == [OFValue class])
placeholder.isa = [OFValuePlaceholder class];
}
+ (instancetype)alloc
{
if (self == [OFValue class])
return (id)&placeholder;
|