32 lines
847 B
C++
32 lines
847 B
C++
#pragma once
|
|
|
|
#include <boost/json.hpp>
|
|
#include <boost/variant2.hpp>
|
|
|
|
#include <cppbase/result.hpp>
|
|
|
|
struct IkarusValue {
|
|
public:
|
|
using Data = boost::variant2::variant<struct IkarusToggleValue *, struct IkarusNumberValue *, struct IkarusTextValue *>;
|
|
constexpr static auto SMALL_VEC_VALUE_SIZE = 8;
|
|
|
|
public:
|
|
explicit IkarusValue(Data data);
|
|
|
|
IkarusValue(IkarusValue const&) = default;
|
|
IkarusValue(IkarusValue&&) noexcept = default;
|
|
|
|
IkarusValue& operator=(IkarusValue const&) = default;
|
|
IkarusValue& operator=(IkarusValue&&) noexcept = default;
|
|
|
|
virtual ~IkarusValue() = default;
|
|
|
|
public:
|
|
struct FromJsonError {};
|
|
|
|
[[nodiscard]] static cppbase::Result<IkarusValue *, FromJsonError> from_json(boost::json::value const& json);
|
|
[[nodiscard]] boost::json::value to_json() const;
|
|
|
|
public:
|
|
Data data;
|
|
};
|