diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-04-14 19:45:15 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-18 23:25:46 +0200 |
commit | 414f2cafc6cf2fe141c011b0d63d447a9b983ac3 (patch) | |
tree | a0d53ca898b8586e7be97689fcb993d5405d08a0 /include/odhtdb/FileUtils.hpp | |
parent | 53a1850ce2a253c574113684ac38c8ed31b1d0ae (diff) |
Store database storage to files, also loading
Diffstat (limited to 'include/odhtdb/FileUtils.hpp')
-rw-r--r-- | include/odhtdb/FileUtils.hpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/odhtdb/FileUtils.hpp b/include/odhtdb/FileUtils.hpp new file mode 100644 index 0000000..7bfbe3e --- /dev/null +++ b/include/odhtdb/FileUtils.hpp @@ -0,0 +1,22 @@ +#pragma once + +#include <boost/filesystem/path.hpp> +#include <stdexcept> +#include "OwnedMemory.hpp" +#include "DataView.hpp" + +namespace odhtdb +{ + class FileException : public std::runtime_error + { + public: + FileException(const std::string &errMsg) : std::runtime_error(errMsg) {} + }; + + // Throws FileException on error + OwnedMemory fileGetContent(const boost::filesystem::path &filepath); + + // Creates file if it doesn't exist. + // Throws FileException on error + void fileAppend(const boost::filesystem::path &filepath, const DataView &data); +} |