blog/cpp/fonts/reader/file.h

45 lines
1.2 KiB
C++

#ifndef __READER_FILE_H__
#define __READER_FILE_H__
#include "reader.h"
#include <fstream>
class file : public reader
{
private:
std::ifstream fp;
char *path;
std::streampos length;
public:
file() : path(nullptr), length(0), fp() {};
~file();
file(const char *filePath);
std::streamsize read(char *, uint16_t) override;
int8_t readInt8() override;
int16_t readInt16() override;
int32_t readInt32() override;
int64_t readInt64() override;
uint8_t readUint8() override;
uint16_t readUint16() override;
uint32_t readUint32() override;
uint64_t readUint64() override;
std::string readString(int) override;
bool seek(int64_t) override;
std::streampos curr() override;
std::string getPath() override;
std::streampos getLength() override { return length; };
uint24_t readUint24() override;
FWORD readFWord() override;
UFWORD readUFWord() override;
Offset8 readOffset8() override;
Offset16 readOffset16() override;
Offset24 readOffset24() override;
Offset32 readOffset32() override;
int24_t readInt24() override;
Fixed readFixed() override;
F2DOT14 readF2Dot14() override;
Version16Dot16 readVersion16Dot16() override;
Tag readTag() override;
};
#endif