From f6bd12c300b73e479012e2a7d598a3687aeff399 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Thu, 16 Dec 2021 20:44:59 +0100 Subject: [PATCH] Replace 'sf::NonCopyable' with '= delete' --- include/SFML/Audio/InputSoundFile.hpp | 15 ++- include/SFML/Audio/OutputSoundFile.hpp | 15 ++- include/SFML/Graphics/RenderTarget.hpp | 15 ++- include/SFML/Graphics/Shader.hpp | 15 ++- include/SFML/Network/Ftp.hpp | 21 +++- include/SFML/Network/Http.hpp | 15 ++- include/SFML/Network/Socket.hpp | 15 ++- include/SFML/System.hpp | 1 - include/SFML/System/FileInputStream.hpp | 15 ++- include/SFML/System/NonCopyable.hpp | 129 --------------------- include/SFML/Window/Context.hpp | 15 ++- include/SFML/Window/Cursor.hpp | 15 ++- include/SFML/Window/GlResource.hpp | 15 ++- include/SFML/Window/WindowBase.hpp | 15 ++- src/SFML/Graphics/ImageLoader.hpp | 16 ++- src/SFML/Graphics/RenderTextureImpl.hpp | 21 +++- src/SFML/Graphics/Shader.cpp | 14 ++- src/SFML/Network/Ftp.cpp | 14 ++- src/SFML/System/CMakeLists.txt | 1 - src/SFML/Window/Android/CursorImpl.hpp | 15 ++- src/SFML/Window/GlContext.cpp | 14 ++- src/SFML/Window/GlContext.hpp | 15 ++- src/SFML/Window/JoystickManager.hpp | 15 ++- src/SFML/Window/OSX/CursorImpl.hpp | 15 ++- src/SFML/Window/OSX/HIDInputManager.hpp | 15 ++- src/SFML/Window/OSX/HIDJoystickManager.hpp | 15 ++- src/SFML/Window/SensorManager.hpp | 15 ++- src/SFML/Window/Unix/CursorImpl.hpp | 15 ++- src/SFML/Window/Win32/CursorImpl.hpp | 15 ++- src/SFML/Window/WindowImpl.hpp | 15 ++- src/SFML/Window/iOS/CursorImpl.hpp | 15 ++- 31 files changed, 377 insertions(+), 184 deletions(-) delete mode 100644 include/SFML/System/NonCopyable.hpp diff --git a/include/SFML/Audio/InputSoundFile.hpp b/include/SFML/Audio/InputSoundFile.hpp index aa7700afe..156f5e23d 100644 --- a/include/SFML/Audio/InputSoundFile.hpp +++ b/include/SFML/Audio/InputSoundFile.hpp @@ -29,7 +29,6 @@ // Headers //////////////////////////////////////////////////////////// #include -#include #include #include #include @@ -44,7 +43,7 @@ class SoundFileReader; /// \brief Provide read access to sound files /// //////////////////////////////////////////////////////////// -class SFML_AUDIO_API InputSoundFile : NonCopyable +class SFML_AUDIO_API InputSoundFile { public: @@ -60,6 +59,18 @@ public: //////////////////////////////////////////////////////////// ~InputSoundFile(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + InputSoundFile(const InputSoundFile&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + InputSoundFile& operator=(const InputSoundFile&) = delete; + //////////////////////////////////////////////////////////// /// \brief Open a sound file from the disk for reading /// diff --git a/include/SFML/Audio/OutputSoundFile.hpp b/include/SFML/Audio/OutputSoundFile.hpp index 642646f0c..97be0ffb0 100644 --- a/include/SFML/Audio/OutputSoundFile.hpp +++ b/include/SFML/Audio/OutputSoundFile.hpp @@ -29,7 +29,6 @@ // Headers //////////////////////////////////////////////////////////// #include -#include #include @@ -41,7 +40,7 @@ class SoundFileWriter; /// \brief Provide write access to sound files /// //////////////////////////////////////////////////////////// -class SFML_AUDIO_API OutputSoundFile : NonCopyable +class SFML_AUDIO_API OutputSoundFile { public: @@ -59,6 +58,18 @@ public: //////////////////////////////////////////////////////////// ~OutputSoundFile(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + OutputSoundFile(const OutputSoundFile&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + OutputSoundFile& operator=(const OutputSoundFile&) = delete; + //////////////////////////////////////////////////////////// /// \brief Open the sound file from the disk for writing /// diff --git a/include/SFML/Graphics/RenderTarget.hpp b/include/SFML/Graphics/RenderTarget.hpp index 80347af41..71b12dde1 100644 --- a/include/SFML/Graphics/RenderTarget.hpp +++ b/include/SFML/Graphics/RenderTarget.hpp @@ -37,7 +37,6 @@ #include #include #include -#include namespace sf @@ -49,7 +48,7 @@ class VertexBuffer; /// \brief Base class for all render targets (window, texture, ...) /// //////////////////////////////////////////////////////////// -class SFML_GRAPHICS_API RenderTarget : NonCopyable +class SFML_GRAPHICS_API RenderTarget { public: @@ -59,6 +58,18 @@ public: //////////////////////////////////////////////////////////// virtual ~RenderTarget(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + RenderTarget(const RenderTarget&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + RenderTarget& operator=(const RenderTarget&) = delete; + //////////////////////////////////////////////////////////// /// \brief Clear the entire target with a single color /// diff --git a/include/SFML/Graphics/Shader.hpp b/include/SFML/Graphics/Shader.hpp index d7a3634b5..984fb77a5 100644 --- a/include/SFML/Graphics/Shader.hpp +++ b/include/SFML/Graphics/Shader.hpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -49,7 +48,7 @@ class Transform; /// \brief Shader class (vertex, geometry and fragment) /// //////////////////////////////////////////////////////////// -class SFML_GRAPHICS_API Shader : GlResource, NonCopyable +class SFML_GRAPHICS_API Shader : GlResource { public: @@ -97,6 +96,18 @@ public: //////////////////////////////////////////////////////////// ~Shader(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + Shader(const Shader&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + Shader& operator=(const Shader&) = delete; + //////////////////////////////////////////////////////////// /// \brief Load the vertex, geometry or fragment shader from a file /// diff --git a/include/SFML/Network/Ftp.hpp b/include/SFML/Network/Ftp.hpp index 0979ecf38..db9489268 100644 --- a/include/SFML/Network/Ftp.hpp +++ b/include/SFML/Network/Ftp.hpp @@ -30,7 +30,7 @@ //////////////////////////////////////////////////////////// #include #include -#include + #include #include #include @@ -44,7 +44,7 @@ class IpAddress; /// \brief A FTP client /// //////////////////////////////////////////////////////////// -class SFML_NETWORK_API Ftp : NonCopyable +class SFML_NETWORK_API Ftp { public: @@ -247,6 +247,11 @@ public: std::vector m_listing; //!< Directory/file names extracted from the data }; + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Ftp() = default; //////////////////////////////////////////////////////////// /// \brief Destructor @@ -257,6 +262,18 @@ public: //////////////////////////////////////////////////////////// ~Ftp(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + Ftp(const Ftp&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + Ftp& operator=(const Ftp&) = delete; + //////////////////////////////////////////////////////////// /// \brief Connect to the specified FTP server /// diff --git a/include/SFML/Network/Http.hpp b/include/SFML/Network/Http.hpp index 8c7a5de11..0e4e03d0c 100644 --- a/include/SFML/Network/Http.hpp +++ b/include/SFML/Network/Http.hpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -43,7 +42,7 @@ namespace sf /// \brief A HTTP client /// //////////////////////////////////////////////////////////// -class SFML_NETWORK_API Http : NonCopyable +class SFML_NETWORK_API Http { public: @@ -367,6 +366,18 @@ public: //////////////////////////////////////////////////////////// Http(const std::string& host, unsigned short port = 0); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + Http(const Http&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + Http& operator=(const Http&) = delete; + //////////////////////////////////////////////////////////// /// \brief Set the target host /// diff --git a/include/SFML/Network/Socket.hpp b/include/SFML/Network/Socket.hpp index 051599a68..78ad869fd 100644 --- a/include/SFML/Network/Socket.hpp +++ b/include/SFML/Network/Socket.hpp @@ -30,7 +30,6 @@ //////////////////////////////////////////////////////////// #include #include -#include #include @@ -42,7 +41,7 @@ class SocketSelector; /// \brief Base class for all the socket types /// //////////////////////////////////////////////////////////// -class SFML_NETWORK_API Socket : NonCopyable +class SFML_NETWORK_API Socket { public: @@ -76,6 +75,18 @@ public: //////////////////////////////////////////////////////////// virtual ~Socket(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + Socket(const Socket&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + Socket& operator=(const Socket&) = delete; + //////////////////////////////////////////////////////////// /// \brief Set the blocking state of the socket /// diff --git a/include/SFML/System.hpp b/include/SFML/System.hpp index 8c30726af..6524bac59 100644 --- a/include/SFML/System.hpp +++ b/include/SFML/System.hpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include diff --git a/include/SFML/System/FileInputStream.hpp b/include/SFML/System/FileInputStream.hpp index 501fa7c25..91e22771b 100644 --- a/include/SFML/System/FileInputStream.hpp +++ b/include/SFML/System/FileInputStream.hpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include @@ -52,7 +51,7 @@ namespace sf /// \brief Implementation of input stream based on a file /// //////////////////////////////////////////////////////////// -class SFML_SYSTEM_API FileInputStream : public InputStream, NonCopyable +class SFML_SYSTEM_API FileInputStream : public InputStream { public: //////////////////////////////////////////////////////////// @@ -67,6 +66,18 @@ public: //////////////////////////////////////////////////////////// ~FileInputStream() override; + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + FileInputStream(const FileInputStream&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + FileInputStream& operator=(const FileInputStream&) = delete; + //////////////////////////////////////////////////////////// /// \brief Open the stream from a file path /// diff --git a/include/SFML/System/NonCopyable.hpp b/include/SFML/System/NonCopyable.hpp deleted file mode 100644 index fa3ea4da3..000000000 --- a/include/SFML/System/NonCopyable.hpp +++ /dev/null @@ -1,129 +0,0 @@ -//////////////////////////////////////////////////////////// -// -// SFML - Simple and Fast Multimedia Library -// Copyright (C) 2007-2021 Laurent Gomila (laurent@sfml-dev.org) -// -// This software is provided 'as-is', without any express or implied warranty. -// In no event will the authors be held liable for any damages arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it freely, -// subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; -// you must not claim that you wrote the original software. -// If you use this software in a product, an acknowledgment -// in the product documentation would be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, -// and must not be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. -// -//////////////////////////////////////////////////////////// - -#ifndef SFML_NONCOPYABLE_HPP -#define SFML_NONCOPYABLE_HPP - -//////////////////////////////////////////////////////////// -// Headers -//////////////////////////////////////////////////////////// -#include - - -namespace sf -{ -//////////////////////////////////////////////////////////// -/// \brief Utility class that makes any derived -/// class non-copyable -/// -//////////////////////////////////////////////////////////// -class SFML_SYSTEM_API NonCopyable -{ -protected: - - //////////////////////////////////////////////////////////// - /// \brief Default constructor - /// - /// Because this class has a copy constructor, the compiler - /// will not automatically generate the default constructor. - /// That's why we must define it explicitly. - /// - //////////////////////////////////////////////////////////// - NonCopyable() {} - - //////////////////////////////////////////////////////////// - /// \brief Default destructor - /// - /// By declaring a protected destructor it's impossible to - /// call delete on a pointer of sf::NonCopyable, thus - /// preventing possible resource leaks. - /// - //////////////////////////////////////////////////////////// - ~NonCopyable() {} - -private: - - //////////////////////////////////////////////////////////// - /// \brief Disabled copy constructor - /// - /// By making the copy constructor private, the compiler will - /// trigger an error if anyone outside tries to use it. - /// To prevent NonCopyable or friend classes from using it, - /// we also give no definition, so that the linker will - /// produce an error if the first protection was inefficient. - /// - //////////////////////////////////////////////////////////// - NonCopyable(const NonCopyable&); - - //////////////////////////////////////////////////////////// - /// \brief Disabled assignment operator - /// - /// By making the assignment operator private, the compiler will - /// trigger an error if anyone outside tries to use it. - /// To prevent NonCopyable or friend classes from using it, - /// we also give no definition, so that the linker will - /// produce an error if the first protection was inefficient. - /// - //////////////////////////////////////////////////////////// - NonCopyable& operator =(const NonCopyable&); -}; - -} // namespace sf - - -#endif // SFML_NONCOPYABLE_HPP - - -//////////////////////////////////////////////////////////// -/// \class sf::NonCopyable -/// \ingroup system -/// -/// This class makes its instances non-copyable, by explicitly -/// disabling its copy constructor and its assignment operator. -/// -/// To create a non-copyable class, simply inherit from -/// sf::NonCopyable. -/// -/// The type of inheritance (public or private) doesn't matter, -/// the copy constructor and assignment operator are declared private -/// in sf::NonCopyable so they will end up being inaccessible in both -/// cases. Thus you can use a shorter syntax for inheriting from it -/// (see below). -/// -/// Usage example: -/// \code -/// class MyNonCopyableClass : sf::NonCopyable -/// { -/// ... -/// }; -/// \endcode -/// -/// Deciding whether the instances of a class can be copied -/// or not is a very important design choice. You are strongly -/// encouraged to think about it before writing a class, -/// and to use sf::NonCopyable when necessary to prevent -/// many potential future errors when using it. This is also -/// a very important indication to users of your class. -/// -//////////////////////////////////////////////////////////// diff --git a/include/SFML/Window/Context.hpp b/include/SFML/Window/Context.hpp index 2475f02f7..0fb5d82b0 100644 --- a/include/SFML/Window/Context.hpp +++ b/include/SFML/Window/Context.hpp @@ -31,7 +31,6 @@ #include #include #include -#include namespace sf @@ -47,7 +46,7 @@ using GlFunctionPointer = void (*)(); /// \brief Class holding a valid drawing context /// //////////////////////////////////////////////////////////// -class SFML_WINDOW_API Context : GlResource, NonCopyable +class SFML_WINDOW_API Context : GlResource { public: @@ -67,6 +66,18 @@ public: //////////////////////////////////////////////////////////// ~Context(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + Context(const Context&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + Context& operator=(const Context&) = delete; + //////////////////////////////////////////////////////////// /// \brief Activate or deactivate explicitly the context /// diff --git a/include/SFML/Window/Cursor.hpp b/include/SFML/Window/Cursor.hpp index 1c7a5d626..7d728b23a 100644 --- a/include/SFML/Window/Cursor.hpp +++ b/include/SFML/Window/Cursor.hpp @@ -29,7 +29,6 @@ // Headers //////////////////////////////////////////////////////////// #include -#include #include namespace sf @@ -43,7 +42,7 @@ namespace priv /// \brief Cursor defines the appearance of a system cursor /// //////////////////////////////////////////////////////////// -class SFML_WINDOW_API Cursor : NonCopyable +class SFML_WINDOW_API Cursor { public: @@ -130,6 +129,18 @@ public: //////////////////////////////////////////////////////////// ~Cursor(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + Cursor(const Cursor&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + Cursor& operator=(const Cursor&) = delete; + //////////////////////////////////////////////////////////// /// \brief Create a cursor with the provided image /// diff --git a/include/SFML/Window/GlResource.hpp b/include/SFML/Window/GlResource.hpp index e770ba9fc..d2cde6c37 100644 --- a/include/SFML/Window/GlResource.hpp +++ b/include/SFML/Window/GlResource.hpp @@ -29,7 +29,6 @@ // Headers //////////////////////////////////////////////////////////// #include -#include namespace sf @@ -76,7 +75,7 @@ protected: /// \brief RAII helper class to temporarily lock an available context for use /// //////////////////////////////////////////////////////////// - class SFML_WINDOW_API TransientContextLock : NonCopyable + class SFML_WINDOW_API TransientContextLock { public: //////////////////////////////////////////////////////////// @@ -90,6 +89,18 @@ protected: /// //////////////////////////////////////////////////////////// ~TransientContextLock(); + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + TransientContextLock(const TransientContextLock&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + TransientContextLock& operator=(const TransientContextLock&) = delete; }; }; diff --git a/include/SFML/Window/WindowBase.hpp b/include/SFML/Window/WindowBase.hpp index fc81b7a4c..72dbe5579 100644 --- a/include/SFML/Window/WindowBase.hpp +++ b/include/SFML/Window/WindowBase.hpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -53,7 +52,7 @@ class Event; /// \brief Window that serves as a base for other windows /// //////////////////////////////////////////////////////////// -class SFML_WINDOW_API WindowBase : NonCopyable +class SFML_WINDOW_API WindowBase { public: @@ -98,6 +97,18 @@ public: //////////////////////////////////////////////////////////// virtual ~WindowBase(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + WindowBase(const WindowBase&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + WindowBase& operator=(const WindowBase&) = delete; + //////////////////////////////////////////////////////////// /// \brief Create (or recreate) the window /// diff --git a/src/SFML/Graphics/ImageLoader.hpp b/src/SFML/Graphics/ImageLoader.hpp index 9db970b48..1f1839336 100644 --- a/src/SFML/Graphics/ImageLoader.hpp +++ b/src/SFML/Graphics/ImageLoader.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include #include #include @@ -44,7 +44,7 @@ namespace priv /// \brief Load/save image files /// //////////////////////////////////////////////////////////// -class ImageLoader : NonCopyable +class ImageLoader { public: @@ -131,6 +131,18 @@ private: /// //////////////////////////////////////////////////////////// ~ImageLoader(); + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + ImageLoader(const ImageLoader&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + ImageLoader& operator=(const ImageLoader&) = delete; }; } // namespace priv diff --git a/src/SFML/Graphics/RenderTextureImpl.hpp b/src/SFML/Graphics/RenderTextureImpl.hpp index a31fcc2c4..5ac53e9da 100644 --- a/src/SFML/Graphics/RenderTextureImpl.hpp +++ b/src/SFML/Graphics/RenderTextureImpl.hpp @@ -28,7 +28,6 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include namespace sf @@ -42,16 +41,34 @@ namespace priv /// \brief Abstract base class for render-texture implementations /// //////////////////////////////////////////////////////////// -class RenderTextureImpl : NonCopyable +class RenderTextureImpl { public: + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + RenderTextureImpl() = default; + //////////////////////////////////////////////////////////// /// \brief Destructor /// //////////////////////////////////////////////////////////// virtual ~RenderTextureImpl(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + RenderTextureImpl(const RenderTextureImpl&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + RenderTextureImpl& operator=(const RenderTextureImpl&) = delete; + //////////////////////////////////////////////////////////// /// \brief Create the render texture implementation /// diff --git a/src/SFML/Graphics/Shader.cpp b/src/SFML/Graphics/Shader.cpp index 3c9b0975e..d3bb8298e 100644 --- a/src/SFML/Graphics/Shader.cpp +++ b/src/SFML/Graphics/Shader.cpp @@ -177,7 +177,7 @@ Shader::CurrentTextureType Shader::CurrentTexture; //////////////////////////////////////////////////////////// -struct Shader::UniformBinder : private NonCopyable +struct Shader::UniformBinder { //////////////////////////////////////////////////////////// /// \brief Constructor: set up state before uniform is set @@ -211,6 +211,18 @@ struct Shader::UniformBinder : private NonCopyable glCheck(GLEXT_glUseProgramObject(savedProgram)); } + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + UniformBinder(const UniformBinder&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + UniformBinder& operator=(const UniformBinder&) = delete; + TransientContextLock lock; //!< Lock to keep context active while uniform is bound GLEXT_GLhandle savedProgram; //!< Handle to the previously active program object GLEXT_GLhandle currentProgram; //!< Handle to the program object of the modified sf::Shader instance diff --git a/src/SFML/Network/Ftp.cpp b/src/SFML/Network/Ftp.cpp index e048feb35..23cdc09e3 100644 --- a/src/SFML/Network/Ftp.cpp +++ b/src/SFML/Network/Ftp.cpp @@ -39,13 +39,25 @@ namespace sf { //////////////////////////////////////////////////////////// -class Ftp::DataChannel : NonCopyable +class Ftp::DataChannel { public: //////////////////////////////////////////////////////////// DataChannel(Ftp& owner); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + DataChannel(const DataChannel&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + DataChannel& operator=(const DataChannel&) = delete; + //////////////////////////////////////////////////////////// Ftp::Response open(Ftp::TransferMode mode); diff --git a/src/SFML/System/CMakeLists.txt b/src/SFML/System/CMakeLists.txt index 4c108936a..ada9e13f0 100644 --- a/src/SFML/System/CMakeLists.txt +++ b/src/SFML/System/CMakeLists.txt @@ -11,7 +11,6 @@ set(SRC ${INCROOT}/Export.hpp ${INCROOT}/InputStream.hpp ${INCROOT}/NativeActivity.hpp - ${INCROOT}/NonCopyable.hpp ${SRCROOT}/Sleep.cpp ${INCROOT}/Sleep.hpp ${SRCROOT}/String.cpp diff --git a/src/SFML/Window/Android/CursorImpl.hpp b/src/SFML/Window/Android/CursorImpl.hpp index 86c1bcc3f..4264c0409 100644 --- a/src/SFML/Window/Android/CursorImpl.hpp +++ b/src/SFML/Window/Android/CursorImpl.hpp @@ -29,7 +29,6 @@ // Headers //////////////////////////////////////////////////////////// #include -#include #include @@ -44,7 +43,7 @@ namespace priv /// This is a typical "not supported" implementation. /// //////////////////////////////////////////////////////////// -class CursorImpl : NonCopyable +class CursorImpl { public: @@ -64,6 +63,18 @@ public: //////////////////////////////////////////////////////////// ~CursorImpl(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + CursorImpl(const CursorImpl&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + CursorImpl& operator=(const CursorImpl&) = delete; + //////////////////////////////////////////////////////////// /// \brief Create a cursor with the provided image /// diff --git a/src/SFML/Window/GlContext.cpp b/src/SFML/Window/GlContext.cpp index 4e18d6df8..73c8a700f 100644 --- a/src/SFML/Window/GlContext.cpp +++ b/src/SFML/Window/GlContext.cpp @@ -180,7 +180,7 @@ namespace // This structure contains all the state necessary to // track TransientContext usage - struct TransientContext : private sf::NonCopyable + struct TransientContext { //////////////////////////////////////////////////////////// /// \brief Constructor @@ -217,6 +217,18 @@ namespace delete context; } + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + TransientContext(const TransientContext&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + TransientContext& operator=(const TransientContext&) = delete; + /////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// diff --git a/src/SFML/Window/GlContext.hpp b/src/SFML/Window/GlContext.hpp index 5ca45312f..20dad919a 100644 --- a/src/SFML/Window/GlContext.hpp +++ b/src/SFML/Window/GlContext.hpp @@ -32,7 +32,6 @@ #include #include #include -#include namespace sf @@ -45,7 +44,7 @@ class WindowImpl; /// \brief Abstract class representing an OpenGL context /// //////////////////////////////////////////////////////////// -class GlContext : NonCopyable +class GlContext { public: @@ -182,6 +181,18 @@ public: //////////////////////////////////////////////////////////// virtual ~GlContext(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + GlContext(const GlContext&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + GlContext& operator=(const GlContext&) = delete; + //////////////////////////////////////////////////////////// /// \brief Get the settings of the context /// diff --git a/src/SFML/Window/JoystickManager.hpp b/src/SFML/Window/JoystickManager.hpp index 9b6aab18a..ec6dd5a11 100644 --- a/src/SFML/Window/JoystickManager.hpp +++ b/src/SFML/Window/JoystickManager.hpp @@ -30,7 +30,6 @@ //////////////////////////////////////////////////////////// #include #include -#include namespace sf @@ -41,7 +40,7 @@ namespace priv /// \brief Global joystick manager /// //////////////////////////////////////////////////////////// -class JoystickManager : NonCopyable +class JoystickManager { public: @@ -103,6 +102,18 @@ private: //////////////////////////////////////////////////////////// ~JoystickManager(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + JoystickManager(const JoystickManager&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + JoystickManager& operator=(const JoystickManager&) = delete; + //////////////////////////////////////////////////////////// /// \brief Joystick information and state /// diff --git a/src/SFML/Window/OSX/CursorImpl.hpp b/src/SFML/Window/OSX/CursorImpl.hpp index 5ab9d03cc..7bf824bdc 100644 --- a/src/SFML/Window/OSX/CursorImpl.hpp +++ b/src/SFML/Window/OSX/CursorImpl.hpp @@ -30,7 +30,6 @@ // Headers //////////////////////////////////////////////////////////// #include -#include #include //////////////////////////////////////////////////////////// @@ -56,7 +55,7 @@ namespace priv /// \brief Mac OS X implementation of Cursor /// //////////////////////////////////////////////////////////// -class CursorImpl : NonCopyable +class CursorImpl { public: @@ -76,6 +75,18 @@ public: //////////////////////////////////////////////////////////// ~CursorImpl(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + CursorImpl(const CursorImpl&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + CursorImpl& operator=(const CursorImpl&) = delete; + //////////////////////////////////////////////////////////// /// \brief Create a cursor with the provided image /// diff --git a/src/SFML/Window/OSX/HIDInputManager.hpp b/src/SFML/Window/OSX/HIDInputManager.hpp index e5ad4fd18..1d34d7ed0 100644 --- a/src/SFML/Window/OSX/HIDInputManager.hpp +++ b/src/SFML/Window/OSX/HIDInputManager.hpp @@ -31,7 +31,6 @@ //////////////////////////////////////////////////////////// #include #include -#include #include #include #include @@ -51,7 +50,7 @@ using IOHIDElements = std::vector; /// Its purpose is to help sf::priv::InputImpl class. /// //////////////////////////////////////////////////////////// -class HIDInputManager : NonCopyable +class HIDInputManager { public: @@ -133,6 +132,18 @@ private: //////////////////////////////////////////////////////////// ~HIDInputManager(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + HIDInputManager(const HIDInputManager&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + HIDInputManager& operator=(const HIDInputManager&) = delete; + //////////////////////////////////////////////////////////// /// \brief Initialize the keyboard part of this class /// diff --git a/src/SFML/Window/OSX/HIDJoystickManager.hpp b/src/SFML/Window/OSX/HIDJoystickManager.hpp index b0edceca4..5150b27f5 100644 --- a/src/SFML/Window/OSX/HIDJoystickManager.hpp +++ b/src/SFML/Window/OSX/HIDJoystickManager.hpp @@ -29,7 +29,6 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include #include #include @@ -44,7 +43,7 @@ namespace priv /// It's only purpose is to help sf::priv::JoystickImpl class. /// //////////////////////////////////////////////////////////// -class HIDJoystickManager : NonCopyable +class HIDJoystickManager { public: @@ -88,6 +87,18 @@ private: //////////////////////////////////////////////////////////// ~HIDJoystickManager(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + HIDJoystickManager(const HIDJoystickManager&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + HIDJoystickManager& operator=(const HIDJoystickManager&) = delete; + //////////////////////////////////////////////////////////// /// \brief Make sure all event have been processed in the run loop /// diff --git a/src/SFML/Window/SensorManager.hpp b/src/SFML/Window/SensorManager.hpp index eacd7522c..dfa7ee05a 100644 --- a/src/SFML/Window/SensorManager.hpp +++ b/src/SFML/Window/SensorManager.hpp @@ -30,7 +30,6 @@ //////////////////////////////////////////////////////////// #include #include -#include namespace sf @@ -41,7 +40,7 @@ namespace priv /// \brief Global sensor manager /// //////////////////////////////////////////////////////////// -class SensorManager : NonCopyable +class SensorManager { public: @@ -112,6 +111,18 @@ private: //////////////////////////////////////////////////////////// ~SensorManager(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + SensorManager(const SensorManager&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + SensorManager& operator=(const SensorManager&) = delete; + //////////////////////////////////////////////////////////// /// \brief Sensor information and state /// diff --git a/src/SFML/Window/Unix/CursorImpl.hpp b/src/SFML/Window/Unix/CursorImpl.hpp index 3d6e15a37..42be2bcfc 100644 --- a/src/SFML/Window/Unix/CursorImpl.hpp +++ b/src/SFML/Window/Unix/CursorImpl.hpp @@ -29,7 +29,6 @@ // Headers //////////////////////////////////////////////////////////// #include -#include #include #include // Prevent conflict with macro None from Xlib #include @@ -43,7 +42,7 @@ namespace priv /// \brief Unix implementation of Cursor /// //////////////////////////////////////////////////////////// -class CursorImpl : NonCopyable +class CursorImpl { public: @@ -63,6 +62,18 @@ public: //////////////////////////////////////////////////////////// ~CursorImpl(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + CursorImpl(const CursorImpl&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + CursorImpl& operator=(const CursorImpl&) = delete; + //////////////////////////////////////////////////////////// /// \brief Create a cursor with the provided image /// diff --git a/src/SFML/Window/Win32/CursorImpl.hpp b/src/SFML/Window/Win32/CursorImpl.hpp index e545e7ce0..f990d5226 100755 --- a/src/SFML/Window/Win32/CursorImpl.hpp +++ b/src/SFML/Window/Win32/CursorImpl.hpp @@ -29,7 +29,6 @@ // Headers //////////////////////////////////////////////////////////// #include -#include #include namespace sf @@ -41,7 +40,7 @@ namespace priv /// \brief Win32 implementation of Cursor /// //////////////////////////////////////////////////////////// -class CursorImpl : NonCopyable +class CursorImpl { public: @@ -61,6 +60,18 @@ public: //////////////////////////////////////////////////////////// ~CursorImpl(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + CursorImpl(const CursorImpl&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + CursorImpl& operator=(const CursorImpl&) = delete; + //////////////////////////////////////////////////////////// /// \brief Create a cursor with the provided image /// diff --git a/src/SFML/Window/WindowImpl.hpp b/src/SFML/Window/WindowImpl.hpp index b81111302..c3d4a1977 100644 --- a/src/SFML/Window/WindowImpl.hpp +++ b/src/SFML/Window/WindowImpl.hpp @@ -29,7 +29,6 @@ // Headers //////////////////////////////////////////////////////////// #include -#include #include #include #include @@ -53,7 +52,7 @@ namespace priv /// \brief Abstract base class for OS-specific window implementation /// //////////////////////////////////////////////////////////// -class WindowImpl : NonCopyable +class WindowImpl { public: @@ -88,6 +87,18 @@ public: //////////////////////////////////////////////////////////// virtual ~WindowImpl(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + WindowImpl(const WindowImpl&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + WindowImpl& operator=(const WindowImpl&) = delete; + //////////////////////////////////////////////////////////// /// \brief Change the joystick threshold, i.e. the value below which /// no move event will be generated diff --git a/src/SFML/Window/iOS/CursorImpl.hpp b/src/SFML/Window/iOS/CursorImpl.hpp index d03146d63..5e797e04d 100644 --- a/src/SFML/Window/iOS/CursorImpl.hpp +++ b/src/SFML/Window/iOS/CursorImpl.hpp @@ -29,7 +29,6 @@ // Headers //////////////////////////////////////////////////////////// #include -#include #include @@ -44,7 +43,7 @@ namespace priv /// This is a typical "not supported" implementation. /// //////////////////////////////////////////////////////////// -class CursorImpl : NonCopyable +class CursorImpl { public: @@ -64,6 +63,18 @@ public: //////////////////////////////////////////////////////////// ~CursorImpl(); + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + CursorImpl(const CursorImpl&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + CursorImpl& operator=(const CursorImpl&) = delete; + //////////////////////////////////////////////////////////// /// \brief Create a cursor with the provided image ///