summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Gilleron <marc.gilleron@gmail.com>2018-01-17 23:58:28 +0100
committerMarc Gilleron <marc.gilleron@gmail.com>2018-01-17 23:58:28 +0100
commit835233fb7128db46389262a8bb23b623b9359ee4 (patch)
tree22d9e61c7c267cb970eed91a03e4031f5eeb6dce
parent02b9b2592aa11000ba48060231eaca074fbb8b97 (diff)
downloadredot-cpp-835233fb7128db46389262a8bb23b623b9359ee4.tar.gz
Added missing copy constructors and assign operators to PoolVectors
-rw-r--r--include/core/PoolArrays.hpp14
-rw-r--r--src/core/PoolArrays.cpp84
2 files changed, 98 insertions, 0 deletions
diff --git a/include/core/PoolArrays.hpp b/include/core/PoolArrays.hpp
index 17f08a6..b1c8fec 100644
--- a/include/core/PoolArrays.hpp
+++ b/include/core/PoolArrays.hpp
@@ -64,6 +64,8 @@ public:
};
PoolByteArray();
+ PoolByteArray(const PoolByteArray &p_other);
+ PoolByteArray &operator=(const PoolByteArray & p_other);
PoolByteArray(const Array& array);
@@ -143,6 +145,8 @@ public:
};
PoolIntArray();
+ PoolIntArray(const PoolIntArray &p_other);
+ PoolIntArray &operator=(const PoolIntArray &p_other);
PoolIntArray(const Array& array);
@@ -222,6 +226,8 @@ public:
};
PoolRealArray();
+ PoolRealArray(const PoolRealArray &p_other);
+ PoolRealArray &operator=(const PoolRealArray &p_other);
PoolRealArray(const Array& array);
@@ -301,6 +307,8 @@ public:
};
PoolStringArray();
+ PoolStringArray(const PoolStringArray &p_other);
+ PoolStringArray &operator=(const PoolStringArray &p_other);
PoolStringArray(const Array& array);
@@ -381,6 +389,8 @@ public:
};
PoolVector2Array();
+ PoolVector2Array(const PoolVector2Array &p_other);
+ PoolVector2Array &operator=(const PoolVector2Array &p_other);
PoolVector2Array(const Array& array);
@@ -460,6 +470,8 @@ public:
};
PoolVector3Array();
+ PoolVector3Array(const PoolVector3Array &p_other);
+ PoolVector3Array &operator=(const PoolVector3Array &p_other);
PoolVector3Array(const Array& array);
@@ -539,6 +551,8 @@ public:
};
PoolColorArray();
+ PoolColorArray(const PoolColorArray &p_other);
+ PoolColorArray &operator=(const PoolColorArray &p_other);
PoolColorArray(const Array& array);
diff --git a/src/core/PoolArrays.cpp b/src/core/PoolArrays.cpp
index 4038574..0ea493f 100644
--- a/src/core/PoolArrays.cpp
+++ b/src/core/PoolArrays.cpp
@@ -15,6 +15,18 @@ PoolByteArray::PoolByteArray()
godot::api->godot_pool_byte_array_new(&_godot_array);
}
+PoolByteArray::PoolByteArray(const PoolByteArray &p_other)
+{
+ godot::api->godot_pool_byte_array_new_copy(&_godot_array, &p_other._godot_array);
+}
+
+PoolByteArray &PoolByteArray::operator=(const PoolByteArray & p_other)
+{
+ godot::api->godot_pool_byte_array_destroy(&_godot_array);
+ godot::api->godot_pool_byte_array_new_copy(&_godot_array, &p_other._godot_array);
+ return *this;
+}
+
PoolByteArray::PoolByteArray(const Array& array)
{
godot::api->godot_pool_byte_array_new_with_array(&_godot_array, (godot_array *) &array);
@@ -97,6 +109,18 @@ PoolIntArray::PoolIntArray()
godot::api->godot_pool_int_array_new(&_godot_array);
}
+PoolIntArray::PoolIntArray(const PoolIntArray &p_other)
+{
+ godot::api->godot_pool_int_array_new_copy(&_godot_array, &p_other._godot_array);
+}
+
+PoolIntArray &PoolIntArray::operator=(const PoolIntArray &p_other)
+{
+ godot::api->godot_pool_int_array_destroy(&_godot_array);
+ godot::api->godot_pool_int_array_new_copy(&_godot_array, &p_other._godot_array);
+ return *this;
+}
+
PoolIntArray::PoolIntArray(const Array& array)
{
godot::api->godot_pool_int_array_new_with_array(&_godot_array, (godot_array *) &array);
@@ -178,6 +202,18 @@ PoolRealArray::PoolRealArray()
godot::api->godot_pool_real_array_new(&_godot_array);
}
+PoolRealArray::PoolRealArray(const PoolRealArray &p_other)
+{
+ godot::api->godot_pool_real_array_new_copy(&_godot_array, &p_other._godot_array);
+}
+
+PoolRealArray &PoolRealArray::operator=(const PoolRealArray &p_other)
+{
+ godot::api->godot_pool_real_array_destroy(&_godot_array);
+ godot::api->godot_pool_real_array_new_copy(&_godot_array, &p_other._godot_array);
+ return *this;
+}
+
PoolRealArray::Read PoolRealArray::read() const
{
Read read;
@@ -260,6 +296,18 @@ PoolStringArray::PoolStringArray()
godot::api->godot_pool_string_array_new(&_godot_array);
}
+PoolStringArray::PoolStringArray(const PoolStringArray &p_other)
+{
+ godot::api->godot_pool_string_array_new_copy(&_godot_array, &p_other._godot_array);
+}
+
+PoolStringArray &PoolStringArray::operator=(const PoolStringArray &p_other)
+{
+ godot::api->godot_pool_string_array_destroy(&_godot_array);
+ godot::api->godot_pool_string_array_new_copy(&_godot_array, &p_other._godot_array);
+ return *this;
+}
+
PoolStringArray::PoolStringArray(const Array& array)
{
godot::api->godot_pool_string_array_new_with_array(&_godot_array, (godot_array *) &array);
@@ -346,6 +394,18 @@ PoolVector2Array::PoolVector2Array()
godot::api->godot_pool_vector2_array_new(&_godot_array);
}
+PoolVector2Array::PoolVector2Array(const PoolVector2Array &p_other)
+{
+ godot::api->godot_pool_vector2_array_new_copy(&_godot_array, &p_other._godot_array);
+}
+
+PoolVector2Array &PoolVector2Array::operator=(const PoolVector2Array &p_other)
+{
+ godot::api->godot_pool_vector2_array_destroy(&_godot_array);
+ godot::api->godot_pool_vector2_array_new_copy(&_godot_array, &p_other._godot_array);
+ return *this;
+}
+
PoolVector2Array::PoolVector2Array(const Array& array)
{
godot::api->godot_pool_vector2_array_new_with_array(&_godot_array, (godot_array *) &array);
@@ -430,6 +490,18 @@ PoolVector3Array::PoolVector3Array()
godot::api->godot_pool_vector3_array_new(&_godot_array);
}
+PoolVector3Array::PoolVector3Array(const PoolVector3Array &p_other)
+{
+ godot::api->godot_pool_vector3_array_new_copy(&_godot_array, &p_other._godot_array);
+}
+
+PoolVector3Array &PoolVector3Array::operator=(const PoolVector3Array &p_other)
+{
+ godot::api->godot_pool_vector3_array_destroy(&_godot_array);
+ godot::api->godot_pool_vector3_array_new_copy(&_godot_array, &p_other._godot_array);
+ return *this;
+}
+
PoolVector3Array::PoolVector3Array(const Array& array)
{
godot::api->godot_pool_vector3_array_new_with_array(&_godot_array, (godot_array *) &array);
@@ -513,6 +585,18 @@ PoolColorArray::PoolColorArray()
godot::api->godot_pool_color_array_new(&_godot_array);
}
+PoolColorArray::PoolColorArray(const PoolColorArray &p_other)
+{
+ godot::api->godot_pool_color_array_new_copy(&_godot_array, &p_other._godot_array);
+}
+
+PoolColorArray &PoolColorArray::operator=(const PoolColorArray &p_other)
+{
+ godot::api->godot_pool_color_array_destroy(&_godot_array);
+ godot::api->godot_pool_color_array_new_copy(&_godot_array, &p_other._godot_array);
+ return *this;
+}
+
PoolColorArray::PoolColorArray(const Array& array)
{
godot::api->godot_pool_color_array_new_with_array(&_godot_array, (godot_array *) &array);