Class Options
Defined in File options.hpp
Class Documentation
-
class Options
Options container and parsing methods.
Owns the various data objects.
Public Functions
Constructor.
The user info, recipients, and polling period values are optional if intraprocess is enabled. The curl verbose option is meaningless if intraprocess is enabled.
Not to be called directly: use
parse_options_from_*()
instead.- Parameters:
user_info – the user info, or
std::nullopt
if intraprocessrecipients – the recipients, or
std::nullopt
if intraprocesscurl_verbose – the curl verbose status
intraprocess – the intraprocess status
polling_period – the polling period
-
~Options()
-
std::optional<UserInfo::SharedPtrConst> get_user_info() const
Get user information data.
- Returns:
the
UserInfo
object, orstd::nullopt
-
std::optional<EmailRecipients::SharedPtrConst> get_recipients() const
Get email recipient data.
- Returns:
the
EmailRecipients
object, orstd::nullopt
-
bool curl_verbose() const
Get the curl verbose status.
- Returns:
true if verbose, false otherwise
-
bool intraprocess() const
Get the intraprocess status.
- Returns:
true if intraprocess, false otherwise
-
std::optional<std::chrono::nanoseconds> polling_period() const
Get the polling period value.
- Returns:
the polling period
Public Static Functions
-
static std::optional<std::shared_ptr<Options>> parse_options_from_args(int argc, char const *const argv[])
Parse options from CLI arguments.
- Parameters:
argc – the argument count
argv – the argument vector
- Returns:
the resulting
Options
object, orstd::nullopt
if it failed
-
static std::optional<std::shared_ptr<Options>> parse_options_from_file()
Parse options from config file.
It first tries to read
$EMAIL_CONFIG_FILE
, or$PWD/email.yml
if it is not set. If that does not work, it then tries to read from a backup file path:~/email.yml
.- Returns:
the resulting
Options
object, orstd::nullopt
if it failed