diff options
Diffstat (limited to 'core/variant.h')
-rw-r--r-- | core/variant.h | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/core/variant.h b/core/variant.h index c126540001..614d39e84a 100644 --- a/core/variant.h +++ b/core/variant.h @@ -58,8 +58,10 @@ struct PropertyInfo; struct MethodInfo; typedef Vector<uint8_t> PackedByteArray; -typedef Vector<int> PackedIntArray; -typedef Vector<real_t> PackedRealArray; +typedef Vector<int32_t> PackedInt32Array; +typedef Vector<int64_t> PackedInt64Array; +typedef Vector<float> PackedFloat32Array; +typedef Vector<double> PackedFloat64Array; typedef Vector<String> PackedStringArray; typedef Vector<Vector2> PackedVector2Array; typedef Vector<Vector3> PackedVector3Array; @@ -76,18 +78,16 @@ class Variant { public: // If this changes the table in variant_op must be updated enum Type { - NIL, // atomic types BOOL, INT, - REAL, + FLOAT, STRING, // math types - - VECTOR2, // 5 + VECTOR2, VECTOR2I, RECT2, RECT2I, @@ -95,7 +95,7 @@ public: VECTOR3I, TRANSFORM2D, PLANE, - QUAT, // 10 + QUAT, AABB, BASIS, TRANSFORM, @@ -103,24 +103,26 @@ public: // misc types COLOR, STRING_NAME, - NODE_PATH, // 15 + NODE_PATH, _RID, OBJECT, CALLABLE, SIGNAL, DICTIONARY, ARRAY, - // arrays - PACKED_BYTE_ARRAY, // 20 - PACKED_INT_ARRAY, - PACKED_REAL_ARRAY, + + // typed arrays + PACKED_BYTE_ARRAY, + PACKED_INT32_ARRAY, + PACKED_INT64_ARRAY, + PACKED_FLOAT32_ARRAY, + PACKED_FLOAT64_ARRAY, PACKED_STRING_ARRAY, PACKED_VECTOR2_ARRAY, - PACKED_VECTOR3_ARRAY, // 25 + PACKED_VECTOR3_ARRAY, PACKED_COLOR_ARRAY, VARIANT_MAX - }; private: @@ -201,7 +203,7 @@ private: union { bool _bool; int64_t _int; - double _real; + double _float; Transform2D *_transform2d; ::AABB *_aabb; Basis *_basis; @@ -224,7 +226,7 @@ public: bool is_ref() const; _FORCE_INLINE_ bool is_num() const { - return type == INT || type == REAL; + return type == INT || type == FLOAT; }; _FORCE_INLINE_ bool is_array() const { return type >= ARRAY; @@ -284,8 +286,10 @@ public: operator Array() const; operator Vector<uint8_t>() const; - operator Vector<int>() const; - operator Vector<real_t>() const; + operator Vector<int32_t>() const; + operator Vector<int64_t>() const; + operator Vector<float>() const; + operator Vector<double>() const; operator Vector<String>() const; operator Vector<Vector3>() const; operator Vector<Color>() const; @@ -349,9 +353,11 @@ public: Variant(const Array &p_array); Variant(const Vector<Plane> &p_array); // helper - Variant(const Vector<uint8_t> &p_raw_array); - Variant(const Vector<int> &p_int_array); - Variant(const Vector<real_t> &p_real_array); + Variant(const Vector<uint8_t> &p_byte_array); + Variant(const Vector<int32_t> &p_int32_array); + Variant(const Vector<int64_t> &p_int64_array); + Variant(const Vector<float> &p_float32_array); + Variant(const Vector<double> &p_float64_array); Variant(const Vector<String> &p_string_array); Variant(const Vector<Vector3> &p_vector3_array); Variant(const Vector<Color> &p_color_array); |