|
libcrn
3.9.5
A document image processing library
|
Configuration file management utility class. More...
#include <CRNConfigurationFile.h>
Public Member Functions | |
| ConfigurationFile (const String &application_name, const StringUTF8 &file_name="", ConfigurationType ctype=ConfigurationType::APP) | |
| Constructor. More... | |
| ConfigurationFile (const ConfigurationFile &)=delete | |
| ConfigurationFile (ConfigurationFile &&)=default | |
| ConfigurationFile & | operator= (const ConfigurationFile &)=delete |
| ConfigurationFile & | operator= (ConfigurationFile &&)=default |
| Path | Load () |
| Loads the file. More... | |
| Path | Save () |
| Saves the file to the user's personal space. More... | |
| SObject & | operator[] (const String &key) |
| Gets a value. More... | |
| SObject | GetData (const String &key) |
| Gets a value. More... | |
| SCObject | GetData (const String &key) const |
| Gets a value. More... | |
| Path | GetPath (const String &key) const |
| Gets a path. More... | |
| String | GetString (const String &key) const |
| Gets a string. More... | |
| StringUTF8 | GetStringUTF8 (const String &key) const |
| Gets a UTF8 string. More... | |
| Prop3 | GetProp3 (const String &key) const |
| Gets a Prop3. More... | |
| int | GetInt (const String &key) const |
| Gets an int. More... | |
| double | GetDouble (const String &key) const |
| Gets a double. More... | |
| template<typename T > | |
| void | SetData (const String &key, T value) |
| Sets a key/value pair. More... | |
| Path | GetUserDirectory () const |
| Returns the path to the user configuration directory. More... | |
Configuration file management utility class.
Configuration file management utility class
Definition at line 43 of file CRNConfigurationFile.h.
| ConfigurationFile::ConfigurationFile | ( | const String & | application_name, |
| const StringUTF8 & | file_name = "", |
||
| ConfigurationType | ctype = ConfigurationType::APP |
||
| ) |
Constructor.
Constructor
| [in] | application_name | the name of the application |
| [in] | file_name | the name of the configuration file. If empty, the application name is used |
Definition at line 43 of file CRNConfigurationFile.cpp.
|
delete |
|
default |
| SObject ConfigurationFile::GetData | ( | const String & | key | ) |
Gets a value.
Gets a value
| [in] | key | the key of the value to get |
Definition at line 136 of file CRNConfigurationFile.cpp.
| SCObject ConfigurationFile::GetData | ( | const String & | key | ) | const |
Gets a value.
Gets a value
| [in] | key | the key of the value to get |
Definition at line 149 of file CRNConfigurationFile.cpp.
| double ConfigurationFile::GetDouble | ( | const String & | key | ) | const |
Gets a double.
Gets a double
| ExceptionInvalidArgument | key does not point to a double |
| [in] | key | the key of the value to get |
Definition at line 237 of file CRNConfigurationFile.cpp.
| int ConfigurationFile::GetInt | ( | const String & | key | ) | const |
Gets an int.
Gets an int
| ExceptionInvalidArgument | key does not point to an int |
| [in] | key | the key of the value to get |
Definition at line 224 of file CRNConfigurationFile.cpp.
Gets a path.
Gets a path
| ExceptionInvalidArgument | key does not point to a Path |
| [in] | key | the key of the value to get |
Definition at line 163 of file CRNConfigurationFile.cpp.
Gets a Prop3.
Gets a Prop3
| ExceptionInvalidArgument | key does not point to a Prop3 |
| [in] | key | the key of the value to get |
Definition at line 211 of file CRNConfigurationFile.cpp.
Gets a string.
Gets a string
| ExceptionInvalidArgument | key does not point to a String |
| [in] | key | the key of the value to get |
Definition at line 185 of file CRNConfigurationFile.cpp.
| StringUTF8 ConfigurationFile::GetStringUTF8 | ( | const String & | key | ) | const |
Gets a UTF8 string.
Gets a utf8 string
| ExceptionInvalidArgument | key does not point to a StringUTF8 |
| [in] | key | the key of the value to get |
Definition at line 198 of file CRNConfigurationFile.cpp.
| Path ConfigurationFile::GetUserDirectory | ( | ) | const |
Returns the path to the user configuration directory.
Returns the path to the user configuration directory
Definition at line 248 of file CRNConfigurationFile.cpp.
| Path ConfigurationFile::Load | ( | ) |
Loads the file.
Loads the file from the following places
Definition at line 58 of file CRNConfigurationFile.cpp.
|
delete |
|
default |
| SObject & ConfigurationFile::operator[] | ( | const String & | key | ) |
Gets a value.
Gets a value. If the key does not exist, creates a key/value pair.
| [in] | key | the key of the value to get |
Definition at line 127 of file CRNConfigurationFile.cpp.
| Path ConfigurationFile::Save | ( | ) |
Saves the file to the user's personal space.
Saves the file to the user's personal space (unix: $HOME/.config, win: APPDATA%)
Definition at line 104 of file CRNConfigurationFile.cpp.
|
inline |
Sets a key/value pair.
| ExceptionProtocol | value is not serializable |
Definition at line 79 of file CRNConfigurationFile.h.
1.8.6