13#include <system_error>
24 : buffer_chunk_size_(buffer_chunk_size), filepath_(filepath)
28 throw std::system_error(
29 errno, std::system_category(),
"Cannot open file " + std::string(filepath) +
".");
35 for (
const VectorChar &
b : blocks_) {
36 fwrite(
b.data(), 1,
b.size(), this->outfile_);
46 int close_status = std::fclose(outfile_);
47 if (close_status == EOF) {
51 CLOG_ERROR(&
LOG,
"Error: could not close file '%s' properly, it may be corrupted.", filepath_);
68 write_fstring(
"property list {} {} {}\n", countType, dataType, name);
84 VectorChar &bb = blocks_.last();
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)
FILE * BLI_fopen(const char *filepath, const char *mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()