Refactored option inherit mode enum
This commit is contained in:
@@ -106,7 +106,7 @@ struct inheritable_diagram_options {
|
|||||||
"include_relations_also_as_members", true};
|
"include_relations_also_as_members", true};
|
||||||
option<filter> include{"include"};
|
option<filter> include{"include"};
|
||||||
option<filter> exclude{"exclude"};
|
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{
|
option<method_arguments> generate_method_arguments{
|
||||||
"generate_method_arguments", method_arguments::full};
|
"generate_method_arguments", method_arguments::full};
|
||||||
option<bool> generate_packages{"generate_packages", false};
|
option<bool> generate_packages{"generate_packages", false};
|
||||||
|
|||||||
@@ -22,17 +22,17 @@ namespace config {
|
|||||||
|
|
||||||
template <typename T> void append_value(T &l, const T &r) { l = r; }
|
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 {
|
template <typename T> struct option {
|
||||||
option(const std::string &name_,
|
option(const std::string &name_,
|
||||||
option_inherit_mode im = option_inherit_mode::override)
|
option_inherit_mode im = option_inherit_mode::kOverride)
|
||||||
: name{name_}
|
: name{name_}
|
||||||
, value{}
|
, value{}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
option(const std::string &name_, const T &initial_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_}
|
: name{name_}
|
||||||
, value{initial_value}
|
, value{initial_value}
|
||||||
, has_value{true}
|
, has_value{true}
|
||||||
@@ -49,7 +49,7 @@ template <typename T> struct option {
|
|||||||
void override(const option<T> &o)
|
void override(const option<T> &o)
|
||||||
{
|
{
|
||||||
if (!is_declared && o.is_declared) {
|
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);
|
append_value(value, o.value);
|
||||||
else
|
else
|
||||||
value = o.value;
|
value = o.value;
|
||||||
|
|||||||
Reference in New Issue
Block a user