#ifndef LOGOS_VALUE_H #define LOGOS_VALUE_H #include #include #include #include #include class LogosValue { public: using List = std::vector; using Map = std::map; private: std::variant m_data; public: LogosValue(); LogosValue(bool v); LogosValue(int v); LogosValue(int64_t v); LogosValue(double v); LogosValue(const std::string& v); LogosValue(const char* v); LogosValue(const List& v); LogosValue(const Map& v); LogosValue(const std::vector& v); bool isNull() const; bool isBool() const; bool isInt() const; bool isDouble() const; bool isString() const; bool isList() const; bool isMap() const; bool toBool(bool def = false) const; int64_t toInt(int64_t def = 0) const; double toDouble(double def = 0.0) const; std::string toString(const std::string& def = "") const; List toList() const; Map toMap() const; std::vector toStringList() const; std::string toJson() const; static LogosValue fromJson(const std::string& json); explicit operator bool() const; }; #endif // LOGOS_VALUE_H