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