Update copy/move constructors/operators

Former-commit-id: b1faeeae9211a6c0ca29261d46929dc8c66ea0c4
This commit is contained in:
Lynix 2015-09-24 12:51:52 +02:00
parent dea3fb4e39
commit c214251ecf
24 changed files with 89 additions and 19 deletions

View File

@ -18,6 +18,7 @@ class NAZARA_AUDIO_API NzSound : public NzSoundEmitter
NzSound() = default;
NzSound(const NzSoundBuffer* soundBuffer);
NzSound(const NzSound& sound);
NzSound(NzSound&&) = default;
~NzSound();
void EnableLooping(bool loop);
@ -43,6 +44,9 @@ class NAZARA_AUDIO_API NzSound : public NzSoundEmitter
void Stop();
NzSound& operator=(const NzSound&) = delete; ///TODO?
NzSound& operator=(NzSound&&) = default;
private:
NzSoundBufferConstRef m_buffer;
};

View File

@ -20,6 +20,8 @@ class NAZARA_CORE_API NzClock
public:
NzClock(nzUInt64 startingValue = 0, bool paused = false);
NzClock(const NzClock& clock) = default;
NzClock(NzClock&& clock) = default;
~NzClock() = default;
float GetSeconds() const;
nzUInt64 GetMicroseconds() const;
@ -32,6 +34,7 @@ class NAZARA_CORE_API NzClock
void Unpause();
NzClock& operator=(const NzClock& clock) = default;
NzClock& operator=(NzClock&& clock) = default;
private:
NazaraMutexAttrib(m_mutex, mutable)

View File

@ -14,6 +14,9 @@
class NAZARA_CORE_API NzHardwareInfo
{
public:
NzHardwareInfo() = delete;
~NzHardwareInfo() = delete;
static void Cpuid(nzUInt32 functionId, nzUInt32 subFunctionId, nzUInt32 result[4]);
static NzString GetProcessorBrandString();

View File

@ -19,11 +19,16 @@ class NAZARA_CORE_API NzHashable
public:
NzHashable() = default;
NzHashable(const NzHashable&) = default;
NzHashable(NzHashable&&) = default;
virtual ~NzHashable();
NzHashDigest GetHash(nzHash hash) const;
NzHashDigest GetHash(NzAbstractHash* impl) const;
NzHashable& operator=(const NzHashable&) = default;
NzHashable& operator=(NzHashable&&) = default;
private:
virtual bool FillHash(NzAbstractHash* impl) const = 0;
};

View File

@ -14,6 +14,8 @@ class NzInitializer
{
public:
NzInitializer(bool initialize = true);
NzInitializer(const NzInitializer&) = delete;
NzInitializer(NzInitializer&&) = delete; ///TODO
~NzInitializer();
bool Initialize();
@ -22,6 +24,9 @@ class NzInitializer
operator bool() const;
NzInitializer& operator=(const NzInitializer&) = delete;
NzInitializer& operator=(NzInitializer&&) = delete; ///TODO
private:
bool m_initialized;
};

View File

@ -14,6 +14,8 @@ class NAZARA_CORE_API NzMemoryStream : public NzInputStream
{
public:
NzMemoryStream(const void* ptr, nzUInt64 size);
NzMemoryStream(const NzMemoryStream&) = delete;
NzMemoryStream(NzMemoryStream&&) = delete; ///TODO
~NzMemoryStream();
bool EndOfStream() const;
@ -25,6 +27,9 @@ class NAZARA_CORE_API NzMemoryStream : public NzInputStream
bool SetCursorPos(nzUInt64 offset);
NzMemoryStream& operator=(const NzMemoryStream&) = delete;
NzMemoryStream& operator=(NzMemoryStream&&) = delete; ///TODO
private:
const nzUInt8* m_ptr;
nzUInt64 m_pos;

View File

@ -19,7 +19,7 @@ class NAZARA_CORE_API NzParameterList
NzParameterList() = default;
NzParameterList(const NzParameterList& list);
NzParameterList(NzParameterList&& list);
NzParameterList(NzParameterList&&) = default;
~NzParameterList();
void Clear();
@ -46,7 +46,7 @@ class NAZARA_CORE_API NzParameterList
void SetParameter(const NzString& name, int value);
NzParameterList& operator=(const NzParameterList& list);
NzParameterList& operator=(NzParameterList&& list);
NzParameterList& operator=(NzParameterList&&) = default;
private:
struct Parameter

View File

@ -15,6 +15,8 @@ class NAZARA_CORE_API NzPrimitiveList
{
public:
NzPrimitiveList() = default;
NzPrimitiveList(const NzPrimitiveList&) = default;
NzPrimitiveList(NzPrimitiveList&&) = default;
~NzPrimitiveList() = default;
void AddBox(const NzVector3f& lengths, const NzVector3ui& subdivision = NzVector3ui(0U), const NzMatrix4f& transformMatrix = NzMatrix4f::Identity());
@ -35,6 +37,9 @@ class NAZARA_CORE_API NzPrimitiveList
const NzPrimitive& GetPrimitive(unsigned int i) const;
unsigned int GetSize() const;
NzPrimitiveList& operator=(const NzPrimitiveList&) = default;
NzPrimitiveList& operator=(NzPrimitiveList&&) = default;
NzPrimitive& operator()(unsigned int i);
const NzPrimitive& operator()(unsigned int i) const;

View File

@ -45,6 +45,8 @@ class NzSparsePtr
T* operator->() const;
T& operator[](int index) const;
NzSparsePtr& operator=(const NzSparsePtr& ptr) = default;
NzSparsePtr operator+(int count) const;
NzSparsePtr operator+(unsigned int count) const;
NzSparsePtr operator-(int count) const;
@ -67,8 +69,6 @@ class NzSparsePtr
bool operator<=(const NzSparsePtr& ptr) const;
bool operator>=(const NzSparsePtr& ptr) const;
NzSparsePtr& operator=(const NzSparsePtr& ptr) = default;
private:
BytePtr m_ptr;
int m_stride;

View File

@ -15,6 +15,8 @@ class NAZARA_CORE_API NzStream
{
public:
NzStream() = default;
NzStream(const NzStream&) = default;
NzStream(NzStream&&) = default;
virtual ~NzStream();
virtual nzUInt64 GetCursorPos() const = 0;
@ -25,6 +27,9 @@ class NAZARA_CORE_API NzStream
virtual bool SetCursorPos(nzUInt64 offset) = 0;
void SetStreamOptions(unsigned int options);
NzStream& operator=(const NzStream&) = default;
NzStream& operator=(NzStream&&) = default;
protected:
unsigned int m_streamOptions = 0;
};

View File

@ -17,9 +17,14 @@ class NAZARA_CORE_API NzStringStream
public:
NzStringStream();
NzStringStream(const NzString& str);
NzStringStream(const NzStringStream&) = default;
NzStringStream(NzStringStream&&) noexcept = default;
NzString ToString() const;
NzStringStream& operator=(const NzStringStream&) = default;
NzStringStream& operator=(NzStringStream&&) noexcept = default;
NzStringStream& operator<<(bool boolean);
NzStringStream& operator<<(short number);
NzStringStream& operator<<(unsigned short number);

View File

@ -23,7 +23,7 @@ class NAZARA_CORE_API NzThread
template<typename F, typename... Args> NzThread(F function, Args&&... args);
template<typename C> NzThread(void (C::*function)(), C* object);
NzThread(const NzThread&) = delete;
NzThread(NzThread&& other);
NzThread(NzThread&& other) noexcept;
~NzThread();
void Detach();

View File

@ -24,12 +24,17 @@ class NAZARA_GRAPHICS_API NzAbstractBackground : public NzRefCounted
{
public:
NzAbstractBackground() = default;
NzAbstractBackground(const NzAbstractBackground&) = default;
NzAbstractBackground(NzAbstractBackground&&) = delete;
virtual ~NzAbstractBackground();
virtual void Draw(const NzAbstractViewer* viewer) const = 0;
virtual nzBackgroundType GetBackgroundType() const = 0;
NzAbstractBackground& operator=(const NzAbstractBackground&) = default;
NzAbstractBackground& operator=(NzAbstractBackground&&) = delete;
private:
static NzBackgroundLibrary::LibraryMap s_library;
};

View File

@ -21,6 +21,8 @@ class NAZARA_GRAPHICS_API NzAbstractViewer
{
public:
NzAbstractViewer() = default;
NzAbstractViewer(const NzAbstractViewer&) = default;
NzAbstractViewer(NzAbstractViewer&&) noexcept = default;
virtual ~NzAbstractViewer();
virtual void ApplyView() const = 0;
@ -35,6 +37,9 @@ class NAZARA_GRAPHICS_API NzAbstractViewer
virtual const NzRecti& GetViewport() const = 0;
virtual float GetZFar() const = 0;
virtual float GetZNear() const = 0;
NzAbstractViewer& operator=(const NzAbstractViewer&) = default;
NzAbstractViewer& operator=(NzAbstractViewer&&) noexcept = default;
};
#endif // NAZARA_ABSTRACTVIEWER_HPP

View File

@ -24,6 +24,7 @@ class NAZARA_GRAPHICS_API NzBillboard : public NzInstancedRenderable
inline NzBillboard(NzMaterialRef material);
inline NzBillboard(NzTexture* texture);
inline NzBillboard(const NzBillboard& billboard);
NzBillboard(NzBillboard&&) = delete;
~NzBillboard() = default;
void AddToRenderQueue(NzAbstractRenderQueue* renderQueue, const InstanceData& instanceData) const override;
@ -42,6 +43,7 @@ class NAZARA_GRAPHICS_API NzBillboard : public NzInstancedRenderable
inline void SetTexture(NzTextureRef texture, bool resizeBillboard = true);
inline NzBillboard& operator=(const NzBillboard& billboard);
NzBillboard& operator=(NzBillboard&&) = delete;
template<typename... Args> static NzBillboardRef New(Args&&... args);

View File

@ -21,6 +21,8 @@ class NAZARA_GRAPHICS_API NzColorBackground : public NzAbstractBackground
{
public:
NzColorBackground(const NzColor& color = NzColor::Black);
NzColorBackground(const NzColorBackground&) = default;
NzColorBackground(NzColorBackground&&) = delete;
void Draw(const NzAbstractViewer* viewer) const;
@ -29,6 +31,8 @@ class NAZARA_GRAPHICS_API NzColorBackground : public NzAbstractBackground
void SetColor(const NzColor& color);
NzColorBackground& operator=(NzColorBackground&&) = delete;
template<typename... Args> static NzColorBackgroundRef New(Args&&... args);
private:

View File

@ -32,6 +32,8 @@ class NAZARA_RENDERER_API NzContext : public NzRefCounted
public:
NzContext() = default;
NzContext(const NzContext&) = delete;
NzContext(NzContext&&) = delete;
~NzContext();
bool Create(const NzContextParameters& parameters = NzContextParameters());
@ -47,6 +49,9 @@ class NAZARA_RENDERER_API NzContext : public NzRefCounted
bool SetActive(bool active) const;
void SwapBuffers();
NzContext& operator=(const NzContext&) = delete;
NzContext& operator=(NzContext&&) = delete;
static bool EnsureContext();
static const NzContext* GetCurrent();

View File

@ -21,6 +21,8 @@ class NAZARA_RENDERER_API NzRenderTarget
public:
NzRenderTarget() = default;
NzRenderTarget(const NzRenderTarget&) = delete;
NzRenderTarget(NzRenderTarget&&) = delete; ///TOOD?
virtual ~NzRenderTarget();
virtual unsigned int GetHeight() const = 0;
@ -35,6 +37,9 @@ class NAZARA_RENDERER_API NzRenderTarget
// Fonctions OpenGL
virtual bool HasContext() const = 0;
NzRenderTarget& operator=(const NzRenderTarget&) = delete;
NzRenderTarget& operator=(NzRenderTarget&&) = delete; ///TOOD?
// Signals:
NazaraSignal(OnRenderTargetParametersChange, const NzRenderTarget* /*renderTarget*/);
NazaraSignal(OnRenderTargetRelease, const NzRenderTarget* /*renderTarget*/);

View File

@ -27,7 +27,7 @@ class NAZARA_RENDERER_API NzRenderTexture : public NzRenderTarget
public:
inline NzRenderTexture();
NzRenderTexture(const NzRenderTexture&) = delete;
NzRenderTexture(NzRenderTexture&&) = delete; ///TODO
NzRenderTexture(NzRenderTexture&&) = delete; ///TODO?
inline ~NzRenderTexture();
bool AttachBuffer(nzAttachmentPoint attachmentPoint, nzUInt8 index, NzRenderBuffer* buffer);
@ -61,7 +61,7 @@ class NAZARA_RENDERER_API NzRenderTexture : public NzRenderTarget
bool HasContext() const override;
NzRenderTexture& operator=(const NzRenderTexture&) = delete;
NzRenderTexture& operator=(NzRenderTexture&&) = delete; ///TODO
NzRenderTexture& operator=(NzRenderTexture&&) = delete; ///TODO?
static inline void Blit(NzRenderTexture* src, NzRenderTexture* dst, nzUInt32 buffers = nzRendererBuffer_Color | nzRendererBuffer_Depth | nzRendererBuffer_Stencil, bool bilinearFilter = false);
static void Blit(NzRenderTexture* src, NzRectui srcRect, NzRenderTexture* dst, NzRectui dstRect, nzUInt32 buffers = nzRendererBuffer_Color | nzRendererBuffer_Depth | nzRendererBuffer_Stencil, bool bilinearFilter = false);

View File

@ -30,6 +30,8 @@ class NAZARA_RENDERER_API NzRenderWindow : public NzRenderTarget, public NzWindo
NzRenderWindow() = default;
NzRenderWindow(NzVideoMode mode, const NzString& title, nzUInt32 style = nzWindowStyle_Default, const NzContextParameters& parameters = NzContextParameters());
NzRenderWindow(NzWindowHandle handle, const NzContextParameters& parameters = NzContextParameters());
NzRenderWindow(const NzRenderWindow&) = delete;
NzRenderWindow(NzRenderWindow&&) = delete; ///TODO
virtual ~NzRenderWindow();
bool CopyToImage(NzAbstractImage* image, const NzVector3ui& dstPos = NzVector3ui(0U)) const;
@ -55,6 +57,9 @@ class NAZARA_RENDERER_API NzRenderWindow : public NzRenderTarget, public NzWindo
NzContextParameters GetContextParameters() const;
bool HasContext() const override;
NzRenderWindow& operator=(const NzRenderWindow&) = delete;
NzRenderWindow& operator=(NzRenderWindow&&) = delete; ///TODO
protected:
bool Activate() const override;
void EnsureTargetUpdated() const override;

View File

@ -28,10 +28,15 @@ class NAZARA_RENDERER_API NzUberShader : public NzRefCounted
public:
NzUberShader() = default;
NzUberShader(const NzUberShader&) = delete;
NzUberShader(NzUberShader&&) = delete;
virtual ~NzUberShader();
virtual NzUberShaderInstance* Get(const NzParameterList& parameters) const = 0;
NzUberShader& operator=(const NzUberShader&) = delete;
NzUberShader& operator=(NzUberShader&&) = delete;
// Signals:
NazaraSignal(OnUberShaderRelease, const NzUberShader* /*uberShader*/);

View File

@ -14,12 +14,17 @@ class NAZARA_RENDERER_API NzUberShaderInstance
{
public:
NzUberShaderInstance(const NzShader* shader);
NzUberShaderInstance(const NzUberShaderInstance&) = delete;
NzUberShaderInstance(NzUberShaderInstance&&) = delete;
virtual ~NzUberShaderInstance();
virtual bool Activate() const = 0;
const NzShader* GetShader() const;
NzUberShaderInstance& operator=(const NzUberShaderInstance&) = delete;
NzUberShaderInstance& operator=(NzUberShaderInstance&&) = delete;
protected:
NzShaderConstRef m_shader;
};

View File

@ -15,11 +15,6 @@ NzParameterList::NzParameterList(const NzParameterList& list)
operator=(list);
}
NzParameterList::NzParameterList(NzParameterList&& list) :
m_parameters(std::move(list.m_parameters))
{
}
NzParameterList::~NzParameterList()
{
Clear();
@ -421,12 +416,6 @@ NzParameterList& NzParameterList::operator=(const NzParameterList& list)
return *this;
}
NzParameterList& NzParameterList::operator=(NzParameterList&& list)
{
m_parameters = std::move(list.m_parameters);
return *this;
}
void NzParameterList::DestroyValue(Parameter& parameter)
{
switch (parameter.type)

View File

@ -24,7 +24,7 @@ m_impl(nullptr)
{
}
NzThread::NzThread(NzThread&& other) :
NzThread::NzThread(NzThread&& other) noexcept :
m_impl(other.m_impl)
{
other.m_impl = nullptr;