Differences From Artifact [68683c719e]:
- File src/OFINIFile.m — part of check-in [9d6adbf3d9] at 2014-02-17 20:51:50 on branch trunk — Move OFINICategory to separate file (user: js, size: 3482) [annotate] [blame] [check-ins using]
To Artifact [38c671870e]:
- File
src/OFINIFile.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: 3681) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #import "OFArray.h" #import "OFString.h" #import "OFFile.h" #import "OFINICategory.h" #import "OFINICategory+Private.h" #import "OFInvalidFormatException.h" #import "autorelease.h" #import "macros.h" @interface OFINIFile (OF_PRIVATE_CATEGORY) - (void)OF_parseFile: (OFString*)path; @end | > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #import "OFArray.h" #import "OFString.h" #import "OFFile.h" #import "OFINICategory.h" #import "OFINICategory+Private.h" #import "OFInvalidFormatException.h" #import "OFOpenFileFailedException.h" #import "autorelease.h" #import "macros.h" @interface OFINIFile (OF_PRIVATE_CATEGORY) - (void)OF_parseFile: (OFString*)path; @end |
︙ | ︙ | |||
111 112 113 114 115 116 117 | return [category autorelease]; } - (void)OF_parseFile: (OFString*)path { void *pool = objc_autoreleasePoolPush(); | | < > > > > > > > > > > > | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | return [category autorelease]; } - (void)OF_parseFile: (OFString*)path { void *pool = objc_autoreleasePoolPush(); OFFile *file; OFINICategory *category = nil; OFString *line; @try { file = [OFFile fileWithPath: path mode: @"r"]; } @catch (OFOpenFileFailedException *e) { /* Handle missing file like an empty file */ if ([e errNo] == ENOENT) return; @throw e; } while ((line = [file readLine]) != nil) { if (isWhitespaceLine(line)) continue; if ([line hasPrefix: @"["]) { OFString *categoryName; |
︙ | ︙ |