55 lines
1005 B
C++
55 lines
1005 B
C++
|
#include "ehs/io/img/PNG_Chunk.h"
|
||
|
|
||
|
namespace ehs
|
||
|
{
|
||
|
PNG_Chunk::PNG_Chunk()
|
||
|
: hashId(0), crc{0x0, 0x0, 0x0, 0x0}
|
||
|
{
|
||
|
}
|
||
|
|
||
|
PNG_Chunk::PNG_Chunk(const Str_8& id, const Serializer<UInt_64>& data, const Byte crc[4])
|
||
|
: id(id), hashId(id.Hash_64()), data(data), crc{crc[0], crc[1], crc[2], crc[3]}
|
||
|
{
|
||
|
}
|
||
|
|
||
|
PNG_Chunk::PNG_Chunk(const PNG_Chunk& chunk)
|
||
|
: id(chunk.id), hashId(chunk.hashId), data(chunk.data), crc{chunk.crc[0], chunk.crc[1], chunk.crc[2], chunk.crc[3]}
|
||
|
{
|
||
|
}
|
||
|
|
||
|
PNG_Chunk& PNG_Chunk::operator=(const PNG_Chunk& chunk)
|
||
|
{
|
||
|
if (this == &chunk)
|
||
|
return *this;
|
||
|
|
||
|
id = chunk.id;
|
||
|
hashId = chunk.hashId;
|
||
|
data = chunk.data;
|
||
|
crc[0] = chunk.crc[0];
|
||
|
crc[1] = chunk.crc[1];
|
||
|
crc[2] = chunk.crc[2];
|
||
|
crc[3] = chunk.crc[3];
|
||
|
|
||
|
return *this;
|
||
|
}
|
||
|
|
||
|
Str_8 PNG_Chunk::GetId() const
|
||
|
{
|
||
|
return id;
|
||
|
}
|
||
|
|
||
|
UInt_64 PNG_Chunk::GetHashId() const
|
||
|
{
|
||
|
return hashId;
|
||
|
}
|
||
|
|
||
|
Serializer<UInt_64>* PNG_Chunk::GetData()
|
||
|
{
|
||
|
return &data;
|
||
|
}
|
||
|
|
||
|
const unsigned char* PNG_Chunk::GetCRC() const
|
||
|
{
|
||
|
return crc;
|
||
|
}
|
||
|
}
|