src/files update + write_binary_json compression argument

This commit is contained in:
MihailRis
2024-01-22 00:36:17 +03:00
parent d2fe51e1ff
commit 6efbaac18a
2 changed files with 43 additions and 28 deletions
+23 -5
View File
@@ -27,15 +27,33 @@ namespace files {
size_t length() const;
};
/* Write bytes array to the file without any extra data */
extern bool write_bytes(fs::path, const ubyte* data, size_t size);
extern bool write_bytes(fs::path, const char* data, size_t size);
extern uint append_bytes(fs::path, const char* data, size_t size);
/* Append bytes array to the file without any extra data */
extern uint append_bytes(fs::path, const ubyte* data, size_t size);
/* Write string to the file */
extern bool write_string(fs::path filename, const std::string content);
extern bool write_json(fs::path filename, const dynamic::Map* obj, bool nice=true);
extern bool write_binary_json(fs::path filename, const dynamic::Map* obj);
/* Write dynamic data to the JSON file
@param nice if true,
human readable format will be used, otherwise minimal */
extern bool write_json(
fs::path filename,
const dynamic::Map* obj,
bool nice=true);
/* Write dynamic data to the binary JSON file
(see src/coders/binary_json_spec.md)
@param compressed use gzip compression */
extern bool write_binary_json(
fs::path filename,
const dynamic::Map* obj,
bool compressed=false);
extern bool read(fs::path, char* data, size_t size);
extern char* read_bytes(fs::path, size_t& length);
extern ubyte* read_bytes(fs::path, size_t& length);
extern std::string read_string(fs::path filename);
extern std::unique_ptr<dynamic::Map> read_json(fs::path file);
extern std::unique_ptr<dynamic::Map> read_binary_json(fs::path file);