1
2
3
4
5
6
7
8
9
|
1
2
3
4
5
6
7
8
9
|
-
+
|
/*
* Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
|
| ︙ | | |
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
|
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
@implementation OFConstantUTF8String
+ (instancetype)alloc
{
OF_UNRECOGNIZED_SELECTOR
}
- (instancetype)retain
{
return self;
}
OF_SINGLETON_METHODS
- (instancetype)autorelease
{
return self;
}
- (unsigned int)retainCount
{
return OFMaxRetainCount;
}
- (void)release
{
}
- (void)dealloc
{
OF_DEALLOC_UNSUPPORTED
}
@end
@implementation OFConstantString
+ (void)load
{
#if defined(OF_APPLE_RUNTIME) && !defined(__OBJC2__)
/*
|
| ︙ | | |
131
132
133
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
160
161
162
163
164
165
166
167
|
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
}
+ (instancetype)alloc
{
OF_UNRECOGNIZED_SELECTOR
}
- (instancetype)retain
{
return self;
}
OF_SINGLETON_METHODS
- (instancetype)autorelease
{
return self;
}
- (unsigned int)retainCount
{
return OFMaxRetainCount;
}
- (void)release
{
}
- (void)dealloc
{
OF_DEALLOC_UNSUPPORTED
}
/*
* In all following methods, the constant string is converted to an
* OFConstantUTF8String and the message sent again.
*/
/* From protocol OFCopying */
|
| ︙ | | |
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
|
501
502
503
504
505
506
507
508
509
510
511
512
513
514
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
- (OFData *)dataWithEncoding: (OFStringEncoding)encoding
{
[self finishInitialization];
return [self dataWithEncoding: encoding];
}
#ifdef OF_HAVE_UNICODE_TABLES
- (OFString *)decomposedStringWithCanonicalMapping
{
[self finishInitialization];
return self.decomposedStringWithCanonicalMapping;
}
- (OFString *)decomposedStringWithCompatibilityMapping
{
[self finishInitialization];
return self.decomposedStringWithCompatibilityMapping;
}
#endif
#ifdef OF_WINDOWS
- (OFString *)stringByExpandingWindowsEnvironmentStrings
{
[self finishInitialization];
return self.stringByExpandingWindowsEnvironmentStrings;
}
#endif
|
| ︙ | | |
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
|
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
|
-
+
-
+
-
+
-
+
|
- (void)writeToFile: (OFString *)path encoding: (OFStringEncoding)encoding
{
[self finishInitialization];
[self writeToFile: path encoding: encoding];
}
#endif
- (void)writeToURI: (OFURI *)URI
- (void)writeToIRI: (OFIRI *)IRI
{
[self finishInitialization];
[self writeToURI: URI];
[self writeToIRI: IRI];
}
- (void)writeToURI: (OFURI *)URI encoding: (OFStringEncoding)encoding
- (void)writeToIRI: (OFIRI *)IRI encoding: (OFStringEncoding)encoding
{
[self finishInitialization];
[self writeToURI: URI encoding: encoding];
[self writeToIRI: IRI encoding: encoding];
}
#ifdef OF_HAVE_BLOCKS
- (void)enumerateLinesUsingBlock: (OFStringLineEnumerationBlock)block
{
[self finishInitialization];
[self enumerateLinesUsingBlock: block];
}
#endif
@end
|