mirror of
https://github.com/encounter/aurora.git
synced 2026-03-30 10:57:39 -07:00
18cdf141cb
Original repository: https://github.com/AxioDL/kabufuda Cleaned up & converted to `aurora::card`, with SDL3 file I/O. --------- Co-authored-by: Phillip Stephens <antidote.crk@gmail.com> Co-authored-by: Jack Andersen <jackoalan@gmail.com> Co-authored-by: Lioncash <mathew1800@gmail.com> Co-authored-by: Luke Street <luke@street.dev>
32 lines
682 B
C++
32 lines
682 B
C++
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <string>
|
|
|
|
#include <SDL3/SDL_iostream.h>
|
|
|
|
namespace aurora::card {
|
|
|
|
class FileIO {
|
|
std::string m_path;
|
|
SDL_IOStream* m_stream = nullptr;
|
|
|
|
bool isReady() const;
|
|
|
|
public:
|
|
FileIO() = default;
|
|
explicit FileIO(std::string_view filename, bool truncate = false);
|
|
~FileIO();
|
|
|
|
FileIO(FileIO&& other) noexcept;
|
|
FileIO& operator=(FileIO&& other) noexcept;
|
|
FileIO(const FileIO& other) = delete;
|
|
FileIO& operator=(const FileIO& other) = delete;
|
|
|
|
bool fileRead(void* buf, size_t length, off_t offset);
|
|
bool fileWrite(const void* buf, size_t length, off_t offset);
|
|
explicit operator bool() const;
|
|
};
|
|
|
|
} // namespace aurora::card
|