Daniele Bartolini 8 jaren geleden
bovenliggende
commit
732c4bd293

+ 2 - 6
src/core/filesystem/filesystem.h

@@ -21,6 +21,8 @@ public:
 
 	Filesystem() {};
 	virtual ~Filesystem() {};
+	Filesystem(const Filesystem&) = delete;
+	Filesystem& operator=(const Filesystem&) = delete;
 
 	/// Opens the file at the given @a path with the given @a mode.
 	virtual File* open(const char* path, FileOpenMode::Enum mode) = 0;
@@ -56,12 +58,6 @@ public:
 	/// the root path of the file source. If @a path is absolute,
 	/// the given path is returned.
 	virtual void get_absolute_path(const char* path, DynamicString& os_path) = 0;
-
-private:
-
-	// Disable copying
-	Filesystem(const Filesystem&);
-	Filesystem& operator=(const Filesystem&);
 };
 
 } // namespace crown

+ 2 - 6
src/core/memory/allocator.h

@@ -18,6 +18,8 @@ public:
 
 	Allocator() {}
 	virtual	~Allocator() {}
+	Allocator(const Allocator&) = delete;
+	Allocator& operator=(const Allocator&) = delete;
 
 	/// Allocates @a size bytes of memory aligned to the specified
 	/// @a align byte and returns a pointer to the first allocated byte.
@@ -37,12 +39,6 @@ public:
 	/// Default memory alignment in bytes.
 	static const u32 DEFAULT_ALIGN = 4;
 	static const u32 SIZE_NOT_TRACKED = 0xffffffffu;
-
-private:
-
-	// Disable copying
-	Allocator(const Allocator&);
-	Allocator& operator=(const Allocator&);
 };
 
 } // namespace crown

+ 4 - 12
src/core/thread/mutex.h

@@ -32,20 +32,15 @@ struct Mutex
 #endif
 
 	Mutex();
-
 	~Mutex();
+	Mutex(const Mutex&) = delete;
+	Mutex& operator=(const Mutex&) = delete;
 
 	/// Locks the mutex.
 	void lock();
 
 	/// Unlocks the mutex.
 	void unlock();
-
-private:
-
-	// Disable copying.
-	Mutex(const Mutex&);
-	Mutex& operator=(const Mutex&);
 };
 
 /// Automatically locks a mutex when created and unlocks when destroyed.
@@ -68,11 +63,8 @@ struct ScopedMutex
 		_mutex.unlock();
 	}
 
-private:
-
-	// Disable copying
-	ScopedMutex(const ScopedMutex&);
-	ScopedMutex& operator=(const ScopedMutex&);
+	ScopedMutex(const ScopedMutex&) = delete;
+	ScopedMutex& operator=(const ScopedMutex&) = delete;
 };
 
 } // namespace crown

+ 4 - 7
src/core/thread/semaphore.h

@@ -34,18 +34,15 @@ struct Semaphore
 #endif
 
 	Semaphore();
-
 	~Semaphore();
+	Semaphore(const Semaphore&) = delete;
+	Semaphore& operator=(const Semaphore&) = delete;
 
+	///
 	void post(u32 count = 1);
 
+	///
 	void wait();
-
-private:
-
-	// Disable copying
-	Semaphore(const Semaphore& s);
-	Semaphore& operator=(const Semaphore& s);
 };
 
 } // namespace crown

+ 5 - 7
src/core/thread/thread.h

@@ -41,13 +41,17 @@ struct Thread
 #endif
 
 	Thread();
-
 	~Thread();
+	Thread(const Thread&) = delete;
+	Thread& operator=(const Thread&) = delete;
 
+	///
 	void start(ThreadFunction func, void* user_data = NULL, u32 stack_size = 0);
 
+	///
 	void stop();
 
+	///
 	bool is_running();
 
 private:
@@ -59,12 +63,6 @@ private:
 #elif CROWN_PLATFORM_WINDOWS
 	static DWORD WINAPI thread_proc(void* arg);
 #endif
-
-private:
-
-	// Disable copying
-	Thread(const Thread&);
-	Thread& operator=(const Thread&);
 };
 
 } // namespace crown

+ 2 - 6
src/device/device.h

@@ -65,6 +65,8 @@ struct Device
 
 	///
 	Device(const DeviceOptions& opts, ConsoleServer& cs);
+	Device(const Device&) = delete;
+	Device& operator=(const Device&) = delete;
 
 	/// Runs the engine.
 	void run();
@@ -110,12 +112,6 @@ struct Device
 
 	/// Logs @a msg to log file and console.
 	void log(const char* msg);
-
-private:
-
-	// Disable copying
-	Device(const Device&);
-	Device& operator=(const Device&);
 };
 
 /// Runs the engine.

+ 2 - 6
src/lua/lua_environment.h

@@ -35,6 +35,8 @@ struct LuaEnvironment
 
 	LuaEnvironment();
 	~LuaEnvironment();
+	LuaEnvironment(const LuaEnvironment&) = delete;
+	LuaEnvironment& operator=(const LuaEnvironment&) = delete;
 
 	/// Loads lua libraries.
 	void load_libs();
@@ -91,12 +93,6 @@ struct LuaEnvironment
 
 	static int error(lua_State* L);
 	static int require(lua_State* L);
-
-private:
-
-	// Disable copying
-	LuaEnvironment(const LuaEnvironment&);
-	LuaEnvironment& operator=(const LuaEnvironment&);
 };
 
 } // namespace crown