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
90
91
92
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
+
+
|
}
- (instancetype)initWithRange: (OFRange)range
{
return (id)[[OFRangeCharacterSet alloc] initWithRange: range];
}
- (instancetype)retain
{
return self;
}
OF_SINGLETON_METHODS
- (instancetype)autorelease
{
return self;
}
- (void)release
{
}
- (void)dealloc
{
OF_DEALLOC_UNSUPPORTED
}
@end
@implementation OFCharacterSet
+ (void)initialize
{
if (self != [OFCharacterSet class])
if (self == [OFCharacterSet class])
return;
placeholder.isa = [OFPlaceholderCharacterSet class];
object_setClass((id)&placeholder,
[OFPlaceholderCharacterSet class]);
}
+ (instancetype)alloc
{
if (self == [OFCharacterSet class])
return (id)&placeholder;
|
147
148
149
150
151
152
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
|
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
{
return [[[OFInvertedCharacterSet alloc]
initWithCharacterSet: self] autorelease];
}
@end
@implementation OFWhitespaceCharacterSet
- (instancetype)autorelease
{
return self;
}
- (instancetype)retain
{
return self;
}
- (void)release
{
}
- (unsigned int)retainCount
{
return OFMaxRetainCount;
}
- (bool)characterIsMember: (OFUnichar)character
{
switch (character) {
case 0x0009:
case 0x0020:
case 0x00A0:
case 0x1680:
|
192
193
194
195
196
197
198
199
|
155
156
157
158
159
160
161
162
163
164
|
+
+
|
case 0x205F:
case 0x3000:
return true;
default:
return false;
}
}
OF_SINGLETON_METHODS
@end
|