diff --git a/include/godot_cpp/core/type_info.hpp b/include/godot_cpp/core/type_info.hpp index d847598a..b78f7e73 100644 --- a/include/godot_cpp/core/type_info.hpp +++ b/include/godot_cpp/core/type_info.hpp @@ -33,7 +33,6 @@ #include #include -#include #include #include @@ -414,206 +413,6 @@ MAKE_TYPED_ARRAY_INFO(IPAddress, Variant::STRING) #undef MAKE_TYPED_ARRAY_INFO -template -struct PtrToArg> { - _FORCE_INLINE_ static TypedDictionary convert(const void *p_ptr) { - return TypedDictionary(*reinterpret_cast(p_ptr)); - } - typedef Dictionary EncodeT; - _FORCE_INLINE_ static void encode(TypedDictionary p_val, void *p_ptr) { - *(Dictionary *)p_ptr = p_val; - } -}; - -template -struct PtrToArg &> { - typedef Dictionary EncodeT; - _FORCE_INLINE_ static TypedDictionary - convert(const void *p_ptr) { - return TypedDictionary(*reinterpret_cast(p_ptr)); - } -}; - -template -struct GetTypeInfo> { - static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; - static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; - static inline PropertyInfo get_class_info() { - return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, vformat("%s;%s", K::get_class_static(), V::get_class_static())); - } -}; - -template -struct GetTypeInfo &> { - static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; - static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; - static inline PropertyInfo get_class_info() { - return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, vformat("%s;%s", K::get_class_static(), V::get_class_static())); - } -}; - -#define MAKE_TYPED_DICTIONARY_INFO_WITH_OBJECT(m_type, m_variant_type) \ - template \ - struct GetTypeInfo> { \ - static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ - static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ - static inline PropertyInfo get_class_info() { \ - return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ - vformat("%s;%s", T::get_class_static(), m_variant_type == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type).utf8().get_data())); \ - } \ - }; \ - template \ - struct GetTypeInfo &> { \ - static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ - static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ - static inline PropertyInfo get_class_info() { \ - return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ - vformat("%s;%s", T::get_class_static(), m_variant_type == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type).utf8().get_data())); \ - } \ - }; \ - template \ - struct GetTypeInfo> { \ - static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ - static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ - static inline PropertyInfo get_class_info() { \ - return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ - vformat("%s;%s", m_variant_type == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type).utf8().get_data(), T::get_class_static())); \ - } \ - }; \ - template \ - struct GetTypeInfo &> { \ - static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ - static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ - static inline PropertyInfo get_class_info() { \ - return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ - vformat("%s;%s", m_variant_type == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type).utf8().get_data(), T::get_class_static())); \ - } \ - }; - -#define MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type_key, m_variant_type_key, m_type_value, m_variant_type_value) \ - template <> \ - struct GetTypeInfo> { \ - static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ - static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ - static inline PropertyInfo get_class_info() { \ - return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ - vformat("%s;%s", m_variant_type_key == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type_key).utf8().get_data(), \ - m_variant_type_value == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type_value).utf8().get_data())); \ - } \ - }; \ - template <> \ - struct GetTypeInfo &> { \ - static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ - static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ - static inline PropertyInfo get_class_info() { \ - return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ - vformat("%s;%s", m_variant_type_key == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type_key).utf8().get_data(), \ - m_variant_type_value == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type_value).utf8().get_data())); \ - } \ - }; - -#define MAKE_TYPED_DICTIONARY_INFO_NIL(m_type, m_variant_type) \ - MAKE_TYPED_DICTIONARY_INFO_WITH_OBJECT(m_type, m_variant_type) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, bool, Variant::BOOL) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, uint8_t, Variant::INT) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, int8_t, Variant::INT) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, uint16_t, Variant::INT) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, int16_t, Variant::INT) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, uint32_t, Variant::INT) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, int32_t, Variant::INT) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, uint64_t, Variant::INT) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, int64_t, Variant::INT) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, float, Variant::FLOAT) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, double, Variant::FLOAT) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, String, Variant::STRING) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Vector2, Variant::VECTOR2) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Vector2i, Variant::VECTOR2I) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Rect2, Variant::RECT2) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Rect2i, Variant::RECT2I) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Vector3, Variant::VECTOR3) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Vector3i, Variant::VECTOR3I) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Transform2D, Variant::TRANSFORM2D) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Plane, Variant::PLANE) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Quaternion, Variant::QUATERNION) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, AABB, Variant::AABB) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Basis, Variant::BASIS) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Transform3D, Variant::TRANSFORM3D) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Color, Variant::COLOR) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, StringName, Variant::STRING_NAME) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, NodePath, Variant::NODE_PATH) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, RID, Variant::RID) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Callable, Variant::CALLABLE) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Signal, Variant::SIGNAL) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Dictionary, Variant::DICTIONARY) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Array, Variant::ARRAY) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedByteArray, Variant::PACKED_BYTE_ARRAY) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedInt32Array, Variant::PACKED_INT32_ARRAY) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedInt64Array, Variant::PACKED_INT64_ARRAY) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedFloat32Array, Variant::PACKED_FLOAT32_ARRAY) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedFloat64Array, Variant::PACKED_FLOAT64_ARRAY) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedStringArray, Variant::PACKED_STRING_ARRAY) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedVector2Array, Variant::PACKED_VECTOR2_ARRAY) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedVector3Array, Variant::PACKED_VECTOR3_ARRAY) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedVector4Array, Variant::PACKED_VECTOR4_ARRAY) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedColorArray, Variant::PACKED_COLOR_ARRAY) \ - /* MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, IPAddress, Variant::STRING) */ - -#define MAKE_TYPED_DICTIONARY_INFO(m_type, m_variant_type) \ - MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Variant, Variant::NIL) \ - MAKE_TYPED_DICTIONARY_INFO_NIL(m_type, m_variant_type) - -MAKE_TYPED_DICTIONARY_INFO_NIL(Variant, Variant::NIL) -MAKE_TYPED_DICTIONARY_INFO(bool, Variant::BOOL) -MAKE_TYPED_DICTIONARY_INFO(uint8_t, Variant::INT) -MAKE_TYPED_DICTIONARY_INFO(int8_t, Variant::INT) -MAKE_TYPED_DICTIONARY_INFO(uint16_t, Variant::INT) -MAKE_TYPED_DICTIONARY_INFO(int16_t, Variant::INT) -MAKE_TYPED_DICTIONARY_INFO(uint32_t, Variant::INT) -MAKE_TYPED_DICTIONARY_INFO(int32_t, Variant::INT) -MAKE_TYPED_DICTIONARY_INFO(uint64_t, Variant::INT) -MAKE_TYPED_DICTIONARY_INFO(int64_t, Variant::INT) -MAKE_TYPED_DICTIONARY_INFO(float, Variant::FLOAT) -MAKE_TYPED_DICTIONARY_INFO(double, Variant::FLOAT) -MAKE_TYPED_DICTIONARY_INFO(String, Variant::STRING) -MAKE_TYPED_DICTIONARY_INFO(Vector2, Variant::VECTOR2) -MAKE_TYPED_DICTIONARY_INFO(Vector2i, Variant::VECTOR2I) -MAKE_TYPED_DICTIONARY_INFO(Rect2, Variant::RECT2) -MAKE_TYPED_DICTIONARY_INFO(Rect2i, Variant::RECT2I) -MAKE_TYPED_DICTIONARY_INFO(Vector3, Variant::VECTOR3) -MAKE_TYPED_DICTIONARY_INFO(Vector3i, Variant::VECTOR3I) -MAKE_TYPED_DICTIONARY_INFO(Transform2D, Variant::TRANSFORM2D) -MAKE_TYPED_DICTIONARY_INFO(Plane, Variant::PLANE) -MAKE_TYPED_DICTIONARY_INFO(Quaternion, Variant::QUATERNION) -MAKE_TYPED_DICTIONARY_INFO(AABB, Variant::AABB) -MAKE_TYPED_DICTIONARY_INFO(Basis, Variant::BASIS) -MAKE_TYPED_DICTIONARY_INFO(Transform3D, Variant::TRANSFORM3D) -MAKE_TYPED_DICTIONARY_INFO(Color, Variant::COLOR) -MAKE_TYPED_DICTIONARY_INFO(StringName, Variant::STRING_NAME) -MAKE_TYPED_DICTIONARY_INFO(NodePath, Variant::NODE_PATH) -MAKE_TYPED_DICTIONARY_INFO(RID, Variant::RID) -MAKE_TYPED_DICTIONARY_INFO(Callable, Variant::CALLABLE) -MAKE_TYPED_DICTIONARY_INFO(Signal, Variant::SIGNAL) -MAKE_TYPED_DICTIONARY_INFO(Dictionary, Variant::DICTIONARY) -MAKE_TYPED_DICTIONARY_INFO(Array, Variant::ARRAY) -MAKE_TYPED_DICTIONARY_INFO(PackedByteArray, Variant::PACKED_BYTE_ARRAY) -MAKE_TYPED_DICTIONARY_INFO(PackedInt32Array, Variant::PACKED_INT32_ARRAY) -MAKE_TYPED_DICTIONARY_INFO(PackedInt64Array, Variant::PACKED_INT64_ARRAY) -MAKE_TYPED_DICTIONARY_INFO(PackedFloat32Array, Variant::PACKED_FLOAT32_ARRAY) -MAKE_TYPED_DICTIONARY_INFO(PackedFloat64Array, Variant::PACKED_FLOAT64_ARRAY) -MAKE_TYPED_DICTIONARY_INFO(PackedStringArray, Variant::PACKED_STRING_ARRAY) -MAKE_TYPED_DICTIONARY_INFO(PackedVector2Array, Variant::PACKED_VECTOR2_ARRAY) -MAKE_TYPED_DICTIONARY_INFO(PackedVector3Array, Variant::PACKED_VECTOR3_ARRAY) -MAKE_TYPED_DICTIONARY_INFO(PackedVector4Array, Variant::PACKED_VECTOR4_ARRAY) -MAKE_TYPED_DICTIONARY_INFO(PackedColorArray, Variant::PACKED_COLOR_ARRAY) -/* -MAKE_TYPED_DICTIONARY_INFO(IPAddress, Variant::STRING) -*/ - -#undef MAKE_TYPED_DICTIONARY_INFO -#undef MAKE_TYPED_DICTIONARY_INFO_NIL -#undef MAKE_TYPED_DICTIONARY_INFO_EXPANDED -#undef MAKE_TYPED_DICTIONARY_INFO_WITH_OBJECT - #define CLASS_INFO(m_type) (GetTypeInfo::get_class_info()) } // namespace godot diff --git a/include/godot_cpp/variant/typed_dictionary.hpp b/include/godot_cpp/variant/typed_dictionary.hpp index e7f35352..deb5871a 100644 --- a/include/godot_cpp/variant/typed_dictionary.hpp +++ b/include/godot_cpp/variant/typed_dictionary.hpp @@ -31,6 +31,7 @@ #ifndef GODOT_TYPED_DICTIONARY_HPP #define GODOT_TYPED_DICTIONARY_HPP +#include #include #include @@ -233,6 +234,206 @@ MAKE_TYPED_DICTIONARY(IPAddress, Variant::STRING) #undef MAKE_TYPED_DICTIONARY_EXPANDED #undef MAKE_TYPED_DICTIONARY_WITH_OBJECT +template +struct PtrToArg> { + _FORCE_INLINE_ static TypedDictionary convert(const void *p_ptr) { + return TypedDictionary(*reinterpret_cast(p_ptr)); + } + typedef Dictionary EncodeT; + _FORCE_INLINE_ static void encode(TypedDictionary p_val, void *p_ptr) { + *(Dictionary *)p_ptr = p_val; + } +}; + +template +struct PtrToArg &> { + typedef Dictionary EncodeT; + _FORCE_INLINE_ static TypedDictionary + convert(const void *p_ptr) { + return TypedDictionary(*reinterpret_cast(p_ptr)); + } +}; + +template +struct GetTypeInfo> { + static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; + static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; + static inline PropertyInfo get_class_info() { + return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, vformat("%s;%s", K::get_class_static(), V::get_class_static())); + } +}; + +template +struct GetTypeInfo &> { + static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; + static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; + static inline PropertyInfo get_class_info() { + return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, vformat("%s;%s", K::get_class_static(), V::get_class_static())); + } +}; + +#define MAKE_TYPED_DICTIONARY_INFO_WITH_OBJECT(m_type, m_variant_type) \ + template \ + struct GetTypeInfo> { \ + static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ + static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ + static inline PropertyInfo get_class_info() { \ + return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ + vformat("%s;%s", T::get_class_static(), m_variant_type == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type).utf8().get_data())); \ + } \ + }; \ + template \ + struct GetTypeInfo &> { \ + static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ + static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ + static inline PropertyInfo get_class_info() { \ + return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ + vformat("%s;%s", T::get_class_static(), m_variant_type == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type).utf8().get_data())); \ + } \ + }; \ + template \ + struct GetTypeInfo> { \ + static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ + static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ + static inline PropertyInfo get_class_info() { \ + return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ + vformat("%s;%s", m_variant_type == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type).utf8().get_data(), T::get_class_static())); \ + } \ + }; \ + template \ + struct GetTypeInfo &> { \ + static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ + static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ + static inline PropertyInfo get_class_info() { \ + return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ + vformat("%s;%s", m_variant_type == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type).utf8().get_data(), T::get_class_static())); \ + } \ + }; + +#define MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type_key, m_variant_type_key, m_type_value, m_variant_type_value) \ + template <> \ + struct GetTypeInfo> { \ + static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ + static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ + static inline PropertyInfo get_class_info() { \ + return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ + vformat("%s;%s", m_variant_type_key == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type_key).utf8().get_data(), \ + m_variant_type_value == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type_value).utf8().get_data())); \ + } \ + }; \ + template <> \ + struct GetTypeInfo &> { \ + static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_DICTIONARY; \ + static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE; \ + static inline PropertyInfo get_class_info() { \ + return PropertyInfo(Variant::Type::DICTIONARY, String(), PROPERTY_HINT_DICTIONARY_TYPE, \ + vformat("%s;%s", m_variant_type_key == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type_key).utf8().get_data(), \ + m_variant_type_value == Variant::Type::NIL ? "Variant" : Variant::get_type_name(m_variant_type_value).utf8().get_data())); \ + } \ + }; + +#define MAKE_TYPED_DICTIONARY_INFO_NIL(m_type, m_variant_type) \ + MAKE_TYPED_DICTIONARY_INFO_WITH_OBJECT(m_type, m_variant_type) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, bool, Variant::BOOL) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, uint8_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, int8_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, uint16_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, int16_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, uint32_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, int32_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, uint64_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, int64_t, Variant::INT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, float, Variant::FLOAT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, double, Variant::FLOAT) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, String, Variant::STRING) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Vector2, Variant::VECTOR2) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Vector2i, Variant::VECTOR2I) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Rect2, Variant::RECT2) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Rect2i, Variant::RECT2I) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Vector3, Variant::VECTOR3) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Vector3i, Variant::VECTOR3I) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Transform2D, Variant::TRANSFORM2D) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Plane, Variant::PLANE) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Quaternion, Variant::QUATERNION) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, AABB, Variant::AABB) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Basis, Variant::BASIS) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Transform3D, Variant::TRANSFORM3D) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Color, Variant::COLOR) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, StringName, Variant::STRING_NAME) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, NodePath, Variant::NODE_PATH) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, RID, Variant::RID) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Callable, Variant::CALLABLE) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Signal, Variant::SIGNAL) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Dictionary, Variant::DICTIONARY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Array, Variant::ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedByteArray, Variant::PACKED_BYTE_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedInt32Array, Variant::PACKED_INT32_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedInt64Array, Variant::PACKED_INT64_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedFloat32Array, Variant::PACKED_FLOAT32_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedFloat64Array, Variant::PACKED_FLOAT64_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedStringArray, Variant::PACKED_STRING_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedVector2Array, Variant::PACKED_VECTOR2_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedVector3Array, Variant::PACKED_VECTOR3_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedVector4Array, Variant::PACKED_VECTOR4_ARRAY) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, PackedColorArray, Variant::PACKED_COLOR_ARRAY) \ + /* MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, IPAddress, Variant::STRING) */ + +#define MAKE_TYPED_DICTIONARY_INFO(m_type, m_variant_type) \ + MAKE_TYPED_DICTIONARY_INFO_EXPANDED(m_type, m_variant_type, Variant, Variant::NIL) \ + MAKE_TYPED_DICTIONARY_INFO_NIL(m_type, m_variant_type) + +MAKE_TYPED_DICTIONARY_INFO_NIL(Variant, Variant::NIL) +MAKE_TYPED_DICTIONARY_INFO(bool, Variant::BOOL) +MAKE_TYPED_DICTIONARY_INFO(uint8_t, Variant::INT) +MAKE_TYPED_DICTIONARY_INFO(int8_t, Variant::INT) +MAKE_TYPED_DICTIONARY_INFO(uint16_t, Variant::INT) +MAKE_TYPED_DICTIONARY_INFO(int16_t, Variant::INT) +MAKE_TYPED_DICTIONARY_INFO(uint32_t, Variant::INT) +MAKE_TYPED_DICTIONARY_INFO(int32_t, Variant::INT) +MAKE_TYPED_DICTIONARY_INFO(uint64_t, Variant::INT) +MAKE_TYPED_DICTIONARY_INFO(int64_t, Variant::INT) +MAKE_TYPED_DICTIONARY_INFO(float, Variant::FLOAT) +MAKE_TYPED_DICTIONARY_INFO(double, Variant::FLOAT) +MAKE_TYPED_DICTIONARY_INFO(String, Variant::STRING) +MAKE_TYPED_DICTIONARY_INFO(Vector2, Variant::VECTOR2) +MAKE_TYPED_DICTIONARY_INFO(Vector2i, Variant::VECTOR2I) +MAKE_TYPED_DICTIONARY_INFO(Rect2, Variant::RECT2) +MAKE_TYPED_DICTIONARY_INFO(Rect2i, Variant::RECT2I) +MAKE_TYPED_DICTIONARY_INFO(Vector3, Variant::VECTOR3) +MAKE_TYPED_DICTIONARY_INFO(Vector3i, Variant::VECTOR3I) +MAKE_TYPED_DICTIONARY_INFO(Transform2D, Variant::TRANSFORM2D) +MAKE_TYPED_DICTIONARY_INFO(Plane, Variant::PLANE) +MAKE_TYPED_DICTIONARY_INFO(Quaternion, Variant::QUATERNION) +MAKE_TYPED_DICTIONARY_INFO(AABB, Variant::AABB) +MAKE_TYPED_DICTIONARY_INFO(Basis, Variant::BASIS) +MAKE_TYPED_DICTIONARY_INFO(Transform3D, Variant::TRANSFORM3D) +MAKE_TYPED_DICTIONARY_INFO(Color, Variant::COLOR) +MAKE_TYPED_DICTIONARY_INFO(StringName, Variant::STRING_NAME) +MAKE_TYPED_DICTIONARY_INFO(NodePath, Variant::NODE_PATH) +MAKE_TYPED_DICTIONARY_INFO(RID, Variant::RID) +MAKE_TYPED_DICTIONARY_INFO(Callable, Variant::CALLABLE) +MAKE_TYPED_DICTIONARY_INFO(Signal, Variant::SIGNAL) +MAKE_TYPED_DICTIONARY_INFO(Dictionary, Variant::DICTIONARY) +MAKE_TYPED_DICTIONARY_INFO(Array, Variant::ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedByteArray, Variant::PACKED_BYTE_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedInt32Array, Variant::PACKED_INT32_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedInt64Array, Variant::PACKED_INT64_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedFloat32Array, Variant::PACKED_FLOAT32_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedFloat64Array, Variant::PACKED_FLOAT64_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedStringArray, Variant::PACKED_STRING_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedVector2Array, Variant::PACKED_VECTOR2_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedVector3Array, Variant::PACKED_VECTOR3_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedVector4Array, Variant::PACKED_VECTOR4_ARRAY) +MAKE_TYPED_DICTIONARY_INFO(PackedColorArray, Variant::PACKED_COLOR_ARRAY) +/* +MAKE_TYPED_DICTIONARY_INFO(IPAddress, Variant::STRING) +*/ + +#undef MAKE_TYPED_DICTIONARY_INFO +#undef MAKE_TYPED_DICTIONARY_INFO_NIL +#undef MAKE_TYPED_DICTIONARY_INFO_EXPANDED +#undef MAKE_TYPED_DICTIONARY_INFO_WITH_OBJECT + } // namespace godot #endif // GODOT_TYPED_DICTIONARY_HPP diff --git a/test/src/example.cpp b/test/src/example.cpp index 692d0047..50844fc7 100644 --- a/test/src/example.cpp +++ b/test/src/example.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include using namespace godot; diff --git a/test/src/example.h b/test/src/example.h index a28deffe..29e56e5e 100644 --- a/test/src/example.h +++ b/test/src/example.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include