summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/CMakeLists.txt1
-rw-r--r--core/aabb.hh2
-rw-r--r--core/buffer.hh5
-rw-r--r--core/config.hh3
-rw-r--r--core/macros.hh16
5 files changed, 20 insertions, 7 deletions
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
index 7bac586..c2d5289 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -18,6 +18,7 @@ add_library(core STATIC
"${CMAKE_CURRENT_LIST_DIR}/floathacks.hh"
"${CMAKE_CURRENT_LIST_DIR}/image.cc"
"${CMAKE_CURRENT_LIST_DIR}/image.hh"
+ "${CMAKE_CURRENT_LIST_DIR}/macros.hh"
"${CMAKE_CURRENT_LIST_DIR}/pch.hh"
"${CMAKE_CURRENT_LIST_DIR}/resource.hh"
"${CMAKE_CURRENT_LIST_DIR}/strtools.cc"
diff --git a/core/aabb.hh b/core/aabb.hh
index 127f90f..fe07060 100644
--- a/core/aabb.hh
+++ b/core/aabb.hh
@@ -6,7 +6,7 @@
class AABB final {
public:
- DECLARE_DEFAULT_CTOR(AABB);
+ DECLARE_DEFAULT_CONSTRUCTOR(AABB);
explicit AABB(const glm::fvec3& min, const glm::fvec3& max);
virtual ~AABB(void) = default;
diff --git a/core/buffer.hh b/core/buffer.hh
index b63d0f5..1397e16 100644
--- a/core/buffer.hh
+++ b/core/buffer.hh
@@ -2,10 +2,11 @@
#define CORE_BUFFER_HH 1
#include "core/floathacks.hh"
+#include "core/macros.hh"
class ReadBuffer final {
public:
- explicit ReadBuffer(void) = default;
+ DECLARE_DEFAULT_CONSTRUCTOR(ReadBuffer);
explicit ReadBuffer(const void* data, std::size_t size);
explicit ReadBuffer(const ENetPacket* packet);
explicit ReadBuffer(PHYSFS_File* file);
@@ -48,7 +49,7 @@ private:
class WriteBuffer final {
public:
- explicit WriteBuffer(void) = default;
+ DECLARE_DEFAULT_CONSTRUCTOR(WriteBuffer);
virtual ~WriteBuffer(void) = default;
std::size_t size(void) const;
diff --git a/core/config.hh b/core/config.hh
index efb2ef0..a7f8500 100644
--- a/core/config.hh
+++ b/core/config.hh
@@ -3,6 +3,7 @@
#pragma once
#include "core/concepts.hh"
+#include "core/macros.hh"
class IConfigValue {
public:
@@ -94,7 +95,7 @@ private:
class Config final {
public:
- explicit Config(void) = default;
+ DECLARE_DEFAULT_CONSTRUCTOR(Config);
virtual ~Config(void) = default;
void load_cmdline(void);
diff --git a/core/macros.hh b/core/macros.hh
index 9042f49..9a76109 100644
--- a/core/macros.hh
+++ b/core/macros.hh
@@ -2,8 +2,18 @@
#define CORE_MACROS_HH 1
#pragma once
-#define DECLARE_DEFAULT_CTOR(type) \
-public: \
- type(void) = default
+#define DISABLE_COPY_OPERATORS(class_name) \
+public: \
+ explicit class_name(const class_name& other) = delete; \
+ class_name& operator=(const class_name& other) = delete
+
+#define DISABLE_MOVE_OPERATORS(class_name) \
+public: \
+ explicit class_name(class_name&& other) = delete; \
+ class_name& operator=(class_name&& other) = delete
+
+#define DECLARE_DEFAULT_CONSTRUCTOR(class_name) \
+public: \
+ class_name(void) = default
#endif /* CORE_MACROS_HH */