blob: c331f950735f7025957c258c69117bc60a0f650c (
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
25
26
27
28
29
30
31
32
33
34
|
#pragma once
#include <string>
#include <functional>
#include <memory>
namespace libdb {
extern "C" {
#include <db.h>
}
}
namespace crepe {
class DB {
public:
DB(const std::string & path);
virtual ~DB() = default;
public:
std::string get(const std::string & key);
void set(const std::string & key, const std::string & value);
bool has(const std::string & key);
private:
std::unique_ptr<libdb::DB, std::function<void(libdb::DB *)>> db;
std::unique_ptr<libdb::DBC, std::function<void(libdb::DBC *)>> cursor;
private:
libdb::DBT to_thing(const std::string & thing);
};
}
|