1 #ifndef MENUPP_LEVEL_HPP_
2 #define MENUPP_LEVEL_HPP_
10 typename Conf
= LevelConf
<>,
11 typename FRead
= void(*)(typename
Conf::Type
),
12 typename FCallback
= void(*)(typename
Conf::Type
)
14 class Level
: public INode
18 typename
Conf::Type _value
= Conf::dflt
;
19 typename
Conf::Type _value_save
= Conf::dflt
;
24 explicit Level(const char* label
, FCallback fc
, FRead fr
)
25 : _label(label
), _fc(fc
), _fr(fr
) {}
27 void set_id(NodeId id
) override
{ _id
= id
; }
29 NodeId
id() const override
{ return _id
; }
31 void dump(std::ostream
& os
, size_t indent
, size_t total_indent
) const override
33 std::fill_n(std::ostream_iterator
<char>(os
), total_indent
, ' ');
34 os
<< "Level" << _id
<< ": \"" << label() << "\"\n";
35 std::fill_n(std::ostream_iterator
<char>(os
), total_indent
+ indent
, ' ');
39 NodeId
move(Move m
) override
48 _value
= inc
<Conf
>(_value
);
52 _value
= dec
<Conf
>(_value
);
67 INode
* get(size_t) override
{ return nullptr; }
69 const char* label() const override
{ return _label
; }
74 #endif // MENUPP_LEVEL_HPP_