adjust values api to vector-esque interface
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
733b52575b
commit
3395eba331
13 changed files with 297 additions and 220 deletions
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
#include <variant>
|
||||
|
||||
#include <boost/json.hpp>
|
||||
|
||||
#include <cppbase/result.hpp>
|
||||
|
||||
struct IkarusValue {
|
||||
public:
|
||||
using Data = std::variant<struct IkarusToggleValue *, struct IkarusNumberValue *, struct IkarusTextValue *>;
|
||||
|
|
@ -18,13 +22,12 @@ public:
|
|||
virtual ~IkarusValue() = default;
|
||||
|
||||
public:
|
||||
[[nodiscard]] bool is_interminate() const;
|
||||
void set_intermediate(bool value);
|
||||
struct FromJsonError {};
|
||||
|
||||
[[nodiscard]] Data& get_data();
|
||||
[[nodiscard]] Data const& get_data() const;
|
||||
[[nodiscard]] static cppbase::Result<IkarusValue, FromJsonError> from_json(boost::json::value const& json);
|
||||
[[nodiscard]] boost::json::value to_json() const;
|
||||
|
||||
private:
|
||||
bool _indeterminate{false};
|
||||
Data _data;
|
||||
public:
|
||||
bool indeterminate{false};
|
||||
Data data;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue