#ifndef sk_VALUE_HPP #define sk_VALUE_HPP #include "commons.hpp" namespace sk { class Type; class Value { public: static std::shared_ptr make_int(int value); static std::shared_ptr make_float(float value); static std::shared_ptr make_bool(bool value); static std::shared_ptr make_string(std::string const& value); explicit Value(std::shared_ptr type); virtual ~Value(); bool equals(Value const& rhs) const; std::string string() const; std::weak_ptr type() const; int as_int() const { return *m_int_val; } float as_float() const { return *m_float_val; } bool as_bool() const { return *m_bool_val; } std::string as_string() const { return *m_string_val; } private: std::shared_ptr m_type; std::optional m_int_val; std::optional m_float_val; std::optional m_string_val; std::optional m_bool_val; }; } #endif