Added copy constructors and assignment operators to Array and Dictionary
parent
7dde412e26
commit
00f089d7ed
|
@ -22,6 +22,8 @@ class Array {
|
||||||
godot_array _godot_array;
|
godot_array _godot_array;
|
||||||
public:
|
public:
|
||||||
Array();
|
Array();
|
||||||
|
Array(const Array & other);
|
||||||
|
Array & operator=(const Array & other);
|
||||||
|
|
||||||
Array(const PoolByteArray& a);
|
Array(const PoolByteArray& a);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ class Dictionary {
|
||||||
godot_dictionary _godot_dictionary;
|
godot_dictionary _godot_dictionary;
|
||||||
public:
|
public:
|
||||||
Dictionary();
|
Dictionary();
|
||||||
|
Dictionary(const Dictionary & other);
|
||||||
|
Dictionary & operator=(const Dictionary & other);
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,18 @@ Array::Array()
|
||||||
godot::api->godot_array_new(&_godot_array);
|
godot::api->godot_array_new(&_godot_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Array::Array(const Array & other)
|
||||||
|
{
|
||||||
|
godot::api->godot_array_new_copy(&_godot_array, &other._godot_array);
|
||||||
|
}
|
||||||
|
|
||||||
|
Array & Array::operator=(const Array & other)
|
||||||
|
{
|
||||||
|
godot::api->godot_array_destroy(&_godot_array);
|
||||||
|
godot::api->godot_array_new_copy(&_godot_array, &other._godot_array);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
Array::Array(const PoolByteArray& a)
|
Array::Array(const PoolByteArray& a)
|
||||||
{
|
{
|
||||||
godot::api->godot_array_new_pool_byte_array(&_godot_array, (godot_pool_byte_array *) &a);
|
godot::api->godot_array_new_pool_byte_array(&_godot_array, (godot_pool_byte_array *) &a);
|
||||||
|
|
|
@ -10,6 +10,18 @@ Dictionary::Dictionary()
|
||||||
godot::api->godot_dictionary_new(&_godot_dictionary);
|
godot::api->godot_dictionary_new(&_godot_dictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dictionary::Dictionary(const Dictionary & other)
|
||||||
|
{
|
||||||
|
godot::api->godot_dictionary_new_copy(&_godot_dictionary, &other._godot_dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary & Dictionary::operator=(const Dictionary & other)
|
||||||
|
{
|
||||||
|
godot::api->godot_dictionary_destroy(&_godot_dictionary);
|
||||||
|
godot::api->godot_dictionary_new_copy(&_godot_dictionary, &other._godot_dictionary);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
void Dictionary::clear()
|
void Dictionary::clear()
|
||||||
{
|
{
|
||||||
godot::api->godot_dictionary_clear(&_godot_dictionary);
|
godot::api->godot_dictionary_clear(&_godot_dictionary);
|
||||||
|
|
Loading…
Reference in New Issue