X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fio%2FWorldSave.hpp;fp=src%2Fio%2FWorldSave.hpp;h=4095016a10c442df04ac19fcc078e7a6552ffee8;hb=ede25c0a2f59e21521d1cd962e6ea9d78169ca12;hp=0000000000000000000000000000000000000000;hpb=d02daa5a4805dc3184884f3a7cd7620e5787adcb;p=blank.git diff --git a/src/io/WorldSave.hpp b/src/io/WorldSave.hpp new file mode 100644 index 0000000..4095016 --- /dev/null +++ b/src/io/WorldSave.hpp @@ -0,0 +1,42 @@ +#ifndef BLANK_IO_WORLDSAVE_HPP_ +#define BLANK_IO_WORLDSAVE_HPP_ + +#include "../world/Chunk.hpp" +#include "../world/World.hpp" + +#include +#include + + +namespace blank { + +class WorldSave { + +public: + explicit WorldSave(const std::string &path); + +public: + // whole save + bool Exists() const noexcept; + void Read(World::Config &) const; + void Write(const World::Config &) const; + + // single chunk + bool Exists(const Chunk::Pos &) const noexcept; + void Read(Chunk &) const; + void Write(Chunk &) const; + + const char *ChunkPath(const Chunk::Pos &) const; + +private: + std::string root_path; + std::string conf_path; + std::string chunk_path; + std::size_t chunk_bufsiz; + std::unique_ptr chunk_buf; + +}; + +} + +#endif