Added double alternative for a few Variant methods.

This commit is contained in:
Relintai 2022-01-06 19:33:46 +01:00
parent 3533145133
commit 937d7a3d87
2 changed files with 17 additions and 0 deletions

View File

@ -367,6 +367,12 @@ void Variant::set_float(const float value) {
_type = TYPE_FLOAT;
_float = value;
}
void Variant::set_float(const double value) {
clear();
_type = TYPE_FLOAT;
_float = value;
}
void Variant::set_string(String *value, const bool copy) {
clear();
@ -466,6 +472,9 @@ Variant::operator uint64_t() const {
Variant::operator float() const {
return to_float();
}
Variant::operator double() const {
return to_float();
}
Variant::operator String() const {
return to_string();
}
@ -567,6 +576,11 @@ Variant::Variant(const float value) {
_float = value;
}
Variant::Variant(const double value) {
_type = TYPE_FLOAT;
_float = value;
}
Variant::Variant(String *value, bool copy) {
_type = TYPE_NULL;

View File

@ -54,6 +54,7 @@ public:
void set_int(const int value);
void set_uint(const uint64_t value);
void set_float(const float value);
void set_float(const double value);
void set_string(String *value, bool copy = false);
void set_string(const String &value, bool copy = true);
void set_object(Object *value);
@ -64,6 +65,7 @@ public:
operator int() const;
operator uint64_t() const;
operator float() const;
operator double() const;
operator String() const;
operator Object *() const;
operator Reference *() const;
@ -78,6 +80,7 @@ public:
Variant(const int value);
Variant(const uint64_t value);
Variant(const float value);
Variant(const double value);
Variant(String *value, const bool copy = false);
Variant(const String &value, const bool copy = true);
Variant(Object *value);