70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
unescapeString(OFString *string)
{
OFMutableString *mutableString;
if (![string hasPrefix: @"\""] || ![string hasSuffix: @"\""])
return string;
string = [string substringWithRange: of_range(1, string.length - 2)];
mutableString = [[string mutableCopy] autorelease];
[mutableString replaceOccurrencesOfString: @"\\f" withString: @"\f"];
[mutableString replaceOccurrencesOfString: @"\\r" withString: @"\r"];
[mutableString replaceOccurrencesOfString: @"\\n" withString: @"\n"];
[mutableString replaceOccurrencesOfString: @"\\\"" withString: @"\""];
[mutableString replaceOccurrencesOfString: @"\\\\" withString: @"\\"];
|
|
|
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
unescapeString(OFString *string)
{
OFMutableString *mutableString;
if (![string hasPrefix: @"\""] || ![string hasSuffix: @"\""])
return string;
string = [string substringWithRange: OFRangeMake(1, string.length - 2)];
mutableString = [[string mutableCopy] autorelease];
[mutableString replaceOccurrencesOfString: @"\\f" withString: @"\f"];
[mutableString replaceOccurrencesOfString: @"\\r" withString: @"\r"];
[mutableString replaceOccurrencesOfString: @"\\n" withString: @"\n"];
[mutableString replaceOccurrencesOfString: @"\\\"" withString: @"\""];
[mutableString replaceOccurrencesOfString: @"\\\\" withString: @"\\"];
|
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
{
if (![line hasPrefix: @";"]) {
OFINICategoryPair *pair =
[[[OFINICategoryPair alloc] init] autorelease];
OFString *key, *value;
size_t pos;
if ((pos = [line rangeOfString: @"="].location) == OF_NOT_FOUND)
@throw [OFInvalidFormatException exception];
key = unescapeString([line substringToIndex: pos]
.stringByDeletingEnclosingWhitespaces);
value = unescapeString([line substringFromIndex: pos + 1]
.stringByDeletingEnclosingWhitespaces);
|
|
|
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
{
if (![line hasPrefix: @";"]) {
OFINICategoryPair *pair =
[[[OFINICategoryPair alloc] init] autorelease];
OFString *key, *value;
size_t pos;
if ((pos = [line rangeOfString: @"="].location) == OFNotFound)
@throw [OFInvalidFormatException exception];
key = unescapeString([line substringToIndex: pos]
.stringByDeletingEnclosingWhitespaces);
value = unescapeString([line substringFromIndex: pos + 1]
.stringByDeletingEnclosingWhitespaces);
|
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
|
}
}
objc_autoreleasePoolPop(pool);
}
- (bool)of_writeToStream: (OFStream *)stream
encoding: (of_string_encoding_t)encoding
first: (bool)first
{
if (_lines.count == 0)
return false;
if (first)
[stream writeFormat: @"[%@]\r\n", _name];
|
|
|
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
|
}
}
objc_autoreleasePoolPop(pool);
}
- (bool)of_writeToStream: (OFStream *)stream
encoding: (OFStringEncoding)encoding
first: (bool)first
{
if (_lines.count == 0)
return false;
if (first)
[stream writeFormat: @"[%@]\r\n", _name];
|