14 : _add(
add), _pos(pos), _esize(esize), _size(size)
22 _add ?
"append" :
"read",
34 if (src !=
nullptr && cnt > 0) {
64 data.seekg(0, std::ios::end);
65 const size_t fileSize =
to_size(data.tellg());
68 data.read(
reinterpret_cast<char*
>(
_storage.data()), fileSize);
ByteBufferException(bool add, size_t pos, size_t esize, size_t size)
void printPosError() const
void append(const Byte *src, size_t cnt)
Appends 'cnt' bytes from 'src' to the buffer.
bool loadFromFile(const ResourcePath &path, std::string_view fileName, const U8 version=BUFFER_FORMAT_VERSION)
void clear() noexcept
Resets the entire storage and the read and write positions.
static const size_t DEFAULT_SIZE
bool dumpToFile(const ResourcePath &path, std::string_view fileName, const U8 version=BUFFER_FORMAT_VERSION)
Saves the entire buffer contents to file. Always appends the version at the end of the file.
Handle console commands that start with a forward slash.
FileError writeFile(const ResourcePath &filePath, const std::string_view fileName, const char *content, const size_t length, const FileType fileType)
FileError readFile(const ResourcePath &filePath, std::string_view fileName, FileType fileType, std::ifstream &sreamOut)
constexpr resolve_uac< A, B >::return_type add(const A &a, const B &b) noexcept
constexpr U8 to_U8(const T value)
constexpr size_t to_size(const T value)
static NO_INLINE void errorfn(const char *format, T &&... args)