Classes | |
class | DBListType |
Public Member Functions | |
ConfigFile (Barry::Pin pin) | |
Loads config file for the given pin, and ends up in an unenlightened state. | |
ConfigFile (Barry::Pin pin, const Barry::DatabaseDatabase &db) | |
Opens and loads config file for given pin, and calls Enlighten Throws ConfigFileError on error. | |
bool | Save () |
Saves current device's config, overwriting or creating a config file. | |
void | Enlighten (const Barry::DatabaseDatabase &db) |
Compares a given databasedatabase from a real device with the current config. | |
void | SetBackupList (const DBListType &list) |
Sets list with new config. | |
Static Public Member Functions | |
static bool | CheckPath (const std::string &path, std::string *perr=0) |
Checks that the path in path exists, and if not, creates it. | |
Protected Member Functions | |
void | Load () |
Attempt to load the configuration file, but do not fail if not available. |
Definition at line 32 of file configfile.h.
Barry::ConfigFile::ConfigFile | ( | Barry::Pin | pin | ) | [explicit] |
Loads config file for the given pin, and ends up in an unenlightened state.
Throws ConfigFileError on error, but it is not an error if the config does not exist. Never use this if you have a DatabaseDatabase object! This ctor is only for temporary loading of config data.
Definition at line 56 of file configfile.cc.
References Load().
Barry::ConfigFile::ConfigFile | ( | Barry::Pin | pin, | |
const Barry::DatabaseDatabase & | db | |||
) |
Opens and loads config file for given pin, and calls Enlighten Throws ConfigFileError on error.
Should never fail unless passed a bad pin, or if unable to get current user info.
Should never fail unless passed a bad pin.
Definition at line 72 of file configfile.cc.
References Enlighten(), and Load().
bool Barry::ConfigFile::CheckPath | ( | const std::string & | path, | |
std::string * | perr = 0 | |||
) | [static] |
Checks that the path in path exists, and if not, creates it.
Returns false if unable to create path, true if ok.
Definition at line 286 of file configfile.cc.
Referenced by Load(), Barry::GlobalConfigFile::Save(), and Save().
void Barry::ConfigFile::Enlighten | ( | const Barry::DatabaseDatabase & | db | ) |
Compares a given databasedatabase from a real device with the current config.
If not yet configured, initialize with valid defaults.
Definition at line 223 of file configfile.cc.
Referenced by ConfigFile().
void Barry::ConfigFile::Load | ( | ) | [protected] |
Attempt to load the configuration file, but do not fail if not available.
Definition at line 121 of file configfile.cc.
References CheckPath().
Referenced by ConfigFile().
bool Barry::ConfigFile::Save | ( | ) |
Saves current device's config, overwriting or creating a config file.
Definition at line 182 of file configfile.cc.
References CheckPath().
void Barry::ConfigFile::SetBackupList | ( | const DBListType & | list | ) |
Sets list with new config.
Definition at line 251 of file configfile.cc.