diff --git a/include/utils/data.hh b/include/utils/data.hh index 5ea2fc3..c4a903b 100644 --- a/include/utils/data.hh +++ b/include/utils/data.hh @@ -52,6 +52,7 @@ namespace ppc::data { bool_t boolean() const; value_t &operator=(const value_t &other); + value_t &operator=(const char *other); ~value_t(); value_t(); @@ -60,6 +61,7 @@ namespace ppc::data { value_t(std::initializer_list> map); value_t(number_t val); value_t(const string_t &val); + value_t(const char *val); value_t(bool_t val); value_t(const value_t &other); diff --git a/src/utils/data.cc b/src/utils/data.cc index f0d1f79..f8ac7ce 100644 --- a/src/utils/data.cc +++ b/src/utils/data.cc @@ -92,6 +92,10 @@ namespace ppc::data { this->type = type_t::Str; this->val.str = new string_t(val); } + value_t::value_t(const char *val) { + this->type = type_t::Str; + this->val.str = new string_t(val); + } value_t::value_t(bool_t val) { this->type = type_t::Bool; this->val.bl = val; @@ -161,5 +165,10 @@ namespace ppc::data { } return *this; } + value_t &value_t::operator=(const char *other) { + type = type_t::Str; + val.str = new string_t(other); + return *this; + } }