diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/core/Array.hpp | 4 | ||||
| -rw-r--r-- | include/core/NodePath.hpp | 5 | ||||
| -rw-r--r-- | include/core/PoolArrays.hpp | 37 | ||||
| -rw-r--r-- | include/core/String.hpp | 5 | ||||
| -rw-r--r-- | include/core/Variant.hpp | 9 | ||||
| -rw-r--r-- | include/core/Wrapped.hpp | 1 |
6 files changed, 58 insertions, 3 deletions
diff --git a/include/core/Array.hpp b/include/core/Array.hpp index 5227fea..5913fae 100644 --- a/include/core/Array.hpp +++ b/include/core/Array.hpp @@ -58,6 +58,8 @@ class Array { godot_array _godot_array; friend class Variant; + friend class Dictionary; + friend class String; inline explicit Array(const godot_array &other) { _godot_array = other; } @@ -88,7 +90,7 @@ public: Variant &operator[](const int idx); - Variant operator[](const int idx) const; + const Variant &operator[](const int idx) const; void append(const Variant &v); diff --git a/include/core/NodePath.hpp b/include/core/NodePath.hpp index 221c5ce..36dda7d 100644 --- a/include/core/NodePath.hpp +++ b/include/core/NodePath.hpp @@ -10,6 +10,11 @@ namespace godot { class NodePath { godot_node_path _node_path; + friend class Variant; + inline explicit NodePath(godot_node_path node_path) { + _node_path = node_path; + } + public: NodePath(); diff --git a/include/core/PoolArrays.hpp b/include/core/PoolArrays.hpp index 89172af..9421e83 100644 --- a/include/core/PoolArrays.hpp +++ b/include/core/PoolArrays.hpp @@ -18,6 +18,12 @@ class Array; class PoolByteArray { godot_pool_byte_array _godot_array; + friend class String; + friend class Variant; + inline explicit PoolByteArray(godot_pool_byte_array a) { + _godot_array = a; + } + public: class Read { @@ -116,6 +122,11 @@ public: class PoolIntArray { godot_pool_int_array _godot_array; + friend class Variant; + explicit inline PoolIntArray(godot_pool_int_array a) { + _godot_array = a; + } + public: class Read { friend class PoolIntArray; @@ -213,6 +224,11 @@ public: class PoolRealArray { godot_pool_real_array _godot_array; + friend class Variant; + explicit inline PoolRealArray(godot_pool_real_array a) { + _godot_array = a; + } + public: class Read { friend class PoolRealArray; @@ -310,6 +326,12 @@ public: class PoolStringArray { godot_pool_string_array _godot_array; + friend class String; + friend class Variant; + explicit inline PoolStringArray(godot_pool_string_array a) { + _godot_array = a; + } + public: class Read { friend class PoolStringArray; @@ -407,6 +429,11 @@ public: class PoolVector2Array { godot_pool_vector2_array _godot_array; + friend class Variant; + explicit inline PoolVector2Array(godot_pool_vector2_array a) { + _godot_array = a; + } + public: class Read { friend class PoolVector2Array; @@ -504,6 +531,11 @@ public: class PoolVector3Array { godot_pool_vector3_array _godot_array; + friend class Variant; + explicit inline PoolVector3Array(godot_pool_vector3_array a) { + _godot_array = a; + } + public: class Read { friend class PoolVector3Array; @@ -601,6 +633,11 @@ public: class PoolColorArray { godot_pool_color_array _godot_array; + friend class Variant; + explicit inline PoolColorArray(godot_pool_color_array a) { + _godot_array = a; + } + public: class Read { friend class PoolColorArray; diff --git a/include/core/String.hpp b/include/core/String.hpp index ebf161a..57e7eb7 100644 --- a/include/core/String.hpp +++ b/include/core/String.hpp @@ -29,7 +29,10 @@ public: class String { godot_string _godot_string; - String(godot_string contents) : + friend class Dictionary; + friend class NodePath; + friend class Variant; + explicit inline String(godot_string contents) : _godot_string(contents) {} public: diff --git a/include/core/Variant.hpp b/include/core/Variant.hpp index 5f40013..872a5a4 100644 --- a/include/core/Variant.hpp +++ b/include/core/Variant.hpp @@ -31,6 +31,11 @@ class Array; class Variant { godot_variant _godot_variant; + friend class Array; + inline explicit Variant(godot_variant v) { + _godot_variant = v; + } + public: enum Type { @@ -226,7 +231,9 @@ public: operator NodePath() const; operator RID() const; operator godot_object *() const; - template <typename T> operator T*() const { return static_cast<T*>(T::___get_from_variant(*this)); } + + template <typename T> + operator T *() const { return static_cast<T *>(T::___get_from_variant(*this)); } operator Dictionary() const; operator Array() const; diff --git a/include/core/Wrapped.hpp b/include/core/Wrapped.hpp index a26b448..6610bff 100644 --- a/include/core/Wrapped.hpp +++ b/include/core/Wrapped.hpp @@ -5,6 +5,7 @@ namespace godot { +// This is an internal base class used by the bindings. You should not need to access its members. class _Wrapped { public: godot_object *_owner; |
