Replace 'sf::NonCopyable' with '= delete'

This commit is contained in:
Vittorio Romeo 2021-12-16 20:44:59 +01:00
parent 3c7fba0f96
commit f6bd12c300
31 changed files with 377 additions and 184 deletions

View File

@ -29,7 +29,6 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Audio/Export.hpp> #include <SFML/Audio/Export.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/Time.hpp> #include <SFML/System/Time.hpp>
#include <string> #include <string>
#include <cstddef> #include <cstddef>
@ -44,7 +43,7 @@ class SoundFileReader;
/// \brief Provide read access to sound files /// \brief Provide read access to sound files
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_AUDIO_API InputSoundFile : NonCopyable class SFML_AUDIO_API InputSoundFile
{ {
public: public:
@ -60,6 +59,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~InputSoundFile(); ~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 /// \brief Open a sound file from the disk for reading
/// ///

View File

@ -29,7 +29,6 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Audio/Export.hpp> #include <SFML/Audio/Export.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <string> #include <string>
@ -41,7 +40,7 @@ class SoundFileWriter;
/// \brief Provide write access to sound files /// \brief Provide write access to sound files
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_AUDIO_API OutputSoundFile : NonCopyable class SFML_AUDIO_API OutputSoundFile
{ {
public: public:
@ -59,6 +58,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~OutputSoundFile(); ~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 /// \brief Open the sound file from the disk for writing
/// ///

View File

@ -37,7 +37,6 @@
#include <SFML/Graphics/RenderStates.hpp> #include <SFML/Graphics/RenderStates.hpp>
#include <SFML/Graphics/PrimitiveType.hpp> #include <SFML/Graphics/PrimitiveType.hpp>
#include <SFML/Graphics/Vertex.hpp> #include <SFML/Graphics/Vertex.hpp>
#include <SFML/System/NonCopyable.hpp>
namespace sf namespace sf
@ -49,7 +48,7 @@ class VertexBuffer;
/// \brief Base class for all render targets (window, texture, ...) /// \brief Base class for all render targets (window, texture, ...)
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_GRAPHICS_API RenderTarget : NonCopyable class SFML_GRAPHICS_API RenderTarget
{ {
public: public:
@ -59,6 +58,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual ~RenderTarget(); 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 /// \brief Clear the entire target with a single color
/// ///

View File

@ -31,7 +31,6 @@
#include <SFML/Graphics/Export.hpp> #include <SFML/Graphics/Export.hpp>
#include <SFML/Graphics/Glsl.hpp> #include <SFML/Graphics/Glsl.hpp>
#include <SFML/Window/GlResource.hpp> #include <SFML/Window/GlResource.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/Vector2.hpp> #include <SFML/System/Vector2.hpp>
#include <SFML/System/Vector3.hpp> #include <SFML/System/Vector3.hpp>
#include <string> #include <string>
@ -49,7 +48,7 @@ class Transform;
/// \brief Shader class (vertex, geometry and fragment) /// \brief Shader class (vertex, geometry and fragment)
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_GRAPHICS_API Shader : GlResource, NonCopyable class SFML_GRAPHICS_API Shader : GlResource
{ {
public: public:
@ -97,6 +96,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~Shader(); ~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 /// \brief Load the vertex, geometry or fragment shader from a file
/// ///

View File

@ -30,7 +30,7 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Network/Export.hpp> #include <SFML/Network/Export.hpp>
#include <SFML/Network/TcpSocket.hpp> #include <SFML/Network/TcpSocket.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/Time.hpp> #include <SFML/System/Time.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
@ -44,7 +44,7 @@ class IpAddress;
/// \brief A FTP client /// \brief A FTP client
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_NETWORK_API Ftp : NonCopyable class SFML_NETWORK_API Ftp
{ {
public: public:
@ -247,6 +247,11 @@ public:
std::vector<std::string> m_listing; //!< Directory/file names extracted from the data std::vector<std::string> m_listing; //!< Directory/file names extracted from the data
}; };
////////////////////////////////////////////////////////////
/// \brief Default constructor
///
////////////////////////////////////////////////////////////
Ftp() = default;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Destructor /// \brief Destructor
@ -257,6 +262,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~Ftp(); ~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 /// \brief Connect to the specified FTP server
/// ///

View File

@ -31,7 +31,6 @@
#include <SFML/Network/Export.hpp> #include <SFML/Network/Export.hpp>
#include <SFML/Network/IpAddress.hpp> #include <SFML/Network/IpAddress.hpp>
#include <SFML/Network/TcpSocket.hpp> #include <SFML/Network/TcpSocket.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/Time.hpp> #include <SFML/System/Time.hpp>
#include <map> #include <map>
#include <string> #include <string>
@ -43,7 +42,7 @@ namespace sf
/// \brief A HTTP client /// \brief A HTTP client
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_NETWORK_API Http : NonCopyable class SFML_NETWORK_API Http
{ {
public: public:
@ -367,6 +366,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Http(const std::string& host, unsigned short port = 0); 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 /// \brief Set the target host
/// ///

View File

@ -30,7 +30,6 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Network/Export.hpp> #include <SFML/Network/Export.hpp>
#include <SFML/Network/SocketHandle.hpp> #include <SFML/Network/SocketHandle.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <vector> #include <vector>
@ -42,7 +41,7 @@ class SocketSelector;
/// \brief Base class for all the socket types /// \brief Base class for all the socket types
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_NETWORK_API Socket : NonCopyable class SFML_NETWORK_API Socket
{ {
public: public:
@ -76,6 +75,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual ~Socket(); 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 /// \brief Set the blocking state of the socket
/// ///

View File

@ -35,7 +35,6 @@
#include <SFML/System/FileInputStream.hpp> #include <SFML/System/FileInputStream.hpp>
#include <SFML/System/InputStream.hpp> #include <SFML/System/InputStream.hpp>
#include <SFML/System/MemoryInputStream.hpp> #include <SFML/System/MemoryInputStream.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/Sleep.hpp> #include <SFML/System/Sleep.hpp>
#include <SFML/System/String.hpp> #include <SFML/System/String.hpp>
#include <SFML/System/Time.hpp> #include <SFML/System/Time.hpp>

View File

@ -31,7 +31,6 @@
#include <SFML/Config.hpp> #include <SFML/Config.hpp>
#include <SFML/System/Export.hpp> #include <SFML/System/Export.hpp>
#include <SFML/System/InputStream.hpp> #include <SFML/System/InputStream.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <cstdio> #include <cstdio>
#include <string> #include <string>
@ -52,7 +51,7 @@ namespace sf
/// \brief Implementation of input stream based on a file /// \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: public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -67,6 +66,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~FileInputStream() override; ~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 /// \brief Open the stream from a file path
/// ///

View File

@ -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 <SFML/System/Export.hpp>
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.
///
////////////////////////////////////////////////////////////

View File

@ -31,7 +31,6 @@
#include <SFML/Window/Export.hpp> #include <SFML/Window/Export.hpp>
#include <SFML/Window/GlResource.hpp> #include <SFML/Window/GlResource.hpp>
#include <SFML/Window/ContextSettings.hpp> #include <SFML/Window/ContextSettings.hpp>
#include <SFML/System/NonCopyable.hpp>
namespace sf namespace sf
@ -47,7 +46,7 @@ using GlFunctionPointer = void (*)();
/// \brief Class holding a valid drawing context /// \brief Class holding a valid drawing context
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_WINDOW_API Context : GlResource, NonCopyable class SFML_WINDOW_API Context : GlResource
{ {
public: public:
@ -67,6 +66,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~Context(); ~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 /// \brief Activate or deactivate explicitly the context
/// ///

View File

@ -29,7 +29,6 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/Export.hpp> #include <SFML/Window/Export.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/Vector2.hpp> #include <SFML/System/Vector2.hpp>
namespace sf namespace sf
@ -43,7 +42,7 @@ namespace priv
/// \brief Cursor defines the appearance of a system cursor /// \brief Cursor defines the appearance of a system cursor
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_WINDOW_API Cursor : NonCopyable class SFML_WINDOW_API Cursor
{ {
public: public:
@ -130,6 +129,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~Cursor(); ~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 /// \brief Create a cursor with the provided image
/// ///

View File

@ -29,7 +29,6 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/Export.hpp> #include <SFML/Window/Export.hpp>
#include <SFML/System/NonCopyable.hpp>
namespace sf namespace sf
@ -76,7 +75,7 @@ protected:
/// \brief RAII helper class to temporarily lock an available context for use /// \brief RAII helper class to temporarily lock an available context for use
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_WINDOW_API TransientContextLock : NonCopyable class SFML_WINDOW_API TransientContextLock
{ {
public: public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -90,6 +89,18 @@ protected:
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~TransientContextLock(); ~TransientContextLock();
////////////////////////////////////////////////////////////
/// \brief Deleted copy constructor
///
////////////////////////////////////////////////////////////
TransientContextLock(const TransientContextLock&) = delete;
////////////////////////////////////////////////////////////
/// \brief Deleted copy assignment
///
////////////////////////////////////////////////////////////
TransientContextLock& operator=(const TransientContextLock&) = delete;
}; };
}; };

View File

@ -35,7 +35,6 @@
#include <SFML/Window/WindowHandle.hpp> #include <SFML/Window/WindowHandle.hpp>
#include <SFML/Window/WindowStyle.hpp> #include <SFML/Window/WindowStyle.hpp>
#include <SFML/System/Clock.hpp> #include <SFML/System/Clock.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/String.hpp> #include <SFML/System/String.hpp>
#include <SFML/System/Vector2.hpp> #include <SFML/System/Vector2.hpp>
@ -53,7 +52,7 @@ class Event;
/// \brief Window that serves as a base for other windows /// \brief Window that serves as a base for other windows
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SFML_WINDOW_API WindowBase : NonCopyable class SFML_WINDOW_API WindowBase
{ {
public: public:
@ -98,6 +97,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual ~WindowBase(); 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 /// \brief Create (or recreate) the window
/// ///

View File

@ -28,7 +28,7 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/System/NonCopyable.hpp> #include <SFML/Config.hpp>
#include <SFML/System/Vector2.hpp> #include <SFML/System/Vector2.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
@ -44,7 +44,7 @@ namespace priv
/// \brief Load/save image files /// \brief Load/save image files
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class ImageLoader : NonCopyable class ImageLoader
{ {
public: public:
@ -131,6 +131,18 @@ private:
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~ImageLoader(); ~ImageLoader();
////////////////////////////////////////////////////////////
/// \brief Deleted copy constructor
///
////////////////////////////////////////////////////////////
ImageLoader(const ImageLoader&) = delete;
////////////////////////////////////////////////////////////
/// \brief Deleted copy assignment
///
////////////////////////////////////////////////////////////
ImageLoader& operator=(const ImageLoader&) = delete;
}; };
} // namespace priv } // namespace priv

View File

@ -28,7 +28,6 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/System/NonCopyable.hpp>
namespace sf namespace sf
@ -42,16 +41,34 @@ namespace priv
/// \brief Abstract base class for render-texture implementations /// \brief Abstract base class for render-texture implementations
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class RenderTextureImpl : NonCopyable class RenderTextureImpl
{ {
public: public:
////////////////////////////////////////////////////////////
/// \brief Default constructor
///
////////////////////////////////////////////////////////////
RenderTextureImpl() = default;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Destructor /// \brief Destructor
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual ~RenderTextureImpl(); 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 /// \brief Create the render texture implementation
/// ///

View File

@ -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 /// \brief Constructor: set up state before uniform is set
@ -211,6 +211,18 @@ struct Shader::UniformBinder : private NonCopyable
glCheck(GLEXT_glUseProgramObject(savedProgram)); 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 TransientContextLock lock; //!< Lock to keep context active while uniform is bound
GLEXT_GLhandle savedProgram; //!< Handle to the previously active program object GLEXT_GLhandle savedProgram; //!< Handle to the previously active program object
GLEXT_GLhandle currentProgram; //!< Handle to the program object of the modified sf::Shader instance GLEXT_GLhandle currentProgram; //!< Handle to the program object of the modified sf::Shader instance

View File

@ -39,13 +39,25 @@
namespace sf namespace sf
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class Ftp::DataChannel : NonCopyable class Ftp::DataChannel
{ {
public: public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
DataChannel(Ftp& owner); 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); Ftp::Response open(Ftp::TransferMode mode);

View File

@ -11,7 +11,6 @@ set(SRC
${INCROOT}/Export.hpp ${INCROOT}/Export.hpp
${INCROOT}/InputStream.hpp ${INCROOT}/InputStream.hpp
${INCROOT}/NativeActivity.hpp ${INCROOT}/NativeActivity.hpp
${INCROOT}/NonCopyable.hpp
${SRCROOT}/Sleep.cpp ${SRCROOT}/Sleep.cpp
${INCROOT}/Sleep.hpp ${INCROOT}/Sleep.hpp
${SRCROOT}/String.cpp ${SRCROOT}/String.cpp

View File

@ -29,7 +29,6 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/Cursor.hpp> #include <SFML/Window/Cursor.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/Vector2.hpp> #include <SFML/System/Vector2.hpp>
@ -44,7 +43,7 @@ namespace priv
/// This is a typical "not supported" implementation. /// This is a typical "not supported" implementation.
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class CursorImpl : NonCopyable class CursorImpl
{ {
public: public:
@ -64,6 +63,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~CursorImpl(); ~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 /// \brief Create a cursor with the provided image
/// ///

View File

@ -180,7 +180,7 @@ namespace
// This structure contains all the state necessary to // This structure contains all the state necessary to
// track TransientContext usage // track TransientContext usage
struct TransientContext : private sf::NonCopyable struct TransientContext
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Constructor /// \brief Constructor
@ -217,6 +217,18 @@ namespace
delete context; delete context;
} }
////////////////////////////////////////////////////////////
/// \brief Deleted copy constructor
///
////////////////////////////////////////////////////////////
TransientContext(const TransientContext&) = delete;
////////////////////////////////////////////////////////////
/// \brief Deleted copy assignment
///
////////////////////////////////////////////////////////////
TransientContext& operator=(const TransientContext&) = delete;
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Member data // Member data
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -32,7 +32,6 @@
#include <SFML/Window/Context.hpp> #include <SFML/Window/Context.hpp>
#include <SFML/Window/ContextSettings.hpp> #include <SFML/Window/ContextSettings.hpp>
#include <SFML/Window/GlResource.hpp> #include <SFML/Window/GlResource.hpp>
#include <SFML/System/NonCopyable.hpp>
namespace sf namespace sf
@ -45,7 +44,7 @@ class WindowImpl;
/// \brief Abstract class representing an OpenGL context /// \brief Abstract class representing an OpenGL context
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class GlContext : NonCopyable class GlContext
{ {
public: public:
@ -182,6 +181,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual ~GlContext(); 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 /// \brief Get the settings of the context
/// ///

View File

@ -30,7 +30,6 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/Joystick.hpp> #include <SFML/Window/Joystick.hpp>
#include <SFML/Window/JoystickImpl.hpp> #include <SFML/Window/JoystickImpl.hpp>
#include <SFML/System/NonCopyable.hpp>
namespace sf namespace sf
@ -41,7 +40,7 @@ namespace priv
/// \brief Global joystick manager /// \brief Global joystick manager
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class JoystickManager : NonCopyable class JoystickManager
{ {
public: public:
@ -103,6 +102,18 @@ private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~JoystickManager(); ~JoystickManager();
////////////////////////////////////////////////////////////
/// \brief Deleted copy constructor
///
////////////////////////////////////////////////////////////
JoystickManager(const JoystickManager&) = delete;
////////////////////////////////////////////////////////////
/// \brief Deleted copy assignment
///
////////////////////////////////////////////////////////////
JoystickManager& operator=(const JoystickManager&) = delete;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Joystick information and state /// \brief Joystick information and state
/// ///

View File

@ -30,7 +30,6 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/Cursor.hpp> #include <SFML/Window/Cursor.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/Vector2.hpp> #include <SFML/System/Vector2.hpp>
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -56,7 +55,7 @@ namespace priv
/// \brief Mac OS X implementation of Cursor /// \brief Mac OS X implementation of Cursor
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class CursorImpl : NonCopyable class CursorImpl
{ {
public: public:
@ -76,6 +75,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~CursorImpl(); ~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 /// \brief Create a cursor with the provided image
/// ///

View File

@ -31,7 +31,6 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/JoystickImpl.hpp> #include <SFML/Window/JoystickImpl.hpp>
#include <SFML/Window/Keyboard.hpp> #include <SFML/Window/Keyboard.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#include <IOKit/hid/IOHIDDevice.h> #include <IOKit/hid/IOHIDDevice.h>
#include <IOKit/hid/IOHIDManager.h> #include <IOKit/hid/IOHIDManager.h>
@ -51,7 +50,7 @@ using IOHIDElements = std::vector<IOHIDElementRef>;
/// Its purpose is to help sf::priv::InputImpl class. /// Its purpose is to help sf::priv::InputImpl class.
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class HIDInputManager : NonCopyable class HIDInputManager
{ {
public: public:
@ -133,6 +132,18 @@ private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~HIDInputManager(); ~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 /// \brief Initialize the keyboard part of this class
/// ///

View File

@ -29,7 +29,6 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/System/NonCopyable.hpp>
#include <IOKit/hid/IOHIDDevice.h> #include <IOKit/hid/IOHIDDevice.h>
#include <IOKit/hid/IOHIDManager.h> #include <IOKit/hid/IOHIDManager.h>
@ -44,7 +43,7 @@ namespace priv
/// It's only purpose is to help sf::priv::JoystickImpl class. /// It's only purpose is to help sf::priv::JoystickImpl class.
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class HIDJoystickManager : NonCopyable class HIDJoystickManager
{ {
public: public:
@ -88,6 +87,18 @@ private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~HIDJoystickManager(); ~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 /// \brief Make sure all event have been processed in the run loop
/// ///

View File

@ -30,7 +30,6 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/Sensor.hpp> #include <SFML/Window/Sensor.hpp>
#include <SFML/Window/SensorImpl.hpp> #include <SFML/Window/SensorImpl.hpp>
#include <SFML/System/NonCopyable.hpp>
namespace sf namespace sf
@ -41,7 +40,7 @@ namespace priv
/// \brief Global sensor manager /// \brief Global sensor manager
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class SensorManager : NonCopyable class SensorManager
{ {
public: public:
@ -112,6 +111,18 @@ private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~SensorManager(); ~SensorManager();
////////////////////////////////////////////////////////////
/// \brief Deleted copy constructor
///
////////////////////////////////////////////////////////////
SensorManager(const SensorManager&) = delete;
////////////////////////////////////////////////////////////
/// \brief Deleted copy assignment
///
////////////////////////////////////////////////////////////
SensorManager& operator=(const SensorManager&) = delete;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Sensor information and state /// \brief Sensor information and state
/// ///

View File

@ -29,7 +29,6 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/Cursor.hpp> #include <SFML/Window/Cursor.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/Vector2.hpp> #include <SFML/System/Vector2.hpp>
#include <SFML/Window/WindowStyle.hpp> // Prevent conflict with macro None from Xlib #include <SFML/Window/WindowStyle.hpp> // Prevent conflict with macro None from Xlib
#include <X11/Xlib.h> #include <X11/Xlib.h>
@ -43,7 +42,7 @@ namespace priv
/// \brief Unix implementation of Cursor /// \brief Unix implementation of Cursor
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class CursorImpl : NonCopyable class CursorImpl
{ {
public: public:
@ -63,6 +62,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~CursorImpl(); ~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 /// \brief Create a cursor with the provided image
/// ///

View File

@ -29,7 +29,6 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/Cursor.hpp> #include <SFML/Window/Cursor.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/Vector2.hpp> #include <SFML/System/Vector2.hpp>
namespace sf namespace sf
@ -41,7 +40,7 @@ namespace priv
/// \brief Win32 implementation of Cursor /// \brief Win32 implementation of Cursor
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class CursorImpl : NonCopyable class CursorImpl
{ {
public: public:
@ -61,6 +60,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~CursorImpl(); ~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 /// \brief Create a cursor with the provided image
/// ///

View File

@ -29,7 +29,6 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Config.hpp> #include <SFML/Config.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/String.hpp> #include <SFML/System/String.hpp>
#include <SFML/Window/ContextSettings.hpp> #include <SFML/Window/ContextSettings.hpp>
#include <SFML/Window/CursorImpl.hpp> #include <SFML/Window/CursorImpl.hpp>
@ -53,7 +52,7 @@ namespace priv
/// \brief Abstract base class for OS-specific window implementation /// \brief Abstract base class for OS-specific window implementation
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class WindowImpl : NonCopyable class WindowImpl
{ {
public: public:
@ -88,6 +87,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual ~WindowImpl(); 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 /// \brief Change the joystick threshold, i.e. the value below which
/// no move event will be generated /// no move event will be generated

View File

@ -29,7 +29,6 @@
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/Cursor.hpp> #include <SFML/Window/Cursor.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/Vector2.hpp> #include <SFML/System/Vector2.hpp>
@ -44,7 +43,7 @@ namespace priv
/// This is a typical "not supported" implementation. /// This is a typical "not supported" implementation.
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class CursorImpl : NonCopyable class CursorImpl
{ {
public: public:
@ -64,6 +63,18 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
~CursorImpl(); ~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 /// \brief Create a cursor with the provided image
/// ///