fix: value from const char* initialization

This commit is contained in:
TopchetoEU 2022-10-11 14:36:54 +03:00
parent f0e778a85c
commit 8264dc3de0
2 changed files with 11 additions and 0 deletions

View File

@ -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<std::pair<std::string, value_t>> 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);

View File

@ -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;
}
}