diff options
-rw-r--r-- | core/variant/variant_setget.cpp | 94 |
1 files changed, 2 insertions, 92 deletions
diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp index 59dde707c7..f6a2c11830 100644 --- a/core/variant/variant_setget.cpp +++ b/core/variant/variant_setget.cpp @@ -41,9 +41,6 @@ #define SETGET_STRUCT(m_base_type, m_member_type, m_member) \ struct VariantSetGet_##m_base_type##_##m_member { \ static void get(const Variant *base, Variant *member) { \ - *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_member; \ - } \ - static void validated_get(const Variant *base, Variant *member) { \ VariantTypeAdjust<m_member_type>::adjust(member); \ *VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_member; \ } \ @@ -72,9 +69,6 @@ #define SETGET_NUMBER_STRUCT(m_base_type, m_member_type, m_member) \ struct VariantSetGet_##m_base_type##_##m_member { \ static void get(const Variant *base, Variant *member) { \ - *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_member; \ - } \ - static void validated_get(const Variant *base, Variant *member) { \ VariantTypeAdjust<m_member_type>::adjust(member); \ *VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_member; \ } \ @@ -106,9 +100,6 @@ #define SETGET_STRUCT_CUSTOM(m_base_type, m_member_type, m_member, m_custom) \ struct VariantSetGet_##m_base_type##_##m_member { \ static void get(const Variant *base, Variant *member) { \ - *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_custom; \ - } \ - static void validated_get(const Variant *base, Variant *member) { \ VariantTypeAdjust<m_member_type>::adjust(member); \ *VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_custom; \ } \ @@ -137,9 +128,6 @@ #define SETGET_NUMBER_STRUCT_CUSTOM(m_base_type, m_member_type, m_member, m_custom) \ struct VariantSetGet_##m_base_type##_##m_member { \ static void get(const Variant *base, Variant *member) { \ - *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_custom; \ - } \ - static void validated_get(const Variant *base, Variant *member) { \ VariantTypeAdjust<m_member_type>::adjust(member); \ *VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_custom; \ } \ @@ -171,9 +159,6 @@ #define SETGET_STRUCT_FUNC(m_base_type, m_member_type, m_member, m_setter, m_getter) \ struct VariantSetGet_##m_base_type##_##m_member { \ static void get(const Variant *base, Variant *member) { \ - *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(); \ - } \ - static void validated_get(const Variant *base, Variant *member) { \ VariantTypeAdjust<m_member_type>::adjust(member); \ *VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(); \ } \ @@ -202,9 +187,6 @@ #define SETGET_NUMBER_STRUCT_FUNC(m_base_type, m_member_type, m_member, m_setter, m_getter) \ struct VariantSetGet_##m_base_type##_##m_member { \ static void get(const Variant *base, Variant *member) { \ - *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(); \ - } \ - static void validated_get(const Variant *base, Variant *member) { \ VariantTypeAdjust<m_member_type>::adjust(member); \ *VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(); \ } \ @@ -236,9 +218,6 @@ #define SETGET_STRUCT_FUNC_INDEX(m_base_type, m_member_type, m_member, m_setter, m_getter, m_index) \ struct VariantSetGet_##m_base_type##_##m_member { \ static void get(const Variant *base, Variant *member) { \ - *member = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(m_index); \ - } \ - static void validated_get(const Variant *base, Variant *member) { \ VariantTypeAdjust<m_member_type>::adjust(member); \ *VariantGetInternalPtr<m_member_type>::get_ptr(member) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_getter(m_index); \ } \ @@ -347,7 +326,7 @@ static void register_member(Variant::Type p_type, const StringName &p_member) { sgi.ptr_setter = T::ptr_set; sgi.getter = T::get; - sgi.validated_getter = T::validated_get; + sgi.validated_getter = T::get; sgi.ptr_getter = T::ptr_get; sgi.member_type = T::get_type(); @@ -612,18 +591,6 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const { oob = true; \ return; \ } \ - *value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \ - oob = false; \ - } \ - static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \ - int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \ - if (index < 0) { \ - index += size; \ - } \ - if (index < 0 || index >= size) { \ - oob = true; \ - return; \ - } \ VariantTypeAdjust<m_elem_type>::adjust(value); \ *VariantGetInternalPtr<m_elem_type>::get_ptr(value) = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \ oob = false; \ @@ -690,18 +657,6 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const { oob = true; \ return; \ } \ - *value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \ - oob = false; \ - } \ - static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \ - int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \ - if (index < 0) { \ - index += size; \ - } \ - if (index < 0 || index >= size) { \ - oob = true; \ - return; \ - } \ VariantTypeAdjust<m_elem_type>::adjust(value); \ *VariantGetInternalPtr<m_elem_type>::get_ptr(value) = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \ oob = false; \ @@ -769,14 +724,6 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const { oob = true; \ return; \ } \ - *value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \ - oob = false; \ - } \ - static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \ - if (index < 0 || index >= m_max) { \ - oob = true; \ - return; \ - } \ VariantTypeAdjust<m_elem_type>::adjust(value); \ *VariantGetInternalPtr<m_elem_type>::get_ptr(value) = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \ oob = false; \ @@ -832,14 +779,6 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const { oob = true; \ return; \ } \ - *value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))m_accessor[index]; \ - oob = false; \ - } \ - static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \ - if (index < 0 || index >= m_max) { \ - oob = true; \ - return; \ - } \ VariantTypeAdjust<m_elem_type>::adjust(value); \ *VariantGetInternalPtr<m_elem_type>::get_ptr(value) = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))m_accessor[index]; \ oob = false; \ @@ -889,14 +828,6 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const { oob = true; \ return; \ } \ - *value = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_get(index); \ - oob = false; \ - } \ - static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \ - if (index < 0 || index >= m_max) { \ - oob = true; \ - return; \ - } \ VariantTypeAdjust<m_elem_type>::adjust(value); \ *VariantGetInternalPtr<m_elem_type>::get_ptr(value) = VariantGetInternalPtr<m_base_type>::get_ptr(base)->m_get(index); \ oob = false; \ @@ -953,18 +884,6 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const { *value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \ oob = false; \ } \ - static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \ - int64_t size = VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); \ - if (index < 0) { \ - index += size; \ - } \ - if (index < 0 || index >= size) { \ - oob = true; \ - return; \ - } \ - *value = (*VariantGetInternalPtr<m_base_type>::get_ptr(base))[index]; \ - oob = false; \ - } \ static void ptr_get(const void *base, int64_t index, void *member) { \ /* avoid ptrconvert for performance*/ \ const m_base_type &v = *reinterpret_cast<const m_base_type *>(base); \ @@ -1022,15 +941,6 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const { *value = *ptr; \ oob = false; \ } \ - static void validated_get(const Variant *base, int64_t index, Variant *value, bool &oob) { \ - const Variant *ptr = VariantGetInternalPtr<m_base_type>::get_ptr(base)->getptr(index); \ - if (!ptr) { \ - oob = true; \ - return; \ - } \ - *value = *ptr; \ - oob = false; \ - } \ static void ptr_get(const void *base, int64_t index, void *member) { \ /* avoid ptrconvert for performance*/ \ const m_base_type &v = *reinterpret_cast<const m_base_type *>(base); \ @@ -1106,7 +1016,7 @@ static void register_indexed_member(Variant::Type p_type) { sgi.ptr_setter = T::ptr_set; sgi.getter = T::get; - sgi.validated_getter = T::validated_get; + sgi.validated_getter = T::get; sgi.ptr_getter = T::ptr_get; sgi.index_type = T::get_index_type(); |