Differences From Artifact [8e99773efd]:
- File
src/OFINICategory.m
— part of check-in
[12c5b7ee91]
at
2014-06-12 13:43:41
on branch trunk
— OFINIFile: Add support for quoted keys / values
This is a much more logical way to handle leading and trailing
whitespaces and also seems to be used by a few other INI
implementations.Additionally, this imports OFINICategory.h in OFINIFile.h so that
importing OFINIFile.h is enough - this should be less confusing - and
allows opening non-existant files, treating them like an empty file. (user: js, size: 9255) [annotate] [blame] [check-ins using]
To Artifact [077a8d208b]:
- File src/OFINICategory.m — part of check-in [44de69ef31] at 2014-06-14 09:44:45 on branch trunk — OFINIFile: Add support for different encodings (user: js, size: 9386) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
406 407 408 409 410 411 412 413 414 415 416 417 418 419 | i++; } objc_autoreleasePoolPop(pool); } - (bool)OF_writeToStream: (OFStream*)stream first: (bool)first { OFEnumerator *enumerator; id line; if ([_lines count] == 0) return false; | > | 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | i++; } objc_autoreleasePoolPop(pool); } - (bool)OF_writeToStream: (OFStream*)stream encoding: (of_string_encoding_t)encoding first: (bool)first { OFEnumerator *enumerator; id line; if ([_lines count] == 0) return false; |
︙ | ︙ | |||
428 429 430 431 432 433 434 435 | if ([line isKindOfClass: [OFINICategory_Comment class]]) { OFINICategory_Comment *comment = line; [stream writeLine: comment->_comment]; } else if ([line isKindOfClass: [OFINICategory_Pair class]]) { OFINICategory_Pair *pair = line; OFString *key = escapeString(pair->_key); OFString *value = escapeString(pair->_value); | > > | > | 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | if ([line isKindOfClass: [OFINICategory_Comment class]]) { OFINICategory_Comment *comment = line; [stream writeLine: comment->_comment]; } else if ([line isKindOfClass: [OFINICategory_Pair class]]) { OFINICategory_Pair *pair = line; OFString *key = escapeString(pair->_key); OFString *value = escapeString(pair->_value); OFString *line = [OFString stringWithFormat: @"%@=%@\n", key, value]; [stream writeString: line encoding: encoding]; } else @throw [OFInvalidArgumentException exception]; } return true; } @end |