Differences From Artifact [408c66dded]:
- File
src/OFINIFile.m
— part of check-in
[0fead8a915]
at
2024-08-24 10:14:30
on branch trunk
— Rename OFINICategory to OFINISection
OFINICategory is provided as a deprecated subclass of OFINISection to
maintain API and ABI compatibility. (user: js, size: 4521) [annotate] [blame] [check-ins using]
To Artifact [6a07a21f7e]:
- File src/OFINIFile.m — part of check-in [dab4c26020] at 2024-08-24 10:25:56 on branch trunk — OFINISection: Allow values in global section (user: js, size: 4573) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
75 76 77 78 79 80 81 | } - (instancetype)initWithIRI: (OFIRI *)IRI encoding: (OFStringEncoding)encoding { self = [super init]; @try { | < | > < | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | } - (instancetype)initWithIRI: (OFIRI *)IRI encoding: (OFStringEncoding)encoding { self = [super init]; @try { _sections = [[OFMutableArray alloc] initWithObject: [[[OFINISection alloc] of_initWithName: @""] autorelease]]; [self of_parseIRI: IRI encoding: encoding]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_sections release]; [super dealloc]; } - (OFArray OF_GENERIC(OFINISection *) *)categories { |
︙ | ︙ | |||
126 127 128 129 130 131 132 | return [self sectionForName: name]; } - (void)of_parseIRI: (OFIRI *)IRI encoding: (OFStringEncoding)encoding { void *pool = objc_autoreleasePoolPush(); OFStream *file; | | | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | return [self sectionForName: name]; } - (void)of_parseIRI: (OFIRI *)IRI encoding: (OFStringEncoding)encoding { void *pool = objc_autoreleasePoolPush(); OFStream *file; OFINISection *section = nil; OFString *line; if (encoding == OFStringEncodingAutodetect) encoding = OFStringEncodingUTF8; @try { file = [OFIRIHandler openItemAtIRI: IRI mode: @"r"]; |
︙ | ︙ | |||
154 155 156 157 158 159 160 161 162 163 | OFString *sectionName; if (![line hasSuffix: @"]"]) @throw [OFInvalidFormatException exception]; sectionName = [line substringWithRange: OFMakeRange(1, line.length - 2)]; section = [[[OFINISection alloc] of_initWithName: sectionName] autorelease]; [_sections addObject: section]; | > > > | > > > > < < < | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | OFString *sectionName; if (![line hasSuffix: @"]"]) @throw [OFInvalidFormatException exception]; sectionName = [line substringWithRange: OFMakeRange(1, line.length - 2)]; if (sectionName.length == 0) @throw [OFInvalidFormatException exception]; section = [[[OFINISection alloc] of_initWithName: sectionName] autorelease]; [_sections addObject: section]; } else { if (section == nil) section = [self sectionForName: @""]; [section of_parseLine: line]; } } objc_autoreleasePoolPop(pool); } - (void)writeToIRI: (OFIRI *)IRI { [self writeToIRI: IRI encoding: OFStringEncodingUTF8]; } - (void)writeToIRI: (OFIRI *)IRI encoding: (OFStringEncoding)encoding { void *pool = objc_autoreleasePoolPush(); OFStream *file = [OFIRIHandler openItemAtIRI: IRI mode: @"w"]; bool first = true; for (OFINISection *section in _sections) if ([section of_writeToStream: file encoding: encoding first: first]) first = false; objc_autoreleasePoolPop(pool); |
︙ | ︙ |