Commit 91c09159 authored by Matt Renaud's avatar Matt Renaud

Added Setting constructor taking a std::string.

To address hyperrealm/libconfig#2, a constructor has been added to the
header and source file.
parent c2e588c9
......@@ -363,6 +363,8 @@ class LIBCONFIGXX_API Config
public:
Config();
Config(std::string const& cfgFile);
virtual ~Config();
void setAutoConvert(bool flag);
......
......@@ -312,6 +312,17 @@ Config::Config()
// ---------------------------------------------------------------------------
Config::Config(std::string const& cfgFile)
: _defaultFormat(Setting::FormatDefault)
{
_config = new config_t;
config_init(_config);
config_set_destructor(_config, ConfigDestructor);
readFile(cfgFile.c_str());
}
// ---------------------------------------------------------------------------
Config::~Config()
{
config_destroy(_config);
......@@ -623,7 +634,7 @@ void Setting::setFormat(Format format) throw()
// ---------------------------------------------------------------------------
Setting::operator bool() const throw(SettingTypeException)
Setting::operator bool() const throw(SettingTypeException)
{
assertType(TypeBoolean);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment