Core: Remove NonCopyable

Former-commit-id: f8c6d10ad0b1abb4a32e3c867b7f24fd4bde68a4
This commit is contained in:
Lynix
2015-09-24 00:37:21 +02:00
parent b16abf0d09
commit 2fd3872099
39 changed files with 205 additions and 112 deletions

View File

@@ -8,19 +8,23 @@
#define NAZARA_ABSTRACTHASH_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/NonCopyable.hpp>
class NzHashDigest;
class NAZARA_CORE_API NzAbstractHash : NzNonCopyable
class NAZARA_CORE_API NzAbstractHash
{
public:
NzAbstractHash() = default;
NzAbstractHash(const NzAbstractHash&) = delete;
NzAbstractHash(NzAbstractHash&&) = default;
virtual ~NzAbstractHash();
virtual void Append(const nzUInt8* data, unsigned int len) = 0;
virtual void Begin() = 0;
virtual NzHashDigest End() = 0;
NzAbstractHash& operator=(const NzAbstractHash&) = delete;
NzAbstractHash& operator=(NzAbstractHash&&) = default;
};
#endif // NAZARA_ABSTRACTHASH_HPP

View File

@@ -8,20 +8,24 @@
#define NAZARA_CALLONEXIT_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/NonCopyable.hpp>
#include <functional>
class NzCallOnExit : NzNonCopyable
class NzCallOnExit
{
using Func = std::function<void()>;
public:
NzCallOnExit(Func func = nullptr);
NzCallOnExit(const NzCallOnExit&) = delete;
NzCallOnExit(NzCallOnExit&&) = delete;
~NzCallOnExit();
void CallAndReset(Func func = nullptr);
void Reset(Func func = nullptr);
NzCallOnExit& operator=(const NzCallOnExit&) = delete;
NzCallOnExit& operator=(NzCallOnExit&&) = default;
private:
Func m_func;
};

View File

@@ -8,15 +8,16 @@
#define NAZARA_CONDITIONVARIABLE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/NonCopyable.hpp>
class NzConditionVariableImpl;
class NzMutex;
class NAZARA_CORE_API NzConditionVariable : NzNonCopyable
class NAZARA_CORE_API NzConditionVariable
{
public:
NzConditionVariable();
NzConditionVariable(const NzConditionVariable&) = delete;
NzConditionVariable(NzConditionVariable&&) = delete; ///TODO
~NzConditionVariable();
void Signal();
@@ -25,6 +26,9 @@ class NAZARA_CORE_API NzConditionVariable : NzNonCopyable
void Wait(NzMutex* mutex);
bool Wait(NzMutex* mutex, nzUInt32 timeout);
NzConditionVariable& operator=(const NzConditionVariable&) = delete;
NzConditionVariable& operator=(NzConditionVariable&&) = delete; ///TODO
private:
NzConditionVariableImpl* m_impl;
};

View File

@@ -8,7 +8,6 @@
#define NAZARA_DIRECTORY_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/NonCopyable.hpp>
#include <Nazara/Core/String.hpp>
#if defined(NAZARA_PLATFORM_WINDOWS)
@@ -28,11 +27,13 @@
class NzDirectoryImpl;
class NAZARA_CORE_API NzDirectory : NzNonCopyable
class NAZARA_CORE_API NzDirectory
{
public:
NzDirectory();
NzDirectory(const NzString& dirPath);
NzDirectory(const NzString& dirPath);
NzDirectory(const NzDirectory&) = delete;
NzDirectory(NzDirectory&&) = delete; ///TODO
~NzDirectory();
void Close();
@@ -63,6 +64,9 @@ class NAZARA_CORE_API NzDirectory : NzNonCopyable
static bool Remove(const NzString& dirPath, bool emptyDirectory = false);
static bool SetCurrent(const NzString& dirPath);
NzDirectory& operator=(const NzDirectory&) = delete;
NzDirectory& operator=(NzDirectory&&) = delete; ///TODO
private:
NazaraMutexAttrib(m_mutex, mutable)

View File

@@ -8,7 +8,6 @@
#define NAZARA_DYNLIB_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/NonCopyable.hpp>
#include <Nazara/Core/String.hpp>
#if defined(NAZARA_PLATFORM_WINDOWS)
@@ -31,11 +30,12 @@ using NzDynLibFunc = int (*)(); // Type "générique" de pointeur sur fonction
class NzDynLibImpl;
class NAZARA_CORE_API NzDynLib : NzNonCopyable
class NAZARA_CORE_API NzDynLib
{
public:
NzDynLib();
NzDynLib(NzDynLib&& lib);
NzDynLib(const NzDynLib&) = delete;
NzDynLib(NzDynLib&& lib);
~NzDynLib();
NzString GetLastError() const;
@@ -46,7 +46,8 @@ class NAZARA_CORE_API NzDynLib : NzNonCopyable
bool Load(const NzString& libraryPath);
void Unload();
NzDynLib& operator=(NzDynLib&& lib);
NzDynLib& operator=(const NzDynLib&) = delete;
NzDynLib& operator=(NzDynLib&& lib);
private:
NazaraMutexAttrib(m_mutex, mutable)

View File

@@ -9,18 +9,22 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Enums.hpp>
#include <Nazara/Core/NonCopyable.hpp>
class NAZARA_CORE_API NzErrorFlags : NzNonCopyable
class NAZARA_CORE_API NzErrorFlags
{
public:
NzErrorFlags(nzUInt32 flags, bool replace = false);
NzErrorFlags(const NzErrorFlags&) = delete;
NzErrorFlags(NzErrorFlags&&) = delete;
~NzErrorFlags();
nzUInt32 GetPreviousFlags() const;
void SetFlags(nzUInt32 flags, bool replace = false);
NzErrorFlags& operator=(const NzErrorFlags&) = delete;
NzErrorFlags& operator=(NzErrorFlags&&) = delete;
private:
nzUInt32 m_previousFlags;
};

View File

@@ -14,7 +14,6 @@
#include <Nazara/Core/Hashable.hpp>
#include <Nazara/Core/HashDigest.hpp>
#include <Nazara/Core/InputStream.hpp>
#include <Nazara/Core/NonCopyable.hpp>
#include <Nazara/Core/String.hpp>
#if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_FILE
@@ -27,13 +26,14 @@
class NzFileImpl;
class NAZARA_CORE_API NzFile : public NzHashable, public NzInputStream, NzNonCopyable
class NAZARA_CORE_API NzFile : public NzHashable, public NzInputStream
{
public:
NzFile();
NzFile(const NzString& filePath);
NzFile(const NzString& filePath, unsigned int openMode);
NzFile(NzFile&& file) noexcept;
NzFile(const NzFile&) = delete;
NzFile(NzFile&& file) noexcept;
~NzFile();
bool Copy(const NzString& newFilePath);
@@ -76,7 +76,8 @@ class NAZARA_CORE_API NzFile : public NzHashable, public NzInputStream, NzNonCop
bool Write(const NzString& string);
std::size_t Write(const void* buffer, std::size_t typeSize, unsigned int count);
NzFile& operator=(const NzString& filePath);
NzFile& operator=(const NzString& filePath);
NzFile& operator=(const NzFile&) = delete;
NzFile& operator=(NzFile&& file) noexcept;
static NzString AbsolutePath(const NzString& filePath);

View File

@@ -11,17 +11,21 @@
#include <Nazara/Core/AbstractHash.hpp>
#include <Nazara/Core/Hashable.hpp>
#include <Nazara/Core/HashDigest.hpp>
#include <Nazara/Core/NonCopyable.hpp>
class NAZARA_CORE_API NzHash : NzNonCopyable
class NAZARA_CORE_API NzHash
{
public:
NzHash(nzHash hash);
NzHash(NzAbstractHash* hashImpl);
NzHash(const NzHash&) = delete;
NzHash(NzHash&&) = delete; ///TODO
~NzHash();
NzHashDigest Hash(const NzHashable& hashable);
NzHash& operator=(const NzHash&) = delete;
NzHash& operator=(NzHash&&) = delete; ///TODO
private:
NzAbstractHash* m_impl;
};

View File

@@ -9,7 +9,6 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/NonCopyable.hpp>
#include <Nazara/Core/String.hpp>
#if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_LOG
@@ -29,7 +28,7 @@
class NzFile;
class NAZARA_CORE_API NzLog : NzNonCopyable
class NAZARA_CORE_API NzLog
{
public:
void Enable(bool enable);
@@ -50,8 +49,13 @@ class NAZARA_CORE_API NzLog : NzNonCopyable
private:
NzLog();
NzLog(const NzLog&) = delete;
NzLog(NzLog&&) = delete;
~NzLog();
NzLog& operator=(const NzLog&) = delete;
NzLog& operator=(NzLog&&) = delete;
NazaraMutexAttrib(m_mutex, mutable)
NzString m_filePath;

View File

@@ -8,24 +8,26 @@
#define NAZARA_MUTEX_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/NonCopyable.hpp>
class NzMutexImpl;
class NAZARA_CORE_API NzMutex : NzNonCopyable
class NAZARA_CORE_API NzMutex
{
friend class NzConditionVariable;
public:
NzMutex();
NzMutex(const NzMutex&) = delete;
NzMutex(NzMutex&&) = delete; ///TODO
~NzMutex();
void Lock();
bool TryLock();
void Unlock();
NzMutex& operator=(const NzMutex&) = delete;
NzMutex& operator=(NzMutex&&) = delete; ///TODO
private:
NzMutexImpl* m_impl;
};

View File

@@ -1,20 +0,0 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_NONCOPYABLE_HPP
#define NAZARA_NONCOPYABLE_HPP
#include <Nazara/Prerequesites.hpp>
class NAZARA_CORE_API NzNonCopyable
{
protected:
NzNonCopyable() = default;
NzNonCopyable(const NzNonCopyable&) = delete;
NzNonCopyable& operator=(const NzNonCopyable&) = delete;
};
#endif // NAZARA_NONCOPYABLE_HPP

View File

@@ -8,14 +8,15 @@
#define NAZARA_SEMAPHORE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/NonCopyable.hpp>
class NzSemaphoreImpl;
class NAZARA_CORE_API NzSemaphore : NzNonCopyable
class NAZARA_CORE_API NzSemaphore
{
public:
NzSemaphore(unsigned int count);
NzSemaphore(const NzSemaphore&) = delete;
NzSemaphore(NzSemaphore&&) = delete; ///TODO
~NzSemaphore();
unsigned int GetCount() const;
@@ -25,6 +26,9 @@ class NAZARA_CORE_API NzSemaphore : NzNonCopyable
void Wait();
bool Wait(nzUInt32 timeout);
NzSemaphore& operator=(const NzSemaphore&) = delete;
NzSemaphore& operator=(NzSemaphore&&) = delete; ///TODO
private:
NzSemaphoreImpl* m_impl;
};

View File

@@ -9,12 +9,11 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Functor.hpp>
#include <Nazara/Core/NonCopyable.hpp>
#include <iosfwd>
class NzThreadImpl;
class NAZARA_CORE_API NzThread : NzNonCopyable
class NAZARA_CORE_API NzThread
{
public:
class Id;
@@ -23,7 +22,8 @@ class NAZARA_CORE_API NzThread : NzNonCopyable
template<typename F> NzThread(F function);
template<typename F, typename... Args> NzThread(F function, Args&&... args);
template<typename C> NzThread(void (C::*function)(), C* object);
NzThread(NzThread&& other);
NzThread(const NzThread&) = delete;
NzThread(NzThread&& other);
~NzThread();
void Detach();
@@ -31,7 +31,8 @@ class NAZARA_CORE_API NzThread : NzNonCopyable
bool IsJoinable() const;
void Join();
NzThread& operator=(NzThread&& thread);
NzThread& operator=(const NzThread&) = delete;
NzThread& operator=(NzThread&& thread);
static unsigned int HardwareConcurrency();
static void Sleep(nzUInt32 milliseconds);