Commit b54c3372 authored by Dominik Charousset's avatar Dominik Charousset

Add overload to parse with message + file name

parent f9409ea7
......@@ -115,6 +115,12 @@ public:
// -- modifiers --------------------------------------------------------------
/// Parses `args` as tuple of strings containing CLI options and tries to
/// open `ini_file_cstr` as INI formatted config file. The parsers tries to
/// open `caf-application.ini` if `ini_file_cstr` is `nullptr`.
actor_system_config& parse(message& args,
const char* ini_file_cstr = nullptr);
/// Parses `args` as tuple of strings containing CLI options
/// and `ini_stream` as INI formatted input stream.
actor_system_config& parse(message& args, std::istream& ini);
......@@ -123,10 +129,9 @@ public:
/// `ini_stream` as INI formatted input stream.
actor_system_config& parse(int argc, char** argv, std::istream& ini);
/// Parses the CLI options `{argc, argv}` and
/// tries to open `config_file_name` as INI formatted config file.
/// The parsers tries to open `caf-application.ini` if `config_file_name`
/// is `nullptr`.
/// Parses the CLI options `{argc, argv}` and tries to open `ini_file_cstr`
/// as INI formatted config file. The parsers tries to open
/// `caf-application.ini` if `ini_file_cstr` is `nullptr`.
actor_system_config& parse(int argc, char** argv,
const char* ini_file_cstr = nullptr);
......
......@@ -304,6 +304,14 @@ actor_system_config& actor_system_config::parse(int argc, char** argv,
return parse(args, ini);
}
actor_system_config& actor_system_config::parse(message& args,
const char* ini_file_cstr) {
if (ini_file_cstr == nullptr)
ini_file_cstr = "caf-application.ini";
std::ifstream ini{ini_file_cstr};
return parse(args, ini);
}
actor_system_config& actor_system_config::parse(message& args,
std::istream& ini) {
// (2) content of the INI file overrides hard-coded defaults
......
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