ObjFW
OFSettings.h
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
3  * Jonathan Schleifer <js@webkeks.org>
4  *
5  * All rights reserved.
6  *
7  * This file is part of ObjFW. It may be distributed under the terms of the
8  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
9  * the packaging of this file.
10  *
11  * Alternatively, it may be distributed under the terms of the GNU General
12  * Public License, either version 2 or 3, which can be found in the file
13  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
14  * file.
15  */
16 
17 #import "OFObject.h"
18 
19 OF_ASSUME_NONNULL_BEGIN
20 
21 @class OFString;
22 @class OFArray OF_GENERIC(ObjectType);
23 
35 @interface OFSettings: OFObject
36 {
37  OFString *_applicationName;
38 }
39 
40 #ifdef OF_HAVE_PROPERTIES
41 @property (readonly, copy) OFString *applicationName;
42 #endif
43 
52 + (instancetype)settingsWithApplicationName: (OFString*)applicationName;
53 
62 - initWithApplicationName: (OFString*)applicationName;
63 
71 - (OFString*)applicationName;
72 
79 - (void)setString: (OFString*)string
80  forPath: (OFString*)path;
81 
88 - (void)setInteger: (intmax_t)integer
89  forPath: (OFString*)path;
90 
97 - (void)setBool: (bool)bool_
98  forPath: (OFString*)path;
99 
106 - (void)setFloat: (float)float_
107  forPath: (OFString*)path;
108 
115 - (void)setDouble: (double)double_
116  forPath: (OFString*)path;
117 
124 - (void)setArray: (OFArray OF_GENERIC(OFString*)*)array
125  forPath: (OFString*)path;
126 
134 - (nullable OFString*)stringForPath: (OFString*)path;
135 
144 - (nullable OFString*)stringForPath: (OFString*)path
145  defaultValue: (nullable OFString*)defaultValue;
146 
155 - (intmax_t)integerForPath: (OFString*)path
156  defaultValue: (intmax_t)defaultValue;
157 
166 - (bool)boolForPath: (OFString*)path
167  defaultValue: (bool)defaultValue;
168 
177 - (float)floatForPath: (OFString*)path
178  defaultValue: (float)defaultValue;
179 
188 - (double)doubleForPath: (OFString*)path
189  defaultValue: (double)defaultValue;
190 
198 - (OFArray OF_GENERIC(OFString*)*)arrayForPath: (OFString*)path;
199 
205 - (void)removeValueForPath: (OFString*)path;
206 
215 - (void)save;
216 @end
217 
218 OF_ASSUME_NONNULL_END
An abstract class for storing objects in an array.
Definition: OFArray.h:95
The root class for all other classes inside ObjFW.
Definition: OFObject.h:364
A class for handling strings.
Definition: OFString.h:91
A class for storing and retrieving settings.
Definition: OFSettings.h:35