-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDocument.hpp
42 lines (36 loc) · 1.01 KB
/
Document.hpp
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
35
36
37
38
39
40
41
42
#pragma once
#include <memory>
#include <string>
#include <vector>
#include "DataBaseConnection.hpp"
using namespace std::literals::string_literals;
namespace CCC {
using jsoncons::json;
class Document {
private:
enum class GetType {
Content,
Revisions
};
struct Arguments {
std::string uuid;
std::string revision = ""s;
std::string db;
std::shared_ptr<DataBaseConnection> connection;
};
Arguments data;
json get(const GetType type, const std::string &revision = ""s);
public:
Document(const std::string &uuid, const std::string &db, const std::string &revision, std::shared_ptr<DataBaseConnection> connection);
Document(const Arguments &arguments);
std::string uuid();
std::string latest_revision();
std::string revision_of_content();
void setRevision(const std::string &revision);
json json_content();
std::string content();
void setContent(json json);
std::vector<std::string> revisions();
bool purge(std::vector<std::string> revisions);
};
}