Renamed XImpl to AbstractX (More consistent)

Where * is Buffer, Hash and Shader


Former-commit-id: a99681ab1d515c9b39e6ba5f447c9000ef1092b8
This commit is contained in:
Lynix 2013-05-21 13:54:10 +02:00
parent 4b68ff0118
commit 8f09eea340
31 changed files with 78 additions and 106 deletions

View File

@ -4,23 +4,23 @@
#pragma once
#ifndef NAZARA_HASHIMPL_HPP
#define NAZARA_HASHIMPL_HPP
#ifndef NAZARA_ABSTRACTHASH_HPP
#define NAZARA_ABSTRACTHASH_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/NonCopyable.hpp>
class NzHashDigest;
class NAZARA_API NzHashImpl : NzNonCopyable
class NAZARA_API NzAbstractHash : NzNonCopyable
{
public:
NzHashImpl() = default;
virtual ~NzHashImpl() {}
NzAbstractHash() = default;
virtual ~NzAbstractHash();
virtual void Append(const nzUInt8* data, unsigned int len) = 0;
virtual void Begin() = 0;
virtual NzHashDigest End() = 0;
};
#endif // NAZARA_HASHIMPL_HPP
#endif // NAZARA_ABSTRACTHASH_HPP

View File

@ -112,7 +112,7 @@ class NAZARA_API NzByteArray : public NzHashable
private:
void EnsureOwnership();
bool FillHash(NzHashImpl* hash) const;
bool FillHash(NzAbstractHash* hash) const;
void ReleaseArray();
SharedArray* m_sharedArray;

View File

@ -103,7 +103,7 @@ class NAZARA_API NzFile : public NzHashable, public NzInputStream, NzNonCopyable
static time_t GetLastAccessTime(const NzString& filePath);
static time_t GetLastWriteTime(const NzString& filePath);
static NzHashDigest GetHash(const NzString& filePath, nzHash hash);
static NzHashDigest GetHash(const NzString& filePath, NzHashImpl* hash);
static NzHashDigest GetHash(const NzString& filePath, NzAbstractHash* hash);
static nzUInt64 GetSize(const NzString& filePath);
static bool IsAbsolute(const NzString& filePath);
static NzString NormalizePath(const NzString& filePath);
@ -111,7 +111,7 @@ class NAZARA_API NzFile : public NzHashable, public NzInputStream, NzNonCopyable
static bool Rename(const NzString& sourcePath, const NzString& targetPath);
private:
bool FillHash(NzHashImpl* hash) const;
bool FillHash(NzAbstractHash* hash) const;
NazaraMutexAttrib(m_mutex, mutable)

View File

@ -8,22 +8,22 @@
#define NAZARA_HASH_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/AbstractHash.hpp>
#include <Nazara/Core/Hashable.hpp>
#include <Nazara/Core/HashDigest.hpp>
#include <Nazara/Core/HashImpl.hpp>
#include <Nazara/Core/NonCopyable.hpp>
class NAZARA_API NzHash : NzNonCopyable
{
public:
NzHash(nzHash hash);
NzHash(NzHashImpl* hashImpl);
NzHash(NzAbstractHash* hashImpl);
~NzHash();
NzHashDigest Hash(const NzHashable& hashable);
private:
NzHashImpl* m_impl;
NzAbstractHash* m_impl;
};
#endif // NAZARA_HASH_HPP

View File

@ -8,12 +8,12 @@
#define NAZARA_HASH_CRC32_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/AbstractHash.hpp>
#include <Nazara/Core/HashDigest.hpp>
#include <Nazara/Core/HashImpl.hpp>
struct NzHashCRC32_state;
class NAZARA_API NzHashCRC32 : public NzHashImpl
class NAZARA_API NzHashCRC32 : public NzAbstractHash
{
public:
NzHashCRC32(nzUInt32 polynomial = 0x04c11db7);

View File

@ -8,13 +8,13 @@
#define NAZARA_HASH_FLETCHER16_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/AbstractHash.hpp>
#include <Nazara/Core/HashDigest.hpp>
#include <Nazara/Core/HashImpl.hpp>
#include <Nazara/Core/String.hpp>
struct NzHashFletcher16_state;
class NAZARA_API NzHashFletcher16 : public NzHashImpl
class NAZARA_API NzHashFletcher16 : public NzAbstractHash
{
public:
NzHashFletcher16();

View File

@ -8,12 +8,12 @@
#define NAZARA_HASH_MD5_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/AbstractHash.hpp>
#include <Nazara/Core/HashDigest.hpp>
#include <Nazara/Core/HashImpl.hpp>
struct NzHashMD5_state;
class NAZARA_API NzHashMD5 : public NzHashImpl
class NAZARA_API NzHashMD5 : public NzAbstractHash
{
public:
NzHashMD5();

View File

@ -8,12 +8,12 @@
#define NAZARA_HASH_SHA1_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/AbstractHash.hpp>
#include <Nazara/Core/HashDigest.hpp>
#include <Nazara/Core/HashImpl.hpp>
union SHA_CTX;
class NAZARA_API NzHashSHA1 : public NzHashImpl
class NAZARA_API NzHashSHA1 : public NzAbstractHash
{
public:
NzHashSHA1();

View File

@ -8,12 +8,12 @@
#define NAZARA_HASH_SHA224_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/AbstractHash.hpp>
#include <Nazara/Core/HashDigest.hpp>
#include <Nazara/Core/HashImpl.hpp>
union SHA_CTX;
class NAZARA_API NzHashSHA224 : public NzHashImpl
class NAZARA_API NzHashSHA224 : public NzAbstractHash
{
public:
NzHashSHA224();

View File

@ -8,12 +8,12 @@
#define NAZARA_HASH_SHA256_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/AbstractHash.hpp>
#include <Nazara/Core/HashDigest.hpp>
#include <Nazara/Core/HashImpl.hpp>
union SHA_CTX;
class NAZARA_API NzHashSHA256 : public NzHashImpl
class NAZARA_API NzHashSHA256 : public NzAbstractHash
{
public:
NzHashSHA256();

View File

@ -8,12 +8,12 @@
#define NAZARA_HASH_SHA384_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/AbstractHash.hpp>
#include <Nazara/Core/HashDigest.hpp>
#include <Nazara/Core/HashImpl.hpp>
union SHA_CTX;
class NAZARA_API NzHashSHA384 : public NzHashImpl
class NAZARA_API NzHashSHA384 : public NzAbstractHash
{
public:
NzHashSHA384();

View File

@ -8,12 +8,12 @@
#define NAZARA_HASH_SHA512_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/AbstractHash.hpp>
#include <Nazara/Core/HashDigest.hpp>
#include <Nazara/Core/HashImpl.hpp>
union SHA_CTX;
class NAZARA_API NzHashSHA512 : public NzHashImpl
class NAZARA_API NzHashSHA512 : public NzAbstractHash
{
public:
NzHashSHA512();

View File

@ -6,12 +6,12 @@
#define NAZARA_HASH_WHIRLPOOL_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/AbstractHash.hpp>
#include <Nazara/Core/HashDigest.hpp>
#include <Nazara/Core/HashImpl.hpp>
struct NzHashWhirlpool_state;
class NAZARA_API NzHashWhirlpool : public NzHashImpl
class NAZARA_API NzHashWhirlpool : public NzAbstractHash
{
public:
NzHashWhirlpool();

View File

@ -22,8 +22,8 @@ enum nzHash
nzHash_Whirlpool
};
class NzAbstractHash;
class NzHashDigest;
class NzHashImpl;
class NAZARA_API NzHashable
{
@ -34,10 +34,10 @@ class NAZARA_API NzHashable
virtual ~NzHashable();
NzHashDigest GetHash(nzHash hash) const;
NzHashDigest GetHash(NzHashImpl* impl) const;
NzHashDigest GetHash(NzAbstractHash* impl) const;
private:
virtual bool FillHash(NzHashImpl* impl) const = 0;
virtual bool FillHash(NzAbstractHash* impl) const = 0;
};
#endif // HASHABLE_HPP_INCLUDED

View File

@ -302,7 +302,7 @@ class NAZARA_API NzString : public NzHashable
private:
void EnsureOwnership();
bool FillHash(NzHashImpl* hash) const;
bool FillHash(NzAbstractHash* hash) const;
void ReleaseString();
SharedString* m_sharedString;

View File

@ -20,12 +20,12 @@
#include <Nazara/Renderer/Enums.hpp>
class NzShader;
class NzTexture;
using NzShaderConstRef = NzResourceRef<const NzShader>;
using NzShaderRef = NzResourceRef<NzShader>;
class NzShaderImpl;
class NzAbstractShader;
class NzTexture;
class NAZARA_API NzShader : public NzResource, NzNonCopyable
{
@ -82,7 +82,7 @@ class NAZARA_API NzShader : public NzResource, NzNonCopyable
private:
nzUInt32 m_flags;
NzShaderImpl* m_impl;
NzAbstractShader* m_impl;
bool m_compiled;
};

View File

@ -18,14 +18,14 @@ class NzBuffer;
using NzBufferConstRef = NzResourceRef<const NzBuffer>;
using NzBufferRef = NzResourceRef<NzBuffer>;
class NzBufferImpl;
class NzAbstractBuffer;
class NAZARA_API NzBuffer : public NzResource, NzNonCopyable
{
friend class NzUtility;
public:
using BufferFunction = NzBufferImpl* (*)(NzBuffer* parent, nzBufferType type);
using BufferFunction = NzAbstractBuffer* (*)(NzBuffer* parent, nzBufferType type);
NzBuffer(nzBufferType type);
NzBuffer(nzBufferType type, unsigned int length, nzUInt8 typeSize, nzBufferStorage storage = nzBufferStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
@ -38,7 +38,7 @@ class NAZARA_API NzBuffer : public NzResource, NzNonCopyable
bool Fill(const void* data, unsigned int offset, unsigned int length, bool forceDiscard = false);
NzBufferImpl* GetImpl() const;
NzAbstractBuffer* GetImpl() const;
unsigned int GetLength() const;
void* GetPointer();
const void* GetPointer() const;
@ -69,7 +69,7 @@ class NAZARA_API NzBuffer : public NzResource, NzNonCopyable
nzBufferType m_type;
nzBufferUsage m_usage;
nzUInt8 m_typeSize;
NzBufferImpl* m_impl;
NzAbstractBuffer* m_impl;
unsigned int m_length;
static BufferFunction s_bufferFunctions[nzBufferStorage_Max+1];

View File

@ -1,31 +0,0 @@
// Copyright (C) 2013 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_BUFFERIMPL_HPP
#define NAZARA_BUFFERIMPL_HPP
#include <Nazara/Utility/Buffer.hpp>
class NAZARA_API NzBufferImpl
{
public:
NzBufferImpl() = default;
virtual ~NzBufferImpl();
virtual bool Create(unsigned int size, nzBufferUsage usage = nzBufferUsage_Static) = 0;
virtual void Destroy() = 0;
virtual bool Fill(const void* data, unsigned int offset, unsigned int size, bool forceDiscard = false) = 0;
virtual void* GetPointer() = 0;
virtual bool IsHardware() const = 0;
virtual void* Map(nzBufferAccess access, unsigned int offset = 0, unsigned int size = 0) = 0;
virtual bool Unmap() = 0;
};
#endif // NAZARA_BUFFERIMPL_INCLUDED

View File

@ -3,10 +3,10 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/File.hpp>
#include <Nazara/Core/AbstractHash.hpp>
#include <Nazara/Core/Config.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/Hash.hpp>
#include <Nazara/Core/HashImpl.hpp>
#include <Nazara/Core/StringStream.hpp>
#include <cstring>
#include <utility>
@ -631,7 +631,7 @@ NzHashDigest NzFile::GetHash(const NzString& filePath, nzHash hash)
return h.Hash(file);
}
NzHashDigest NzFile::GetHash(const NzString& filePath, NzHashImpl* hash)
NzHashDigest NzFile::GetHash(const NzString& filePath, NzAbstractHash* hash)
{
NzFile file(filePath);
@ -707,7 +707,7 @@ bool NzFile::Rename(const NzString& sourcePath, const NzString& targetPath)
return NzFileImpl::Rename(NormalizePath(sourcePath), NormalizePath(targetPath));
}
bool NzFile::FillHash(NzHashImpl* hash) const
bool NzFile::FillHash(NzAbstractHash* hash) const
{
NzFile file(m_filePath);
if (!file.Open(NzFile::ReadOnly))

View File

@ -56,7 +56,7 @@ NzHash::NzHash(nzHash hash)
}
}
NzHash::NzHash(NzHashImpl* hashImpl) :
NzHash::NzHash(NzAbstractHash* hashImpl) :
m_impl(hashImpl)
{
}

View File

@ -14,7 +14,7 @@ NzHashDigest NzHashable::GetHash(nzHash hash) const
return h.Hash(*this);
}
NzHashDigest NzHashable::GetHash(NzHashImpl* impl) const
NzHashDigest NzHashable::GetHash(NzAbstractHash* impl) const
{
NzHash h(impl);
return h.Hash(*this);

View File

@ -3,9 +3,9 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/String.hpp>
#include <Nazara/Core/AbstractHash.hpp>
#include <Nazara/Core/Config.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/HashImpl.hpp>
#include <Nazara/Core/Unicode.hpp>
#include <Nazara/Math/Basic.hpp>
#include <algorithm>
@ -5094,7 +5094,7 @@ void NzString::EnsureOwnership()
}
}
bool NzString::FillHash(NzHashImpl* hazh) const
bool NzString::FillHash(NzAbstractHash* hazh) const
{
hazh->Append(reinterpret_cast<const nzUInt8*>(m_sharedString->string), m_sharedString->size);

View File

@ -2,7 +2,7 @@
// This file is part of the "Nazara Engine - Renderer module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/ShaderImpl.hpp>
#include <Nazara/Renderer/AbstractShader.hpp>
#include <Nazara/Renderer/Debug.hpp>
NzShaderImpl::~NzShaderImpl() = default;
NzAbstractShader::~NzAbstractShader() = default;

View File

@ -4,18 +4,18 @@
#pragma once
#ifndef NAZARA_SHADERIMPL_HPP
#define NAZARA_SHADERIMPL_HPP
#ifndef NAZARA_ABSTRACTSHADER_HPP
#define NAZARA_ABSTRACTSHADER_HPP
#include <Nazara/Renderer/Shader.hpp>
class NzShaderImpl
class NzAbstractShader
{
friend class NzRenderer;
public:
NzShaderImpl() = default;
virtual ~NzShaderImpl();
NzAbstractShader() = default;
virtual ~NzAbstractShader();
virtual bool Bind() = 0;
virtual bool BindTextures() = 0;
@ -51,4 +51,4 @@ class NzShaderImpl
virtual bool SendVector(int location, const NzVector4f& vector) = 0;
};
#endif // NAZARA_SHADERIMPL_HPP
#endif // NAZARA_ABSTRACTSHADER_HPP

View File

@ -9,14 +9,14 @@
#include <Nazara/Core/ResourceListener.hpp>
#include <Nazara/Core/String.hpp>
#include <Nazara/Renderer/AbstractShader.hpp>
#include <Nazara/Renderer/OpenGL.hpp>
#include <Nazara/Renderer/Shader.hpp>
#include <Nazara/Renderer/ShaderImpl.hpp>
#include <map>
class NzResource;
class NzGLSLShader : public NzShaderImpl, NzResourceListener
class NzGLSLShader : public NzAbstractShader, NzResourceListener
{
public:
NzGLSLShader(NzShader* parent);

View File

@ -9,9 +9,9 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Renderer/OpenGL.hpp>
#include <Nazara/Utility/BufferImpl.hpp>
#include <Nazara/Utility/AbstractBuffer.hpp>
class NzHardwareBuffer : public NzBufferImpl
class NzHardwareBuffer : public NzAbstractBuffer
{
public:
NzHardwareBuffer(NzBuffer* parent, nzBufferType type);

View File

@ -7,6 +7,7 @@
#include <Nazara/Core/Color.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/Log.hpp>
#include <Nazara/Renderer/AbstractShader.hpp>
#include <Nazara/Renderer/Config.hpp>
#include <Nazara/Renderer/Context.hpp>
#include <Nazara/Renderer/DebugDrawer.hpp>
@ -15,9 +16,8 @@
#include <Nazara/Renderer/RenderTarget.hpp>
#include <Nazara/Renderer/Shader.hpp>
#include <Nazara/Renderer/ShaderBuilder.hpp>
#include <Nazara/Renderer/ShaderImpl.hpp>
#include <Nazara/Renderer/Loaders/Texture.hpp>
#include <Nazara/Utility/BufferImpl.hpp>
#include <Nazara/Utility/AbstractBuffer.hpp>
#include <Nazara/Utility/IndexBuffer.hpp>
#include <Nazara/Utility/Utility.hpp>
#include <Nazara/Utility/VertexBuffer.hpp>
@ -62,7 +62,7 @@ namespace
bool textureUpdated = true;
};
NzBufferImpl* HardwareBufferFunction(NzBuffer* parent, nzBufferType type)
NzAbstractBuffer* HardwareBufferFunction(NzBuffer* parent, nzBufferType type)
{
return new NzHardwareBuffer(parent, type);
}
@ -1433,7 +1433,7 @@ bool NzRenderer::EnsureStateUpdate()
}
#endif
NzShaderImpl* shaderImpl;
NzAbstractShader* shaderImpl;
if (s_updateFlags & Update_Shader)
{
@ -1664,7 +1664,10 @@ bool NzRenderer::EnsureStateUpdate()
}
}
else
glDisableVertexAttribArray(NzOpenGL::AttributeIndex[nzElementUsage_TexCoord]+8);
{
for (unsigned int i = 8; i < 8+4; ++i)
glDisableVertexAttribArray(NzOpenGL::AttributeIndex[nzElementUsage_TexCoord]+i);
}
if (s_indexBuffer)
{

View File

@ -7,10 +7,10 @@
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/File.hpp>
#include <Nazara/Core/String.hpp>
#include <Nazara/Renderer/AbstractShader.hpp>
#include <Nazara/Renderer/Config.hpp>
#include <Nazara/Renderer/GLSLShader.hpp>
#include <Nazara/Renderer/Renderer.hpp>
#include <Nazara/Renderer/ShaderImpl.hpp>
#include <stdexcept>
#include <Nazara/Renderer/Debug.hpp>

View File

@ -2,7 +2,7 @@
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/BufferImpl.hpp>
#include <Nazara/Utility/AbstractBuffer.hpp>
#include <Nazara/Utility/Debug.hpp>
NzBufferImpl::~NzBufferImpl() = default;
NzAbstractBuffer::~NzAbstractBuffer() = default;

View File

@ -4,7 +4,7 @@
#include <Nazara/Utility/Buffer.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Utility/BufferImpl.hpp>
#include <Nazara/Utility/AbstractBuffer.hpp>
#include <Nazara/Utility/BufferMapper.hpp>
#include <Nazara/Utility/Config.hpp>
#include <Nazara/Utility/SoftwareBuffer.hpp>
@ -14,7 +14,7 @@
namespace
{
NzBufferImpl* SoftwareBufferFunction(NzBuffer* parent, nzBufferType type)
NzAbstractBuffer* SoftwareBufferFunction(NzBuffer* parent, nzBufferType type)
{
return new NzSoftwareBuffer(parent, type);
}
@ -86,7 +86,7 @@ bool NzBuffer::Create(unsigned int length, nzUInt8 typeSize, nzBufferStorage sto
return false;
}
NzBufferImpl* impl = s_bufferFunctions[storage](this, m_type);
NzAbstractBuffer* impl = s_bufferFunctions[storage](this, m_type);
if (!impl->Create(length*typeSize, usage))
{
NazaraError("Failed to create buffer");
@ -136,7 +136,7 @@ bool NzBuffer::Fill(const void* data, unsigned int offset, unsigned int length,
return m_impl->Fill(data, offset*m_typeSize, ((length == 0) ? m_length-offset : length)*m_typeSize, forceDiscard);
}
NzBufferImpl* NzBuffer::GetImpl() const
NzAbstractBuffer* NzBuffer::GetImpl() const
{
return m_impl;
}
@ -279,7 +279,7 @@ bool NzBuffer::SetStorage(nzBufferStorage storage)
return false;
}
NzBufferImpl* impl = s_bufferFunctions[storage](this, m_type);
NzAbstractBuffer* impl = s_bufferFunctions[storage](this, m_type);
if (!impl->Create(m_length*m_typeSize, m_usage))
{
NazaraError("Failed to create buffer");

View File

@ -8,9 +8,9 @@
#define NAZARA_SOFTWAREBUFFER_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Utility/BufferImpl.hpp>
#include <Nazara/Utility/AbstractBuffer.hpp>
class NzSoftwareBuffer : public NzBufferImpl
class NzSoftwareBuffer : public NzAbstractBuffer
{
public:
NzSoftwareBuffer(NzBuffer* parent, nzBufferType type);