13#include <system_error>
21 : buffer_chunk_size_(buffer_chunk_size), filepath_(filepath)
25 throw std::system_error(
26 errno, std::system_category(),
"Cannot open file " + std::string(filepath) +
".");
32 for (
const VectorChar &
b : blocks_) {
33 fwrite(
b.data(), 1,
b.size(), this->outfile_);
43 int close_status = std::fclose(outfile_);
44 if (close_status == EOF) {
48 CLOG_ERROR(&
LOG,
"Error: could not close file '%s' properly, it may be corrupted.", filepath_);
81 VectorChar &bb = blocks_.last();
FILE * BLI_fopen(const char *filepath, const char *mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
File and directory operations.
#define CLOG_ERROR(clg_ref,...)
constexpr int64_t size() const
constexpr const T * end() const
constexpr const T * begin() const
void insert(const int64_t insert_index, const T &value)
void ensure_space(size_t at_least)
void write_string(StringRef s)
void write_header_scalar_property(StringRef dataType, StringRef name)
void write_bytes(Span< char > bytes)
void write_header_list_property(StringRef countType, StringRef dataType, StringRef name)
void write_fstring(fmt::format_string< T... > fmt, T &&...args)
FileBuffer(const char *filepath, size_t buffer_chunk_size=64 *1024)
void write_header_element(StringRef name, int count)