blog/cpp/fonts/reader/buffer.h

44 lines
1.2 KiB
C
Raw Normal View History

2024-09-13 15:10:58 +08:00
#ifndef __READER_BUFFER_H__
#define __READER_BUFFER_H__
#include "reader.h"
#include <sstream>
class buffer : public reader
{
private:
std::stringstream fp;
std::streampos length;
public:
buffer(/* args */) : length(0) {};
~buffer() {};
buffer(std::string data);
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 { return ""; };
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