mirror of https://github.com/libAthena/athena.git
fixed incomplete-type warnings involving recursively-derived DNA types
This commit is contained in:
parent
24fedff58e
commit
f3ba8819a4
2
PKGBUILD
2
PKGBUILD
|
@ -1,7 +1,7 @@
|
||||||
# PKGBUILD for libAthena
|
# PKGBUILD for libAthena
|
||||||
_pkgname=libathena
|
_pkgname=libathena
|
||||||
pkgname=$_pkgname-git
|
pkgname=$_pkgname-git
|
||||||
pkgver=2.0.0.7.g87306a1
|
pkgver=2.0.0.8.g24fedff
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Basic cross platform IO library"
|
pkgdesc="Basic cross platform IO library"
|
||||||
arch=('i686' 'x86_64')
|
arch=('i686' 'x86_64')
|
||||||
|
|
|
@ -18,6 +18,20 @@ namespace Athena
|
||||||
namespace io
|
namespace io
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* forward-declaration dance for recursively-derived types */
|
||||||
|
|
||||||
|
template <size_t sizeVar, Endian VE>
|
||||||
|
struct Buffer;
|
||||||
|
|
||||||
|
template <atInt32 sizeVar, Endian VE>
|
||||||
|
struct String;
|
||||||
|
|
||||||
|
template <atInt32 sizeVar, Endian VE>
|
||||||
|
struct WString;
|
||||||
|
|
||||||
|
template <atInt32 sizeVar, Endian VE>
|
||||||
|
struct UTF8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Base DNA class used against 'atdna'
|
* @brief Base DNA class used against 'atdna'
|
||||||
*
|
*
|
||||||
|
@ -38,12 +52,33 @@ struct DNA
|
||||||
template <typename T, size_t cntVar, Endian VE = DNAE>
|
template <typename T, size_t cntVar, Endian VE = DNAE>
|
||||||
using Vector = std::vector<T>;
|
using Vector = std::vector<T>;
|
||||||
|
|
||||||
struct Delete {};
|
|
||||||
|
|
||||||
template <size_t sizeVar>
|
template <size_t sizeVar>
|
||||||
struct Buffer : public DNA, public std::unique_ptr<atUint8[]>
|
using Buffer = struct Buffer<sizeVar, DNAE>;
|
||||||
|
|
||||||
|
template <atInt32 sizeVar = -1>
|
||||||
|
using String = struct String<sizeVar, DNAE>;
|
||||||
|
|
||||||
|
template <atInt32 sizeVar = -1, Endian VE = DNAE>
|
||||||
|
using WString = struct WString<sizeVar, VE>;
|
||||||
|
|
||||||
|
template <atInt32 sizeVar = -1>
|
||||||
|
using UTF8 = struct UTF8<sizeVar, DNAE>;
|
||||||
|
|
||||||
|
template <off_t offset, SeekOrigin direction>
|
||||||
|
struct Seek {};
|
||||||
|
|
||||||
|
template <size_t align>
|
||||||
|
struct Align {};
|
||||||
|
|
||||||
|
struct Delete {};
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Concrete DNA types */
|
||||||
|
|
||||||
|
template <size_t sizeVar, Endian VE>
|
||||||
|
struct Buffer : public DNA<VE>, public std::unique_ptr<atUint8[]>
|
||||||
{
|
{
|
||||||
Delete expl;
|
typename DNA<VE>::Delete expl;
|
||||||
inline void read(IStreamReader& reader)
|
inline void read(IStreamReader& reader)
|
||||||
{
|
{
|
||||||
reset(new atUint8[sizeVar]);
|
reset(new atUint8[sizeVar]);
|
||||||
|
@ -55,10 +90,10 @@ struct DNA
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <atInt32 sizeVar = -1>
|
template <atInt32 sizeVar, Endian VE>
|
||||||
struct String : public DNA, public std::string
|
struct String : public DNA<VE>, public std::string
|
||||||
{
|
{
|
||||||
Delete expl;
|
typename DNA<VE>::Delete expl;
|
||||||
inline void read(IStreamReader& reader)
|
inline void read(IStreamReader& reader)
|
||||||
{*this = reader.readString(sizeVar);}
|
{*this = reader.readString(sizeVar);}
|
||||||
inline void write(IStreamWriter& writer) const
|
inline void write(IStreamWriter& writer) const
|
||||||
|
@ -69,10 +104,10 @@ struct DNA
|
||||||
{this->swap(__str); return *this;}
|
{this->swap(__str); return *this;}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <atInt32 sizeVar = -1, Endian VE = DNAE>
|
template <atInt32 sizeVar, Endian VE>
|
||||||
struct WString : public DNA, public std::wstring
|
struct WString : public DNA<VE>, public std::wstring
|
||||||
{
|
{
|
||||||
Delete expl;
|
typename DNA<VE>::Delete expl;
|
||||||
inline void read(IStreamReader& reader)
|
inline void read(IStreamReader& reader)
|
||||||
{
|
{
|
||||||
reader.setEndian(VE);
|
reader.setEndian(VE);
|
||||||
|
@ -89,10 +124,10 @@ struct DNA
|
||||||
{this->swap(__str); return *this;}
|
{this->swap(__str); return *this;}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <atInt32 sizeVar = -1>
|
template <atInt32 sizeVar, Endian VE>
|
||||||
struct UTF8 : public DNA, public std::string
|
struct UTF8 : public DNA<VE>, public std::string
|
||||||
{
|
{
|
||||||
Delete expl;
|
typename DNA<VE>::Delete expl;
|
||||||
inline void read(IStreamReader& reader)
|
inline void read(IStreamReader& reader)
|
||||||
{*this = reader.readUnicode(sizeVar);}
|
{*this = reader.readUnicode(sizeVar);}
|
||||||
inline void write(IStreamWriter& writer) const
|
inline void write(IStreamWriter& writer) const
|
||||||
|
@ -103,14 +138,6 @@ struct DNA
|
||||||
{this->swap(__str); return *this;}
|
{this->swap(__str); return *this;}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <off_t offset, SeekOrigin direction>
|
|
||||||
struct Seek {};
|
|
||||||
|
|
||||||
template <size_t align>
|
|
||||||
struct Align {};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Macro to automatically declare read/write methods in subclasses */
|
/** Macro to automatically declare read/write methods in subclasses */
|
||||||
#define DECL_DNA \
|
#define DECL_DNA \
|
||||||
void read(Athena::io::IStreamReader&); \
|
void read(Athena::io::IStreamReader&); \
|
||||||
|
|
Loading…
Reference in New Issue