2024-02-05 22:25:30 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ehs/EHS.h"
|
|
|
|
#include "ehs/Str.h"
|
|
|
|
#include "ehs/io/File.h"
|
|
|
|
|
|
|
|
namespace ehs
|
|
|
|
{
|
|
|
|
class Img;
|
2024-02-20 22:47:52 -08:00
|
|
|
class ImgCodec;
|
|
|
|
|
|
|
|
typedef bool (*EncodeImgCb)(const ImgCodec* const, Serializer<UInt_64>&, const Img*);
|
|
|
|
typedef bool (*DecodeImgCb)(const ImgCodec* const, Serializer<UInt_64>&, Img*);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-07-24 01:36:20 -07:00
|
|
|
class EHS_LIB_IO ImgCodec
|
2024-02-05 22:25:30 -08:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
Str_8 id;
|
|
|
|
UInt_64 hashExt;
|
|
|
|
Str_8 ext;
|
|
|
|
Endianness endianness;
|
2024-02-20 22:47:52 -08:00
|
|
|
EncodeImgCb encoder;
|
|
|
|
DecodeImgCb decoder;
|
2024-02-05 22:25:30 -08:00
|
|
|
|
|
|
|
public:
|
|
|
|
ImgCodec();
|
|
|
|
|
2024-02-20 22:47:52 -08:00
|
|
|
ImgCodec(Str_8 id, Str_8 ext, Endianness end, EncodeImgCb encoder, DecodeImgCb decoder);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
|
|
|
ImgCodec(ImgCodec&& codec) noexcept;
|
|
|
|
|
|
|
|
ImgCodec(const ImgCodec& codec);
|
|
|
|
|
|
|
|
ImgCodec& operator=(ImgCodec&& codec) noexcept;
|
|
|
|
|
|
|
|
ImgCodec& operator=(const ImgCodec& codec);
|
|
|
|
|
|
|
|
Str_8 GetId() const;
|
|
|
|
|
|
|
|
UInt_64 GetHashExt() const;
|
|
|
|
|
|
|
|
Str_8 GetExt() const;
|
|
|
|
|
|
|
|
Endianness GetEndianness() const;
|
|
|
|
|
|
|
|
bool Encode(Serializer<UInt_64>& out, const Img* in) const;
|
|
|
|
|
|
|
|
bool Decode(Serializer<UInt_64>& in, Img* out) const;
|
|
|
|
};
|
|
|
|
}
|