150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
[_lines release];
[super dealloc];
}
- (void)of_parseLine: (OFString *)line
{
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]
|
|
|
<
>
>
|
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
[_lines release];
[super dealloc];
}
- (void)of_parseLine: (OFString *)line
{
if (![line hasPrefix: @";"] && ![line hasPrefix: @"#"]) {
OFINICategoryPair *pair;
OFString *key, *value;
size_t pos;
pair = [[[OFINICategoryPair alloc] init] autorelease];
if ((pos = [line rangeOfString: @"="].location) == OFNotFound)
@throw [OFInvalidFormatException exception];
key = unescapeString([line substringToIndex: pos]
.stringByDeletingEnclosingWhitespaces);
value = unescapeString([line substringFromIndex: pos + 1]
|
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
|
- (bool)of_writeToStream: (OFStream *)stream
encoding: (OFStringEncoding)encoding
first: (bool)first
{
if (_lines.count == 0)
return false;
if (first)
[stream writeFormat: @"[%@]\r\n", _name];
else
[stream writeFormat: @"\r\n[%@]\r\n", _name];
for (id line in _lines) {
if ([line isKindOfClass: [OFINICategoryComment class]]) {
OFINICategoryComment *comment = line;
[stream writeFormat: @"%@\r\n", comment->_comment];
} else if ([line isKindOfClass: [OFINICategoryPair class]]) {
OFINICategoryPair *pair = line;
|
>
|
|
|
|
>
|
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
|
- (bool)of_writeToStream: (OFStream *)stream
encoding: (OFStringEncoding)encoding
first: (bool)first
{
if (_lines.count == 0)
return false;
if (_name.length > 0) {
if (first)
[stream writeFormat: @"[%@]\r\n", _name];
else
[stream writeFormat: @"\r\n[%@]\r\n", _name];
}
for (id line in _lines) {
if ([line isKindOfClass: [OFINICategoryComment class]]) {
OFINICategoryComment *comment = line;
[stream writeFormat: @"%@\r\n", comment->_comment];
} else if ([line isKindOfClass: [OFINICategoryPair class]]) {
OFINICategoryPair *pair = line;
|