-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathHTMLTextNode.m
More file actions
52 lines (39 loc) · 821 Bytes
/
HTMLTextNode.m
File metadata and controls
52 lines (39 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
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
// HTMLTextNode.m
//
// Public domain. https://github.com/nolanw/HTMLReader
#import "HTMLTextNode.h"
NS_ASSUME_NONNULL_BEGIN
@implementation HTMLTextNode
{
NSMutableString *_data;
}
- (instancetype)initWithData:(NSString *)data
{
NSParameterAssert(data);
if ((self = [super init])) {
_data = [NSMutableString stringWithString:data];
}
return self;
}
- (instancetype)init
{
return [self initWithData:@""];
}
- (void)appendString:(NSString *)string
{
NSParameterAssert(string);
[_data appendString:string];
}
- (NSString *)data
{
return [_data copy];
}
#pragma mark NSCopying
- (id)copyWithZone:(NSZone * __nullable)zone
{
HTMLTextNode *copy = [super copyWithZone:zone];
[copy->_data setString:_data];
return copy;
}
@end
NS_ASSUME_NONNULL_END