#pragma once #include #include #include class XignReader { public: XignReader(unsigned char* input, std::size_t size); ~XignReader(); std::size_t fetch(unsigned char* output); template T read(); std::vector& get(); private: bool read_buffer(unsigned char* buffer, std::size_t size); bool check_index(std::size_t nSize); std::size_t index; std::vector buffer; }; template T XignReader::read() { if (this->check_index(sizeof(T))) { this->index += sizeof(T); return *reinterpret_cast(this->buffer.data() + this->index - sizeof(T)); } return static_cast(0); }