#pragma once #include "ehs/EHS.h" #include "ehs/Str.h" #include "ehs/io/File.h" namespace ehs { class Img; class ImgCodec; typedef bool (*EncodeImgCb)(const ImgCodec* const, Serializer&, const Img*); typedef bool (*DecodeImgCb)(const ImgCodec* const, Serializer&, Img*); class EHS_LIB_IO ImgCodec { private: Str_8 id; UInt_64 hashExt; Str_8 ext; Endianness endianness; EncodeImgCb encoder; DecodeImgCb decoder; public: ImgCodec(); ImgCodec(Str_8 id, Str_8 ext, Endianness end, EncodeImgCb encoder, DecodeImgCb decoder); 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& out, const Img* in) const; bool Decode(Serializer& in, Img* out) const; }; }