summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-10-05 10:35:59 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-10-05 10:35:59 +0200
commit50a534bf55f0ab0e79d49f0505ba5f4acce1cbad (patch)
tree8eeefcbff5d65bbd15738e1c2b6ccd92607a84e8 /include
parent91afc08de1bbd8277d96c81cf6bab0e83ceb96e7 (diff)
parent0455f72ede289b218c4e7830210278ad8c7f3887 (diff)
downloadredot-cpp-50a534bf55f0ab0e79d49f0505ba5f4acce1cbad.tar.gz
Merge pull request #880 from aaronfranke/struct
Use `struct` instead of `class` for core structures
Diffstat (limited to 'include')
-rw-r--r--include/godot_cpp/core/defs.hpp4
-rw-r--r--include/godot_cpp/variant/aabb.hpp7
-rw-r--r--include/godot_cpp/variant/basis.hpp7
-rw-r--r--include/godot_cpp/variant/color.hpp7
-rw-r--r--include/godot_cpp/variant/plane.hpp7
-rw-r--r--include/godot_cpp/variant/projection.hpp17
-rw-r--r--include/godot_cpp/variant/quaternion.hpp7
-rw-r--r--include/godot_cpp/variant/rect2.hpp11
-rw-r--r--include/godot_cpp/variant/rect2i.hpp9
-rw-r--r--include/godot_cpp/variant/transform2d.hpp7
-rw-r--r--include/godot_cpp/variant/transform3d.hpp7
-rw-r--r--include/godot_cpp/variant/vector2.hpp9
-rw-r--r--include/godot_cpp/variant/vector2i.hpp9
-rw-r--r--include/godot_cpp/variant/vector3.hpp13
-rw-r--r--include/godot_cpp/variant/vector3i.hpp9
-rw-r--r--include/godot_cpp/variant/vector4.hpp7
-rw-r--r--include/godot_cpp/variant/vector4i.hpp9
17 files changed, 35 insertions, 111 deletions
diff --git a/include/godot_cpp/core/defs.hpp b/include/godot_cpp/core/defs.hpp
index 9d300f4..70c4f7a 100644
--- a/include/godot_cpp/core/defs.hpp
+++ b/include/godot_cpp/core/defs.hpp
@@ -72,6 +72,10 @@
#endif
#endif
+#ifndef _NO_DISCARD_
+#define _NO_DISCARD_ [[nodiscard]]
+#endif
+
// Windows badly defines a lot of stuff we'll never use. Undefine it.
#ifdef _WIN32
#undef min // override standard definition
diff --git a/include/godot_cpp/variant/aabb.hpp b/include/godot_cpp/variant/aabb.hpp
index eaea36d..06ddc15 100644
--- a/include/godot_cpp/variant/aabb.hpp
+++ b/include/godot_cpp/variant/aabb.hpp
@@ -43,12 +43,7 @@
namespace godot {
-class AABB {
- _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
-
- friend class Variant;
-
-public:
+struct _NO_DISCARD_ AABB {
Vector3 position;
Vector3 size;
diff --git a/include/godot_cpp/variant/basis.hpp b/include/godot_cpp/variant/basis.hpp
index 05881f8..48c3b0c 100644
--- a/include/godot_cpp/variant/basis.hpp
+++ b/include/godot_cpp/variant/basis.hpp
@@ -37,12 +37,7 @@
namespace godot {
-class Basis {
- _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
-
- friend class Variant;
-
-public:
+struct _NO_DISCARD_ Basis {
Vector3 rows[3] = {
Vector3(1, 0, 0),
Vector3(0, 1, 0),
diff --git a/include/godot_cpp/variant/color.hpp b/include/godot_cpp/variant/color.hpp
index 5d141a2..f328d7f 100644
--- a/include/godot_cpp/variant/color.hpp
+++ b/include/godot_cpp/variant/color.hpp
@@ -37,12 +37,7 @@ namespace godot {
class String;
-class Color {
- _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
-
- friend class Variant;
-
-public:
+struct _NO_DISCARD_ Color {
union {
struct {
float r;
diff --git a/include/godot_cpp/variant/plane.hpp b/include/godot_cpp/variant/plane.hpp
index 3b1ec85..3a13ed2 100644
--- a/include/godot_cpp/variant/plane.hpp
+++ b/include/godot_cpp/variant/plane.hpp
@@ -37,12 +37,7 @@
namespace godot {
-class Plane {
- _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
-
- friend class Variant;
-
-public:
+struct _NO_DISCARD_ Plane {
Vector3 normal;
real_t d = 0;
diff --git a/include/godot_cpp/variant/projection.hpp b/include/godot_cpp/variant/projection.hpp
index f26ce5a..5472490 100644
--- a/include/godot_cpp/variant/projection.hpp
+++ b/include/godot_cpp/variant/projection.hpp
@@ -39,18 +39,13 @@
namespace godot {
-class AABB;
-class Plane;
-class Rect2;
-class Transform3D;
-class Vector2;
+struct AABB;
+struct Plane;
+struct Rect2;
+struct Transform3D;
+struct Vector2;
-class Projection {
- _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
-
- friend class Variant;
-
-public:
+struct _NO_DISCARD_ Projection {
enum Planes {
PLANE_NEAR,
PLANE_FAR,
diff --git a/include/godot_cpp/variant/quaternion.hpp b/include/godot_cpp/variant/quaternion.hpp
index 815b116..e84202d 100644
--- a/include/godot_cpp/variant/quaternion.hpp
+++ b/include/godot_cpp/variant/quaternion.hpp
@@ -36,12 +36,7 @@
namespace godot {
-class Quaternion {
- _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
-
- friend class Variant;
-
-public:
+struct _NO_DISCARD_ Quaternion {
union {
struct {
real_t x;
diff --git a/include/godot_cpp/variant/rect2.hpp b/include/godot_cpp/variant/rect2.hpp
index 70b041d..6be075d 100644
--- a/include/godot_cpp/variant/rect2.hpp
+++ b/include/godot_cpp/variant/rect2.hpp
@@ -37,16 +37,11 @@
namespace godot {
-class Rect2i;
class String;
-class Transform2D;
+struct Rect2i;
+struct Transform2D;
-class Rect2 {
- _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
-
- friend class Variant;
-
-public:
+struct _NO_DISCARD_ Rect2 {
Point2 position;
Size2 size;
diff --git a/include/godot_cpp/variant/rect2i.hpp b/include/godot_cpp/variant/rect2i.hpp
index a930cbd..30c7d2d 100644
--- a/include/godot_cpp/variant/rect2i.hpp
+++ b/include/godot_cpp/variant/rect2i.hpp
@@ -37,15 +37,10 @@
namespace godot {
-class Rect2;
class String;
+struct Rect2;
-class Rect2i {
- _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
-
- friend class Variant;
-
-public:
+struct _NO_DISCARD_ Rect2i {
Point2i position;
Size2i size;
diff --git a/include/godot_cpp/variant/transform2d.hpp b/include/godot_cpp/variant/transform2d.hpp
index be81687..dd0c409 100644
--- a/include/godot_cpp/variant/transform2d.hpp
+++ b/include/godot_cpp/variant/transform2d.hpp
@@ -39,12 +39,7 @@
namespace godot {
-class Transform2D {
- _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
-
- friend class Variant;
-
-public:
+struct _NO_DISCARD_ Transform2D {
// Warning #1: basis of Transform2D is stored differently from Basis. In terms of columns array, the basis matrix looks like "on paper":
// M = (columns[0][0] columns[1][0])
// (columns[0][1] columns[1][1])
diff --git a/include/godot_cpp/variant/transform3d.hpp b/include/godot_cpp/variant/transform3d.hpp
index c6220f3..e4c8c74 100644
--- a/include/godot_cpp/variant/transform3d.hpp
+++ b/include/godot_cpp/variant/transform3d.hpp
@@ -39,12 +39,7 @@
namespace godot {
-class Transform3D {
- _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
-
- friend class Variant;
-
-public:
+struct _NO_DISCARD_ Transform3D {
Basis basis;
Vector3 origin;
diff --git a/include/godot_cpp/variant/vector2.hpp b/include/godot_cpp/variant/vector2.hpp
index b210c7d..725a283 100644
--- a/include/godot_cpp/variant/vector2.hpp
+++ b/include/godot_cpp/variant/vector2.hpp
@@ -37,14 +37,9 @@
namespace godot {
class String;
-class Vector2i;
+struct Vector2i;
-class Vector2 {
- _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
-
- friend class Variant;
-
-public:
+struct _NO_DISCARD_ Vector2 {
static const int AXIS_COUNT = 2;
enum Axis {
diff --git a/include/godot_cpp/variant/vector2i.hpp b/include/godot_cpp/variant/vector2i.hpp
index 5c9d6ad..3428e1f 100644
--- a/include/godot_cpp/variant/vector2i.hpp
+++ b/include/godot_cpp/variant/vector2i.hpp
@@ -37,14 +37,9 @@
namespace godot {
class String;
-class Vector2;
+struct Vector2;
-class Vector2i {
- _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
-
- friend class Variant;
-
-public:
+struct _NO_DISCARD_ Vector2i {
static const int AXIS_COUNT = 2;
enum Axis {
diff --git a/include/godot_cpp/variant/vector3.hpp b/include/godot_cpp/variant/vector3.hpp
index 4c9213d..85c89d8 100644
--- a/include/godot_cpp/variant/vector3.hpp
+++ b/include/godot_cpp/variant/vector3.hpp
@@ -36,17 +36,12 @@
namespace godot {
-class Basis;
class String;
-class Vector2;
-class Vector3i;
+struct Basis;
+struct Vector2;
+struct Vector3i;
-class Vector3 {
- _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
-
- friend class Variant;
-
-public:
+struct _NO_DISCARD_ Vector3 {
static const int AXIS_COUNT = 3;
enum Axis {
diff --git a/include/godot_cpp/variant/vector3i.hpp b/include/godot_cpp/variant/vector3i.hpp
index c5526e0..913ea3d 100644
--- a/include/godot_cpp/variant/vector3i.hpp
+++ b/include/godot_cpp/variant/vector3i.hpp
@@ -37,14 +37,9 @@
namespace godot {
class String;
-class Vector3;
+struct Vector3;
-class Vector3i {
- _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
-
- friend class Variant;
-
-public:
+struct _NO_DISCARD_ Vector3i {
static const int AXIS_COUNT = 3;
enum Axis {
diff --git a/include/godot_cpp/variant/vector4.hpp b/include/godot_cpp/variant/vector4.hpp
index 2c1403c..4b4f6f1 100644
--- a/include/godot_cpp/variant/vector4.hpp
+++ b/include/godot_cpp/variant/vector4.hpp
@@ -38,12 +38,7 @@ namespace godot {
class String;
-class Vector4 {
- _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
-
- friend class Variant;
-
-public:
+struct _NO_DISCARD_ Vector4 {
static const int AXIS_COUNT = 4;
enum Axis {
diff --git a/include/godot_cpp/variant/vector4i.hpp b/include/godot_cpp/variant/vector4i.hpp
index 979fc83..773198b 100644
--- a/include/godot_cpp/variant/vector4i.hpp
+++ b/include/godot_cpp/variant/vector4i.hpp
@@ -37,14 +37,9 @@
namespace godot {
class String;
-class Vector4;
+struct Vector4;
-class Vector4i {
- _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
-
- friend class Variant;
-
-public:
+struct _NO_DISCARD_ Vector4i {
static const int AXIS_COUNT = 4;
enum Axis {