From 1d42db24398f7d94a6c9c641225d8088d203a3ea Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 26 Sep 2015 16:13:54 -0400 Subject: [PATCH] Common: Move NonCopyable to its own header --- Source/Core/AudioCommon/WaveFile.h | 1 + Source/Core/Common/CodeBlock.h | 1 + Source/Core/Common/Common.h | 12 ------------ Source/Core/Common/Common.vcxproj | 1 + Source/Core/Common/FileUtil.h | 1 + Source/Core/Common/Logging/LogManager.h | 1 + Source/Core/Common/NonCopyable.h | 17 +++++++++++++++++ Source/Core/Common/PcapFile.h | 1 + Source/Core/Core/ConfigManager.h | 1 + Source/Core/Core/DSP/DSPCaptureLogger.h | 3 ++- Source/Core/Core/HW/GCMemcard.h | 1 + Source/Core/Core/HW/GCMemcardDirectory.h | 1 + Source/Core/Core/HW/MMIOHandlers.h | 1 + Source/Core/Core/HW/WiimoteReal/WiimoteReal.h | 1 + Source/Core/Core/IPC_HLE/WII_Socket.h | 2 ++ Source/Core/VideoBackends/OGL/SamplerCache.h | 3 ++- .../Core/VideoBackends/Software/SWVideoConfig.h | 3 ++- Source/Core/VideoCommon/NativeVertexFormat.h | 4 +++- 18 files changed, 39 insertions(+), 16 deletions(-) create mode 100644 Source/Core/Common/NonCopyable.h diff --git a/Source/Core/AudioCommon/WaveFile.h b/Source/Core/AudioCommon/WaveFile.h index 02ed48ced7..90ab26c9ea 100644 --- a/Source/Core/AudioCommon/WaveFile.h +++ b/Source/Core/AudioCommon/WaveFile.h @@ -17,6 +17,7 @@ #include #include "Common/CommonTypes.h" #include "Common/FileUtil.h" +#include "Common/NonCopyable.h" class WaveFileWriter : NonCopyable { diff --git a/Source/Core/Common/CodeBlock.h b/Source/Core/Common/CodeBlock.h index 5a7df9b87f..864dac5e63 100644 --- a/Source/Core/Common/CodeBlock.h +++ b/Source/Core/Common/CodeBlock.h @@ -6,6 +6,7 @@ #include "Common/Common.h" #include "Common/MemoryUtil.h" +#include "Common/NonCopyable.h" // Everything that needs to generate code should inherit from this. // You get memory management for free, plus, you can use all emitter functions without diff --git a/Source/Core/Common/Common.h b/Source/Core/Common/Common.h index c93cf4fa48..4a23e71c77 100644 --- a/Source/Core/Common/Common.h +++ b/Source/Core/Common/Common.h @@ -30,18 +30,6 @@ extern const char *netplay_dolphin_ver; #define UNUSED #endif -// An inheritable class to disallow the copy constructor and operator= functions -class NonCopyable -{ -protected: - constexpr NonCopyable() = default; - ~NonCopyable() = default; - -private: - NonCopyable(NonCopyable&) = delete; - NonCopyable& operator=(NonCopyable&) = delete; -}; - #if defined _WIN32 // Memory leak checks diff --git a/Source/Core/Common/Common.vcxproj b/Source/Core/Common/Common.vcxproj index fe95d75289..12cbc07e8a 100644 --- a/Source/Core/Common/Common.vcxproj +++ b/Source/Core/Common/Common.vcxproj @@ -106,6 +106,7 @@ + diff --git a/Source/Core/Common/FileUtil.h b/Source/Core/Common/FileUtil.h index ce8598a822..4bb8bf63a8 100644 --- a/Source/Core/Common/FileUtil.h +++ b/Source/Core/Common/FileUtil.h @@ -11,6 +11,7 @@ #include #include "Common/Common.h" +#include "Common/NonCopyable.h" #ifdef _WIN32 #include "Common/StringUtil.h" diff --git a/Source/Core/Common/Logging/LogManager.h b/Source/Core/Common/Logging/LogManager.h index c03610ae02..af2ad40cc0 100644 --- a/Source/Core/Common/Logging/LogManager.h +++ b/Source/Core/Common/Logging/LogManager.h @@ -11,6 +11,7 @@ #include #include "Common/Common.h" +#include "Common/NonCopyable.h" #define MAX_MESSAGES 8000 #define MAX_MSGLEN 1024 diff --git a/Source/Core/Common/NonCopyable.h b/Source/Core/Common/NonCopyable.h new file mode 100644 index 0000000000..9fc1456a4e --- /dev/null +++ b/Source/Core/Common/NonCopyable.h @@ -0,0 +1,17 @@ +// Copyright 2015 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +// An inheritable class to disallow the copy constructor and operator= functions +class NonCopyable +{ +protected: + constexpr NonCopyable() = default; + ~NonCopyable() = default; + +private: + NonCopyable(NonCopyable&) = delete; + NonCopyable& operator=(NonCopyable&) = delete; +}; diff --git a/Source/Core/Common/PcapFile.h b/Source/Core/Common/PcapFile.h index 7e1ecdf6b4..39d2abcc44 100644 --- a/Source/Core/Common/PcapFile.h +++ b/Source/Core/Common/PcapFile.h @@ -18,6 +18,7 @@ #include "Common/CommonTypes.h" #include "Common/FileUtil.h" +#include "Common/NonCopyable.h" class PCAP final : public NonCopyable { diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index 06bd03e92c..1714d7a880 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -8,6 +8,7 @@ #include #include "Common/IniFile.h" +#include "Common/NonCopyable.h" #include "Common/SysConf.h" #include "Core/HW/EXI_Device.h" #include "Core/HW/SI_Device.h" diff --git a/Source/Core/Core/DSP/DSPCaptureLogger.h b/Source/Core/Core/DSP/DSPCaptureLogger.h index a5028352b2..79e97cf8a8 100644 --- a/Source/Core/Core/DSP/DSPCaptureLogger.h +++ b/Source/Core/Core/DSP/DSPCaptureLogger.h @@ -7,7 +7,8 @@ #include #include -#include "Common/Common.h" +#include "Common/CommonTypes.h" +#include "Common/NonCopyable.h" class PCAP; diff --git a/Source/Core/Core/HW/GCMemcard.h b/Source/Core/Core/HW/GCMemcard.h index cdd760f2cf..d3077d34cc 100644 --- a/Source/Core/Core/HW/GCMemcard.h +++ b/Source/Core/Core/HW/GCMemcard.h @@ -10,6 +10,7 @@ #include "Common/CommonPaths.h" #include "Common/CommonTypes.h" #include "Common/NandPaths.h" +#include "Common/NonCopyable.h" #include "Common/StringUtil.h" #include "Core/HW/EXI_DeviceIPL.h" diff --git a/Source/Core/Core/HW/GCMemcardDirectory.h b/Source/Core/Core/HW/GCMemcardDirectory.h index 2ddbfa4a1b..45aaa0628b 100644 --- a/Source/Core/Core/HW/GCMemcardDirectory.h +++ b/Source/Core/Core/HW/GCMemcardDirectory.h @@ -12,6 +12,7 @@ #include #include "Common/Event.h" +#include "Common/NonCopyable.h" #include "Core/HW/GCMemcard.h" #include "DiscIO/Volume.h" diff --git a/Source/Core/Core/HW/MMIOHandlers.h b/Source/Core/Core/HW/MMIOHandlers.h index 54cadf11cd..2a72608232 100644 --- a/Source/Core/Core/HW/MMIOHandlers.h +++ b/Source/Core/Core/HW/MMIOHandlers.h @@ -8,6 +8,7 @@ #include #include "Common/CommonTypes.h" +#include "Common/NonCopyable.h" // All the templated and very repetitive MMIO-related code is isolated in this // file for easier reading. It mostly contains code related to handling methods diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h index 5fc1ca9045..9a63991550 100644 --- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h +++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h @@ -12,6 +12,7 @@ #include #include "Common/FifoQueue.h" +#include "Common/NonCopyable.h" #include "Common/Timer.h" #include "Core/HW/Wiimote.h" #include "Core/HW/WiimoteEmu/WiimoteEmu.h" diff --git a/Source/Core/Core/IPC_HLE/WII_Socket.h b/Source/Core/Core/IPC_HLE/WII_Socket.h index a5bc095c48..c12995ed2e 100644 --- a/Source/Core/Core/IPC_HLE/WII_Socket.h +++ b/Source/Core/Core/IPC_HLE/WII_Socket.h @@ -47,6 +47,8 @@ typedef struct pollfd pollfd_t; #include #include +#include "Common/CommonTypes.h" +#include "Common/NonCopyable.h" #include "Core/IPC_HLE/WII_IPC_HLE.h" #include "Core/IPC_HLE/WII_IPC_HLE_Device_net.h" #include "Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h" diff --git a/Source/Core/VideoBackends/OGL/SamplerCache.h b/Source/Core/VideoBackends/OGL/SamplerCache.h index 05a4836fcf..bb4a7353ab 100644 --- a/Source/Core/VideoBackends/OGL/SamplerCache.h +++ b/Source/Core/VideoBackends/OGL/SamplerCache.h @@ -6,8 +6,9 @@ #include +#include "Common/CommonTypes.h" +#include "Common/NonCopyable.h" #include "Common/GL/GLUtil.h" - #include "VideoBackends/OGL/Render.h" namespace OGL diff --git a/Source/Core/VideoBackends/Software/SWVideoConfig.h b/Source/Core/VideoBackends/Software/SWVideoConfig.h index 7a58af41a6..4dfa8ac87d 100644 --- a/Source/Core/VideoBackends/Software/SWVideoConfig.h +++ b/Source/Core/VideoBackends/Software/SWVideoConfig.h @@ -4,7 +4,8 @@ #pragma once -#include "Common/Common.h" +#include "Common/CommonTypes.h" +#include "Common/NonCopyable.h" #define STATISTICS 1 diff --git a/Source/Core/VideoCommon/NativeVertexFormat.h b/Source/Core/VideoCommon/NativeVertexFormat.h index c64d94fa77..df86b90946 100644 --- a/Source/Core/VideoCommon/NativeVertexFormat.h +++ b/Source/Core/VideoCommon/NativeVertexFormat.h @@ -4,10 +4,12 @@ #pragma once +#include #include // for hash -#include "Common/Common.h" +#include "Common/CommonTypes.h" #include "Common/Hash.h" +#include "Common/NonCopyable.h" // m_components enum