#include <scim_config_base.h>
Inheritance diagram for scim::ConfigBase:
Public Member Functions | |
Constructor and Destructor. | |
ConfigBase (const String &app_name=String("scim")) | |
Contrustor. | |
virtual | ~ConfigBase () |
Virtual destructor empty but ensures that dtor of all derived classes is virtual. | |
Pure virtual methods which should be implemented in derived classes. | |
virtual bool | valid () const =0 |
Check if this Config object is valid. | |
virtual bool | read (const String &key, String *ret) const =0 |
Read a string from the given key. | |
virtual bool | read (const String &key, int *ret) const =0 |
Read an int value from the given key. | |
virtual bool | read (const String &key, double *ret) const =0 |
Read a double value from the given key. | |
virtual bool | read (const String &key, bool *ret) const =0 |
Read a bool value from the given key. | |
virtual bool | read (const String &key, std::vector< String > *ret) const =0 |
Read a string list from the given key. | |
virtual bool | read (const String &key, std::vector< int > *ret) const =0 |
Read an int list from the given key. | |
virtual bool | write (const String &key, const String &value)=0 |
Write a string to the given key. | |
virtual bool | write (const String &key, int value)=0 |
Write an int value to the given key. | |
virtual bool | write (const String &key, double value)=0 |
Write a double value to the given key. | |
virtual bool | write (const String &key, bool value)=0 |
Write a bool value to the given key. | |
virtual bool | write (const String &key, const std::vector< String > &value)=0 |
Write a string list to the given key. | |
virtual bool | write (const String &key, const std::vector< int > &value)=0 |
Write an int list to the given key. | |
virtual bool | flush ()=0 |
Permanently writes all changes. | |
virtual bool | erase (const String &key)=0 |
Erase a key and its value. | |
virtual bool | reload ()=0 |
Reload the configurations from storage. | |
Other helper methods. | |
String | read (const String &key, const String &defVal=String()) const |
Read a string from the given key with a default fallback value. | |
int | read (const String &key, int defVal) const |
Read an int value from the given key with a default fallback value. | |
double | read (const String &key, double defVal) const |
Read a double value from the given key with a default fallback value. | |
bool | read (const String &key, bool defVal) const |
Read a bool value from the given key with a default fallback value. | |
std::vector< String > | read (const String &key, const std::vector< String > &defVal) const |
Read a string list from the given key with a default fallback value. | |
std::vector< int > | read (const String &key, const std::vector< int > &defVal) const |
Read an int list from the given key with a default fallback value. | |
const String & | get_app_name () const |
Get the application's name. | |
void | set_app_name (const String &name) |
Set the name of the current application. | |
Connection | signal_connect_reload (ConfigSlotVoid *slot) |
connect the given slot to the reload signal. | |
Static Public Member Functions | |
static ConfigPointer | set (const ConfigPointer &p_config) |
Set the default global Config object. | |
static ConfigPointer | get (bool create_on_demand=true, const String &default_module=String("")) |
Get the default global Config object. |
This is an interface class to access the configuration data. All of the SCIM objects which have configuration data should use this interface to store and load them.
Definition at line 87 of file scim_config_base.h.
|
Contrustor.
|
|
Virtual destructor empty but ensures that dtor of all derived classes is virtual.
|
|
Check if this Config object is valid.
Implemented in scim::DummyConfig. |
|
Read a string from the given key.
Implemented in scim::DummyConfig. |
|
Read an int value from the given key.
Implemented in scim::DummyConfig. |
|
Read a double value from the given key.
Implemented in scim::DummyConfig. |
|
Read a bool value from the given key.
Implemented in scim::DummyConfig. |
|
Read a string list from the given key.
Implemented in scim::DummyConfig. |
|
Read an int list from the given key.
Implemented in scim::DummyConfig. |
|
Write a string to the given key.
Implemented in scim::DummyConfig. |
|
Write an int value to the given key.
Implemented in scim::DummyConfig. |
|
Write a double value to the given key.
Implemented in scim::DummyConfig. |
|
Write a bool value to the given key.
Implemented in scim::DummyConfig. |
|
Write a string list to the given key.
Implemented in scim::DummyConfig. |
|
Write an int list to the given key.
Implemented in scim::DummyConfig. |
|
Permanently writes all changes.
Implemented in scim::DummyConfig. |
|
Erase a key and its value.
Implemented in scim::DummyConfig. |
|
Reload the configurations from storage. All modified keys after the last flush maybe lost. The derived method should call this base method after reload the configurations successfully, in order to emit the reload signal. The derived method should have some machanism to avoid reload again if there is no update after the previous reload.
Implemented in scim::DummyConfig. |
|
Read a string from the given key with a default fallback value. If failed to read from the given key, then return the given default value.
|
|
Read an int value from the given key with a default fallback value. If failed to read from the given key, then return the given default value.
|
|
Read a double value from the given key with a default fallback value. If failed to read from the given key, then return the given default value.
|
|
Read a bool value from the given key with a default fallback value. If failed to read from the given key, then return the given default value.
|
|
Read a string list from the given key with a default fallback value. If failed to read from the given key, then return the given default value.
|
|
Read an int list from the given key with a default fallback value. If failed to read from the given key, then return the given default value.
|
|
Get the application's name.
|
|
Set the name of the current application.
|
|
connect the given slot to the reload signal.
|
|
Set the default global Config object. There is only one global Config object in an application. All other objects should use it by default.
|
|
Get the default global Config object. The default global Config object can be set with function ConfigBase::set. If there is no default object set, a new object can be created if needed.
|