The setting has four parts: module name, Username, password and database.
They will be stored in a text file. Each part will be separated by a colon.
Module name is regarded as the primary key here. The password is encrypted.
Definition at line 64 of file setting.h.
OSB_LIB::Setting::Setting | ( | const std::string & | module | ) | [inline, explicit] |
void OSB_LIB::Setting::append | ( | std::fstream & | f | ) | const [private] |
Append module name, Username, password and database into file stream.
f | Destination file stream. |
int OSB_LIB::Setting::checkModule | ( | std::fstream & | f | ) | [private] |
Check whether the module is in the setting file.
f | Source file stream. |
const std::string& OSB_LIB::Setting::database | ( | ) | const [inline] |
void OSB_LIB::Setting::delSetting | ( | ) |
Delete the setting from the configuration file.
The file path must be set before calling this method (By calling getWritePath()). User also should confirm if the path is correct by check the return value of the getWritePath(). This method will not check whether there is any error when open the file.
RetValue OSB_LIB::Setting::getWritePath | ( | const std::string & | path | ) |
Get the path of the osb.cfg to be wrote.
It will create a new file if it does not exist.
path | The path (with filename) of the config file. |
const std::string& OSB_LIB::Setting::moduleName | ( | ) | const [inline] |
const std::string& OSB_LIB::Setting::password | ( | ) | const [inline] |
const std::string& OSB_LIB::Setting::path | ( | ) | const |
Access path of the file which stores the setting.
Path includes file name.
void OSB_LIB::Setting::readSetting | ( | ) |
Read the setting from setting file based on the given module name.
OsbException | if the configuration file is not found in any of the possible directories. | |
OsbException | if the module is not found. | |
OsbException | if username is empty. | |
OsbException | if database is empty. | |
OsbException | if password is corrupted. |
void OSB_LIB::Setting::removeLine | ( | std::fstream & | f, | |
int | line | |||
) | [private] |
Remove a specific line of setting.
f | Source file stream. | |
line | Number of the line to be removed. |
void OSB_LIB::Setting::replaceLine | ( | std::fstream & | f, | |
int | line | |||
) | [private] |
Replace the specific line for new setting.
f | Source file stream. | |
line | Number of the line to be replaced. |
void OSB_LIB::Setting::setDatabase | ( | const std::string & | db | ) | [inline] |
void OSB_LIB::Setting::setDir | ( | Directories & | dirs | ) |
Set all the possible paths of the file which stores the setting.
dirs | Directories of the file. |
void OSB_LIB::Setting::setModuleName | ( | const std::string & | mn | ) | [inline] |
void OSB_LIB::Setting::setPassword | ( | const std::string & | pw | ) | [inline] |
void OSB_LIB::Setting::setUserName | ( | const std::string & | un | ) | [inline] |
void OSB_LIB::Setting::showDir | ( | std::ostream & | os | ) | const |
Write the file name and a list of all directories searched to write it to.
os | output stream to write to. |
const std::string& OSB_LIB::Setting::userName | ( | ) | const [inline] |
void OSB_LIB::Setting::writeSetting | ( | ) |
Write the setting into setting file.
The file path must be set before calling this method (By calling getWritePath()). User also should confirm if the path is correct by check the return value of the getWritePath(). This method will not check whether there is any error when open the file.
std::string OSB_LIB::Setting::database_ [private] |
Database of setting.
Definition at line 179 of file setting.h.
Referenced by database(), and setDatabase().
const std::string OSB_LIB::Setting::fileName_ [static, private] |
std::string OSB_LIB::Setting::moduleName_ [private] |
Module name of setting.
Definition at line 176 of file setting.h.
Referenced by moduleName(), and setModuleName().
std::string OSB_LIB::Setting::password_ [private] |
Password of setting.
Definition at line 178 of file setting.h.
Referenced by password(), and setPassword().
std::string OSB_LIB::Setting::path_ [private] |
std::string OSB_LIB::Setting::userName_ [private] |
Username of setting.
Definition at line 177 of file setting.h.
Referenced by setUserName(), and userName().