mirror of
https://github.com/libAthena/athena.git
synced 2025-12-09 05:27:50 +00:00
* Add PHYSFSFileReader class
This commit is contained in:
61
include/Athena/PHYSFSFileReader.hpp
Normal file
61
include/Athena/PHYSFSFileReader.hpp
Normal file
@@ -0,0 +1,61 @@
|
||||
#ifdef ATHENA_ENABLE_PHYSFS
|
||||
#ifndef PHYSFSSTREAM_HPP
|
||||
#define PHYSFSSTREAM_HPP
|
||||
|
||||
#include "Athena/Stream.hpp"
|
||||
#include <physfs.h>
|
||||
|
||||
namespace Athena
|
||||
{
|
||||
namespace io
|
||||
{
|
||||
class PHYSFSFileReader : public Stream
|
||||
{
|
||||
public:
|
||||
PHYSFSFileReader(const std::string& path);
|
||||
|
||||
void setEndian(Endian);
|
||||
Endian endian() const;
|
||||
bool isBigEndian() const;
|
||||
bool isLittleEndian() const;
|
||||
atUint8* data();
|
||||
|
||||
atUint64 length() const;
|
||||
|
||||
atUint64 position() const;
|
||||
|
||||
bool isOpen() const;
|
||||
|
||||
void seek(atInt64 position, SeekOrigin origin);
|
||||
atInt8 readByte();
|
||||
atUint8 readUByte();
|
||||
atUint8* readUBytes(atUint64 length);
|
||||
atInt8* readBytes(atUint64 length);
|
||||
atUint16 readUint16();
|
||||
atInt16 readInt16();
|
||||
atUint32 readUint32();
|
||||
atInt32 readInt32();
|
||||
atUint64 readUint64();
|
||||
atInt64 readInt64();
|
||||
double readDouble();
|
||||
float readFloat();
|
||||
bool readBool();
|
||||
|
||||
bool atEnd() const;
|
||||
|
||||
// TODO: Strings
|
||||
private:
|
||||
Endian m_endian;
|
||||
std::string m_path;
|
||||
atUint64 m_length;
|
||||
PHYSFS_File* m_handle;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PHYSFSFILEREADER_BASE
|
||||
#define PHYSFSFILEREADER_BASE() \
|
||||
typedef Athena::io::PHYSFSFileReader base
|
||||
#endif
|
||||
#endif // PHYSFSSTREAM_HPP
|
||||
#endif // ATHENA_ENABLE_PHYSFS
|
||||
Reference in New Issue
Block a user