Files
Seele/src/Engine/Serialization/ArchiveBuffer.h
T

36 lines
797 B
C++
Raw Normal View History

2023-02-01 22:13:04 +01:00
#pragma once
2023-02-13 14:56:13 +01:00
#include "MinimalEngine.h"
#include "Containers/Array.h"
#include "Concepts.h"
#include <string>
2023-02-01 22:13:04 +01:00
namespace Seele
{
2023-02-13 14:56:13 +01:00
DECLARE_NAME_REF(Gfx, Graphics)
2023-02-01 22:13:04 +01:00
class ArchiveBuffer
{
public:
2023-02-13 14:56:13 +01:00
ArchiveBuffer();
ArchiveBuffer(Gfx::PGraphics graphics);
void writeBytes(const void* data, uint64 size);
void readBytes(void* dest, uint64 size);
void writeToStream(std::ostream& stream);
void readFromStream(std::istream& stream);
2023-02-24 22:09:07 +01:00
enum class SeekOp
{
CURRENT,
BEGIN,
END,
};
void seek(int64 s, SeekOp op);
2023-02-13 14:56:13 +01:00
bool eof() const;
2023-02-24 22:09:07 +01:00
size_t size() const;
2023-02-13 14:56:13 +01:00
void rewind();
Gfx::PGraphics& getGraphics();
2023-02-01 22:13:04 +01:00
private:
2023-02-13 14:56:13 +01:00
Gfx::PGraphics graphics;
uint64 version = 0;
uint64 position = 0;
2023-02-01 22:13:04 +01:00
Array<uint8> memory;
};
} // namespace Seele