From bcac96c8c272d9d4c60fb781974e80db1cb19527 Mon Sep 17 00:00:00 2001 From: Thaddeus Crews Date: Sat, 4 Nov 2023 16:53:09 -0500 Subject: [PATCH] =?UTF-8?q?Add=20missing=20int=E2=86=92Variant=20conversio?= =?UTF-8?q?ns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/godot_cpp/variant/variant.hpp | 14 +++++++++++++- src/variant/variant.cpp | 16 ++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/include/godot_cpp/variant/variant.hpp b/include/godot_cpp/variant/variant.hpp index 3e8738cd..fc41014e 100644 --- a/include/godot_cpp/variant/variant.hpp +++ b/include/godot_cpp/variant/variant.hpp @@ -154,10 +154,18 @@ public: Variant(int64_t v); Variant(int32_t v) : Variant(static_cast(v)) {} - Variant(uint32_t v) : + Variant(int16_t v) : + Variant(static_cast(v)) {} + Variant(int8_t v) : Variant(static_cast(v)) {} Variant(uint64_t v) : Variant(static_cast(v)) {} + Variant(uint32_t v) : + Variant(static_cast(v)) {} + Variant(uint16_t v) : + Variant(static_cast(v)) {} + Variant(uint8_t v) : + Variant(static_cast(v)) {} Variant(double v); Variant(float v) : Variant((double)v) {} @@ -209,8 +217,12 @@ public: operator bool() const; operator int64_t() const; operator int32_t() const; + operator int16_t() const; + operator int8_t() const; operator uint64_t() const; operator uint32_t() const; + operator uint16_t() const; + operator uint8_t() const; operator double() const; operator float() const; operator String() const; diff --git a/src/variant/variant.cpp b/src/variant/variant.cpp index db15be11..945d6f40 100644 --- a/src/variant/variant.cpp +++ b/src/variant/variant.cpp @@ -268,6 +268,14 @@ Variant::operator int32_t() const { return static_cast(operator int64_t()); } +Variant::operator int16_t() const { + return static_cast(operator int64_t()); +} + +Variant::operator int8_t() const { + return static_cast(operator int64_t()); +} + Variant::operator uint64_t() const { return static_cast(operator int64_t()); } @@ -276,6 +284,14 @@ Variant::operator uint32_t() const { return static_cast(operator int64_t()); } +Variant::operator uint16_t() const { + return static_cast(operator int64_t()); +} + +Variant::operator uint8_t() const { + return static_cast(operator int64_t()); +} + Variant::operator double() const { double result; to_type_constructor[FLOAT](&result, _native_ptr());