Refactored option inherit mode enum

This commit is contained in:
Bartek Kryza
2022-04-16 13:37:11 +02:00
parent 9cadf9c9fb
commit a7573d7deb
2 changed files with 5 additions and 5 deletions

View File

@@ -106,7 +106,7 @@ struct inheritable_diagram_options {
"include_relations_also_as_members", true};
option<filter> include{"include"};
option<filter> exclude{"exclude"};
option<plantuml> puml{"plantuml", option_inherit_mode::append};
option<plantuml> puml{"plantuml", option_inherit_mode::kAppend};
option<method_arguments> generate_method_arguments{
"generate_method_arguments", method_arguments::full};
option<bool> generate_packages{"generate_packages", false};

View File

@@ -22,17 +22,17 @@ namespace config {
template <typename T> void append_value(T &l, const T &r) { l = r; }
enum class option_inherit_mode { override, append };
enum class option_inherit_mode { kOverride, kAppend };
template <typename T> struct option {
option(const std::string &name_,
option_inherit_mode im = option_inherit_mode::override)
option_inherit_mode im = option_inherit_mode::kOverride)
: name{name_}
, value{}
{
}
option(const std::string &name_, const T &initial_value,
option_inherit_mode im = option_inherit_mode::override)
option_inherit_mode im = option_inherit_mode::kOverride)
: name{name_}
, value{initial_value}
, has_value{true}
@@ -49,7 +49,7 @@ template <typename T> struct option {
void override(const option<T> &o)
{
if (!is_declared && o.is_declared) {
if (inheritance_mode == option_inherit_mode::append)
if (inheritance_mode == option_inherit_mode::kAppend)
append_value(value, o.value);
else
value = o.value;