You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Accepts: An application id, id, an application name, name, an application english short name, englishShortName, and the application log level, logLevel.
184
-
- Returns: True if initialized, else false.
185
-
- Throws: `std::runtime_error` if the gettext system fails to initialize.
186
-
- Throws: `std::runtime_error` if unable to get the executable directory path.
187
-
- Note: This also calls Localization::Gettext::init().
- Accepts: The name of the documentation page to get the help url for, pageName.
200
-
- Returns: The url for the documentation page. This will be a yelp url for Linux and a website url for Windows and Linux snaps.
201
-
- Note: HtmlDocsStore should be set for Aura::getActive()::getAppInfo(). For Nickvision apps, this will be: `https://raw.githubusercontent.com/NickvisionApps/SHORT_APP_NAME/main/APP_NAME.Shared/Docs/html`, but can be customized for any app.
202
-
- ```cpp
203
-
T& getConfig<T>(const std::string& key)
204
-
```
205
-
- Accepts: The string key of the config file, key.
206
-
- Returns: A reference to the configuration object of type T with key key.
207
-
- Throws: `std::invalid_argument` if key is empty
208
-
- Note: T must be a type that derives from `Nickvision::ConfigurationBase`
209
-
- Ex: `getConfig<Configuration>("config")` will return the `Configuration` object parsed from a `config.json` file on disk.
- Constructs the ConfigurationBase, loading the file from disk
251
-
- Accepts: The key of the configuration file, key
252
-
- Throws: `std::invalid_argument` if key is empty
153
+
- Constructs the DataFileBase, loading the file from disk.
154
+
- Accepts: The key of the configuration file, key, and the name of the app the file belongs to.
155
+
- Throws: `std::invalid_argument` if key is empty.
253
156
- ```cpp
254
157
bool save()
255
158
```
256
-
- Returns: `true` if the configuration file was saved to disk
257
-
- Returns: `false` if saving to disk failed
159
+
- Returns: `true` if the configuration file was saved to disk.
160
+
- Returns: `false` if saving to disk failed.
258
161
259
-
### Creating Your Own Configuration Files
260
-
The purpose of `ConfigurationBase` is to act as a base when defining your own configuration objects that you would like to be saved and retrieved from disk.
162
+
### Creating Your Own Data Files
163
+
The purpose of `DataFileBase` is to act as a base when defining your own data objects that you would like to be saved and retrieved from disk.
261
164
262
165
Here are some key points when defining your own configuration objects:
263
-
- Your configuration object's constructor must take a `const std::string& key`parameter and pass it to `ConfigurationBase`'s constructor.
264
-
- Although you will not use keyin your own implementation, it is required for `ConfigurationBase`'s functionality and will be filled-in by the `Aura::getConfig()` method.
265
-
-`ConfigurationBase` exposes a protected `m_json` object which you must use in your implementation of getting and storing variables of your configuration object.
266
-
- If this `m_json` object is not used, your configuration object will not be stored to disk correctly.
267
-
- You must explicitly call the `save` method on your configuration object when you want to save the configuration to disk. Writing to the `m_json` object is not enough to trigger saving the file on disk
166
+
- Your data object's constructor must take `const std::string& key`and `const std::string& appName` parameters and pass it to `DataFileBase`'s constructor.
167
+
- Although you will not use `key` and `appName`in your own implementation, it is required for `DataFileBase`'s functionality and will be filled-in by the `DataFileManager`.
168
+
-`DataFileBase` exposes a protected `m_json` object which you must use in your implementation of getting and storing variables of your data object.
169
+
- If this `m_json` object is not used, your data object will not be stored to disk correctly.
170
+
- You must explicitly call the `save` method on your configuration object when you want to save the configuration to disk. Writing to the `m_json` object is not enough to trigger saving the file on disk.
268
171
269
-
Here is an example of a custom configuration object using `ConfigurationBase`:
172
+
Here is an example of a custom configuration object using `DataFileBase`:
0 commit comments