implement toggle/number/text values
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
ea221cdf85
commit
ff9bf0c14a
14 changed files with 280 additions and 48 deletions
|
|
@ -3,6 +3,39 @@
|
|||
#include <variant>
|
||||
|
||||
struct IkarusValue {
|
||||
bool indeterminate;
|
||||
std::variant<struct IkarusToggleValue *, struct IkarusNumberValue *, struct IkarusTextValue *> data;
|
||||
public:
|
||||
using Data = std::variant<struct IkarusToggleValue *, struct IkarusNumberValue *, struct IkarusTextValue *>::variant;
|
||||
|
||||
public:
|
||||
explicit IkarusValue(Data data):
|
||||
_data(data) {}
|
||||
|
||||
IkarusValue(IkarusValue const&) = default;
|
||||
IkarusValue(IkarusValue&&) noexcept = default;
|
||||
|
||||
IkarusValue& operator=(IkarusValue const&) = default;
|
||||
IkarusValue& operator=(IkarusValue&&) noexcept = default;
|
||||
|
||||
virtual ~IkarusValue();
|
||||
|
||||
public:
|
||||
[[nodiscard]] inline bool is_interminate() const {
|
||||
return _indeterminate;
|
||||
}
|
||||
|
||||
void set_intermediate(bool value) {
|
||||
_indeterminate = value;
|
||||
}
|
||||
|
||||
[[nodiscard]] inline Data& get_data() {
|
||||
return _data;
|
||||
}
|
||||
|
||||
[[nodiscard]] inline Data const& get_data() const {
|
||||
return _data;
|
||||
}
|
||||
|
||||
private:
|
||||
bool _indeterminate{false};
|
||||
Data _data;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue