ObjFW  Diff

Differences From Artifact [44ccbfc4a0]:

To Artifact [56fd049fb8]:


15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38


39
40
41
42

43
44







45
46
47
48
49
50
51
15
16
17
18
19
20
21

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36


37
38
39
40
41

42
43

44
45
46
47
48
49
50
51
52
53
54
55
56
57







-
+














-
-
+
+



-
+

-
+
+
+
+
+
+
+







 * You should have received a copy of the GNU Lesser General Public License
 * version 3.0 along with this program. If not, see
 * <https://www.gnu.org/licenses/>.
 */

#import "OFObject.h"
#import "OFString.h"
#import "OFINICategory.h"
#import "OFINISection.h"

OF_ASSUME_NONNULL_BEGIN

@class OFIRI;
@class OFMutableArray OF_GENERIC(ObjectType);

/**
 * @class OFINIFile OFINIFile.h ObjFW/ObjFW.h
 *
 * @brief A class for reading, creating and modifying INI files.
 */
OF_SUBCLASSING_RESTRICTED
@interface OFINIFile: OFObject
{
	OFINICategory *_prologue;
	OFMutableArray OF_GENERIC(OFINICategory *) *_categories;
	OFINISection *_prologue;
	OFMutableArray OF_GENERIC(OFINISection *) *_sections;
}

/**
 * @brief All categories in the INI file.
 * @brief All sections in the INI file.
 */
@property (readonly, nonatomic) OFArray OF_GENERIC(OFINICategory *) *categories;
@property (readonly, nonatomic) OFArray OF_GENERIC(OFINISection *) *sections;

/**
 * @brief All sections in the INI file.
 */
@property (readonly, nonatomic) OFArray OF_GENERIC(OFINISection *) *categories
    OF_DEPRECATED(ObjFW, 1, 2, "Use -[sections] instead");

/**
 * @brief Creates a new OFINIFile with the contents of the specified file.
 *
 * @param IRI The IRI to the file whose contents the OFINIFile should contain
 *
 * @return A new, autoreleased OFINIFile with the contents of the specified file
99
100
101
102
103
104
105
106
107











108
109
110


111
112

113
114


115
116
117
118
119
120
121
105
106
107
108
109
110
111


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







-
-
+
+
+
+
+
+
+
+
+
+
+

-
-
+
+

-
+

-
+
+







 *				     encoding
 */
- (instancetype)initWithIRI: (OFIRI *)IRI
		   encoding: (OFStringEncoding)encoding
    OF_DESIGNATED_INITIALIZER;

/**
 * @brief Returns an @ref OFINICategory for the category with the specified
 *	  name.
 * @brief Returns an @ref OFINISection for the section with the specified name.
 *
 * @param name The name of the section for which an @ref OFINISection should be
 *	       returned
 *
 * @return An @ref OFINISection for the section with the specified name
 */
- (OFINISection *)sectionForName: (OFString *)name;

/**
 * @brief Returns an @ref OFINISection for the section with the specified name.
 *
 * @param name The name of the category for which an @ref OFINICategory should
 *	       be returned
 * @param name The name of the section for which an @ref OFINISection should be
 *	       returned
 *
 * @return An @ref OFINICategory for the category with the specified name
 * @return An @ref OFINISection for the section with the specified name
 */
- (OFINICategory *)categoryForName: (OFString *)name;
- (OFINISection *)categoryForName: (OFString *)name
    OF_DEPRECATED(ObjFW, 1, 2, "Use -[sectionForName:] instead");

/**
 * @brief Writes the contents of the OFINIFile to a file.
 *
 * @param IRI The IRI of the file to write to
 */
- (void)writeToIRI: (OFIRI *)IRI;