@@ -15,8 +15,7 @@ template <class T> struct ExtractIf : std::identity
1515 using type = T;
1616};
1717
18- template <class T >
19- struct ExtractIf <::Anim::Interpolated<T>>
18+ template <class T > struct ExtractIf <::Anim::Interpolated<T>>
2019{
2120 using type = T;
2221 constexpr const T &operator ()(
@@ -26,26 +25,24 @@ struct ExtractIf<::Anim::Interpolated<T>>
2625 }
2726};
2827
29- template <>
30- struct ExtractIf <Math::FuzzyBool> {
28+ template <> struct ExtractIf <Math::FuzzyBool>
29+ {
3130 using type = bool ;
3231
33- constexpr bool operator ()(
34- const Math::FuzzyBool &value) const
32+ constexpr bool operator ()(const Math::FuzzyBool &value) const
3533 {
3634 return static_cast <bool >(value);
3735 }
3836};
3937
4038template <auto Mptr,
41- class T = ExtractIf<
42- std::remove_cvref_t <std:: invoke_result_t < decltype (Mptr),
43- Options>>>>
39+ auto Set,
40+ class T = ExtractIf< std::remove_cvref_t <
41+ std:: invoke_result_t < decltype (Mptr), Options>>>>
4442inline constexpr std::pair<std::string_view, Config::Accessor>
4543 Config::accessor = {
4644 Refl::Variables::MemberName<
47- Refl::Members::MemberCast<Mptr>::getName ()
48- >,
45+ Refl::Members::MemberCast<Mptr>::getName ()>,
4946 {.get =
5047 [](const Options &options)
5148 {
@@ -55,8 +52,9 @@ inline constexpr std::pair<std::string_view, Config::Accessor>
5552 .set =
5653 [](OptionsSetter &setter, const std::string &value)
5754 {
58- std::invoke (Mptr, setter.getOptions ()) =
59- Conv::parse<typename T::type>(value);
55+ std::invoke (Set,
56+ setter,
57+ Conv::parse<typename T::type>(value));
6058 }}};
6159
6260std::list<std::string> Config::listParams ()
@@ -245,9 +243,11 @@ Config::Accessors Config::initAccessors()
245243{
246244 Accessors res;
247245
248- res.emplace (accessor<&Options::title>);
249- res.emplace (accessor<&Options::legend>);
250- res.emplace (accessor<&Options::coordSystem>);
246+ res.emplace (accessor<&Options::title, &OptionsSetter::setTitle>);
247+ res.emplace (
248+ accessor<&Options::legend, &OptionsSetter::setLegend>);
249+ res.emplace (accessor<&Options::coordSystem,
250+ &OptionsSetter::setCoordSystem>);
251251
252252 res.insert ({" rotate" ,
253253 {.get =
@@ -262,7 +262,8 @@ Config::Accessors Config::initAccessors()
262262 setter.rotate (Conv::parse<double >(value) / 90 );
263263 }}});
264264
265- res.emplace (accessor<&Options::geometry>);
265+ res.emplace (
266+ accessor<&Options::geometry, &OptionsSetter::setShape>);
266267
267268 res.insert ({" orientation" ,
268269 {.get =
@@ -280,11 +281,14 @@ Config::Accessors Config::initAccessors()
280281 orientation == Orientation::horizontal);
281282 }}});
282283
283- res.emplace (accessor<&Options::sort>);
284- res.emplace (accessor<&Options::reverse>);
285- res.emplace (accessor<&Options::align>);
286- res.emplace (accessor<&Options::split>);
287- res.emplace (accessor<&Options::tooltip>);
284+ res.emplace (accessor<&Options::sort, &OptionsSetter::setSorted>);
285+ res.emplace (
286+ accessor<&Options::reverse, &OptionsSetter::setReverse>);
287+ res.emplace (accessor<&Options::align, &OptionsSetter::setAlign>);
288+ res.emplace (
289+ accessor<&Options::split, &OptionsSetter::setSplitted>);
290+ res.emplace (
291+ accessor<&Options::tooltip, &OptionsSetter::showTooltip>);
288292
289293 return res;
290294}
0 commit comments