ObjFW
OFINIFile.h
1 /*
2  * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License version 3.0 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13  * version 3.0 for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * version 3.0 along with this program. If not, see
17  * <https://www.gnu.org/licenses/>.
18  */
19 
20 #import "OFObject.h"
21 #import "OFString.h"
22 #import "OFINISection.h"
23 
24 OF_ASSUME_NONNULL_BEGIN
25 
26 @class OFIRI;
27 @class OFMutableArray OF_GENERIC(ObjectType);
28 
34 OF_SUBCLASSING_RESTRICTED
35 @interface OFINIFile: OFObject
36 {
37  OFMutableArray OF_GENERIC(OFINISection *) *_sections;
38 }
39 
43 @property (readonly, nonatomic) OFArray OF_GENERIC(OFINISection *) *sections;
44 
50 @property (readonly, nonatomic) OFArray OF_GENERIC(OFINISection *) *categories
51  OF_DEPRECATED(ObjFW, 1, 2, "Use -[sections] instead");
52 
64 + (instancetype)fileWithIRI: (OFIRI *)IRI;
65 
78 + (instancetype)fileWithIRI: (OFIRI *)IRI encoding: (OFStringEncoding)encoding;
79 
80 - (instancetype)init OF_UNAVAILABLE;
81 
94 - (instancetype)initWithIRI: (OFIRI *)IRI;
95 
108 - (instancetype)initWithIRI: (OFIRI *)IRI
109  encoding: (OFStringEncoding)encoding
110  OF_DESIGNATED_INITIALIZER;
111 
120 - (OFINISection *)sectionForName: (OFString *)name;
121 
132 - (OFINISection *)categoryForName: (OFString *)name
133  OF_DEPRECATED(ObjFW, 1, 2, "Use -[sectionForName:] instead");
134 
140 - (void)writeToIRI: (OFIRI *)IRI;
141 
149 - (void)writeToIRI: (OFIRI *)IRI encoding: (OFStringEncoding)encoding;
150 @end
151 
152 OF_ASSUME_NONNULL_END
An abstract class for storing objects in an array.
Definition: OFArray.h:107
OFStringEncoding
The encoding of a string.
Definition: OFString.h:65
The root class for all other classes inside ObjFW.
Definition: OFObject.h:690
An abstract class for storing, adding and removing objects in an array.
Definition: OFMutableArray.h:47
A class for handling strings.
Definition: OFString.h:142
A class for representing IRIs, URIs, URLs and URNs, for parsing them as well as accessing parts of th...
Definition: OFIRI.h:39
A class for representing a section of an INI file.
Definition: OFINISection.h:33
A class for reading, creating and modifying INI files.
Definition: OFINIFile.h:35