ObjFW  Diff

Differences From Artifact [b3111ce4c7]:

To Artifact [0f6fc5e073]:


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
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#import "OFCharacterSet.h"
#import "OFCharacterSet_bitset.h"
#import "OFCharacterSet_invertedSet.h"
#import "OFCharacterSet_range.h"

static struct {
	Class isa;
} placeholder;

static OFCharacterSet *whitespaceCharacterSet = nil;

@interface OFCharacterSet_placeholder: OFCharacterSet
@end

@interface OFCharacterSet_whitespace: OFCharacterSet
- (instancetype)of_init;
@end

@implementation OFCharacterSet_placeholder
- (instancetype)init
{
	return (id)[[OFCharacterSet_bitset alloc] init];
}

- (instancetype)initWithCharactersInString: (OFString *)characters
{
	return (id)[[OFCharacterSet_bitset alloc]
	    initWithCharactersInString: characters];
}

- (instancetype)initWithRange: (of_range_t)range
{
	return (id)[[OFCharacterSet_range alloc] initWithRange: range];
}

- (instancetype)retain
{
	return self;
}








|
|
|







|


|



|


|




|





|







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
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#import "OFCharacterSet.h"
#import "OFBitSetCharacterSet.h"
#import "OFInvertedCharacterSet.h"
#import "OFRangeCharacterSet.h"

static struct {
	Class isa;
} placeholder;

static OFCharacterSet *whitespaceCharacterSet = nil;

@interface OFPlaceholderCharacterSet: OFCharacterSet
@end

@interface OFWhitespaceCharacterSet: OFCharacterSet
- (instancetype)of_init;
@end

@implementation OFPlaceholderCharacterSet
- (instancetype)init
{
	return (id)[[OFBitSetCharacterSet alloc] init];
}

- (instancetype)initWithCharactersInString: (OFString *)characters
{
	return (id)[[OFBitSetCharacterSet alloc]
	    initWithCharactersInString: characters];
}

- (instancetype)initWithRange: (of_range_t)range
{
	return (id)[[OFRangeCharacterSet alloc] initWithRange: range];
}

- (instancetype)retain
{
	return self;
}

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

@implementation OFCharacterSet
+ (void)initialize
{
	if (self != [OFCharacterSet class])
		return;

	placeholder.isa = [OFCharacterSet_placeholder class];
}

+ (instancetype)alloc
{
	if (self == [OFCharacterSet class])
		return (id)&placeholder;








|







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

@implementation OFCharacterSet
+ (void)initialize
{
	if (self != [OFCharacterSet class])
		return;

	placeholder.isa = [OFPlaceholderCharacterSet class];
}

+ (instancetype)alloc
{
	if (self == [OFCharacterSet class])
		return (id)&placeholder;

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
+ (instancetype)characterSetWithRange: (of_range_t)range
{
	return [[[self alloc] initWithRange: range] autorelease];
}

+ (OFCharacterSet *)whitespaceCharacterSet
{
	return [OFCharacterSet_whitespace whitespaceCharacterSet];
}

- (instancetype)init
{
	if ([self isMemberOfClass: [OFCharacterSet class]]) {
		@try {
			[self doesNotRecognizeSelector: _cmd];







|







98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
+ (instancetype)characterSetWithRange: (of_range_t)range
{
	return [[[self alloc] initWithRange: range] autorelease];
}

+ (OFCharacterSet *)whitespaceCharacterSet
{
	return [OFWhitespaceCharacterSet whitespaceCharacterSet];
}

- (instancetype)init
{
	if ([self isMemberOfClass: [OFCharacterSet class]]) {
		@try {
			[self doesNotRecognizeSelector: _cmd];
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
- (bool)characterIsMember: (of_unichar_t)character
{
	OF_UNRECOGNIZED_SELECTOR
}

- (OFCharacterSet *)invertedSet
{
	return [[[OFCharacterSet_invertedSet alloc]
	    of_initWithCharacterSet: self] autorelease];
}
@end

@implementation OFCharacterSet_whitespace
+ (void)initialize
{
	if (self != [OFCharacterSet_whitespace class])
		return;

	whitespaceCharacterSet = [[OFCharacterSet_whitespace alloc] of_init];
}

+ (OFCharacterSet *)whitespaceCharacterSet
{
	return whitespaceCharacterSet;
}








|




|


|


|







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
- (bool)characterIsMember: (of_unichar_t)character
{
	OF_UNRECOGNIZED_SELECTOR
}

- (OFCharacterSet *)invertedSet
{
	return [[[OFInvertedCharacterSet alloc]
	    of_initWithCharacterSet: self] autorelease];
}
@end

@implementation OFWhitespaceCharacterSet
+ (void)initialize
{
	if (self != [OFWhitespaceCharacterSet class])
		return;

	whitespaceCharacterSet = [[OFWhitespaceCharacterSet alloc] of_init];
}

+ (OFCharacterSet *)whitespaceCharacterSet
{
	return whitespaceCharacterSet;
}