/Configuration.cpp Secret
Last active
September 21, 2018 03:32
BackupUtil - Write content into XML with Boost Property Tree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Configuration::Configuration() | |
{ | |
try { | |
boost::property_tree::read_xml(filesystem::current_path().string() + GENERIC_PATH_SEPARATOR + INDEX_FILENAME, backupConfig); | |
} | |
catch( const boost::property_tree::ptree_error &e ) { | |
cout << e.what() << endl; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Configuration | |
{ | |
private: | |
Configuration(); | |
public: | |
static Configuration* getInstance() | |
{ | |
if( !instance ) | |
instance = new Configuration(); | |
return instance; | |
} | |
inline void updateConfiguration(string configPath) | |
{ | |
boost::property_tree::write_xml(configPath, backupConfig); | |
} | |
boost::property_tree::ptree readConfigFile(); | |
boost::property_tree::ptree readConfigFile(string configPath); | |
public: | |
boost::property_tree::ptree getBackupConfig() const { return backupConfig; } | |
private: | |
static Configuration *instance; | |
boost::property_tree::ptree backupConfig; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment