aboutsummaryrefslogtreecommitdiff
path: root/include/dchat/Storage.hpp
blob: 4f3dfa23d04f15652111ac7cb6f074c898bacb8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once

#include <functional>
#include <string>
#include <unordered_map>
#include <boost/filesystem/path.hpp>

namespace dchat
{
    // Throws runtime exception on failure
    boost::filesystem::path getHomeDir();

    // Creates directory if it doesn't exist (recursively). Throws boost exception on failure
    boost::filesystem::path getDchatDir();
    
    // Creates directory if it doesn't exist (recursively). Throws boost exception on failure
    boost::filesystem::path getImagesDir();

    using LoadBindsCallbackFunc = std::function<void(const std::string &key, const std::string &value)>;

    // @callbackFunc can't be nullptr
    void loadBindsFromFile(LoadBindsCallbackFunc callbackFunc);
    void replaceBindsInFile(const std::unordered_map<std::string, std::string> &binds);
}