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
|
#define OFCONSTSTRING_M
#import "OFConstString.h"
#import "OFString.h"
#import "OFExceptions.h"
#import "OFMacros.h"
#ifndef __objc_INCLUDE_GNU
struct objc_class _OFConstStringClassReference;
#endif
@implementation OFConstString
#ifndef __objc_INCLUDE_GNU
+ (void)load
{
Class cls = objc_getClass("OFConstString");
memcpy(&_OFConstStringClassReference, cls,
sizeof(_OFConstStringClassReference));
objc_addClass(&_OFConstStringClassReference);
}
#endif
- (BOOL)isKindOf: (Class)c
{
if (c == [OFConstString class])
return YES;
return NO;
}
- (const char*)cString
{
return string;
}
- (size_t)length
{
|
|
<
|
|
<
<
<
<
<
<
<
<
|
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
|
#define OFCONSTSTRING_M
#import "OFConstString.h"
#import "OFString.h"
#import "OFExceptions.h"
#import "OFMacros.h"
#ifndef __objc_INCLUDE_GNU
void *_OFConstStringClassReference;
#endif
@implementation OFConstString
#ifndef __objc_INCLUDE_GNU
+ (void)load
{
objc_setFutureClass((Class)&_OFConstStringClassReference,
"OFConstString");
}
#endif
- (const char*)cString
{
return string;
}
- (size_t)length
{
|