aboutsummaryrefslogtreecommitdiff
path: root/include/odhtdb/FileUtils.hpp
blob: 7bfbe3ed2954255caafbecbf201a9896417eab14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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);
}