Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
Revisions.hpp
Go to the documentation of this file.
1#ifndef IV_SRC_MODEL_REVISIONS_HPP_
2#define IV_SRC_MODEL_REVISIONS_HPP_
3
4#include "core/Timestamp.hpp"
5#include "core/system.hpp"
7
8#include <string>
9#include <utility>
10
11namespace iv::model
12{
13
15{
16public:
18 Revisions(const Revisions &other);
19 Revisions(Revisions &&other) noexcept;
21
22 Revisions &operator=(const Revisions &other);
23 Revisions &operator=(Revisions &&other) noexcept;
24
25 void load(const iv::file::xml::node &node);
26 void save(iv::file::xml::node &node) const;
27
28 void addRevision(std::string_view version, std::string_view commentary);
29
30 [[nodiscard]] std::string getLastVersion() const;
31
32 [[nodiscard]] bool isEmpty() const;
33
34private:
35 struct Revision
36 {
38 Revision(std::string_view version, iv::time::Timestamp timestamp, std::string_view author,
39 std::string_view commentary);
40 Revision(const Revision &other);
41 Revision(Revision &&other) noexcept;
42 ~Revision() = default;
43
44 Revision &operator=(const Revision &other);
45 Revision &operator=(Revision &&other) noexcept;
46
47 std::string _version;
49 std::string _author;
50 std::string _commentary;
51 };
52
53 struct Sections
54 {
55 static constexpr std::string_view revisions {"Revisions"};
56 static constexpr std::string_view revision {"Revision"};
57 };
58
59 struct Keys
60 {
61 static constexpr std::string_view version {"Version"};
62 static constexpr std::string_view date {"Date"};
63 static constexpr std::string_view author {"Author"};
64 static constexpr std::string_view commentary {"Commentary"};
65 };
66
68 {
69 static constexpr std::string string {};
70 static constexpr std::string version {"1.0.0"};
71 static constexpr iv::types::timestamp timestamp {0};
72 };
73
74public:
75 std::vector<iv::model::Revisions::Revision> m_revisions;
76};
77
78}// namespace iv::model
79
80#endif//IV_SRC_MODEL_REVISIONS_HPP_
Definition xmlFile.hpp:15
Definition Timestamp.hpp:17
Definition DiamarModel.cpp:14
uint64_t timestamp
Definition types.hpp:21
Definition Revisions.hpp:68
static constexpr std::string version
Definition Revisions.hpp:70
static constexpr iv::types::timestamp timestamp
Definition Revisions.hpp:71
Definition Revisions.hpp:60
static constexpr std::string_view date
Definition Revisions.hpp:62
static constexpr std::string_view version
Definition Revisions.hpp:61
static constexpr std::string_view commentary
Definition Revisions.hpp:64
static constexpr std::string_view author
Definition Revisions.hpp:63
Definition Revisions.hpp:36
Revision(const Revision &other)
iv::time::Timestamp _timestamp
Definition Revisions.hpp:48
std::string _version
Definition Revisions.hpp:47
Revision & operator=(const Revision &other)
Definition Revisions.cpp:113
std::string _commentary
Definition Revisions.hpp:50
std::string _author
Definition Revisions.hpp:49
Definition Revisions.hpp:54
static constexpr std::string_view revisions
Definition Revisions.hpp:55
static constexpr std::string_view revision
Definition Revisions.hpp:56
Definition Revisions.hpp:15
void save(iv::file::xml::node &node) const
Definition Revisions.cpp:58
bool isEmpty() const
Definition Revisions.cpp:92
void addRevision(std::string_view version, std::string_view commentary)
Definition Revisions.cpp:74
std::string getLastVersion() const
Definition Revisions.cpp:87
Revisions & operator=(const Revisions &other)
Definition Revisions.cpp:21
std::vector< iv::model::Revisions::Revision > m_revisions
Definition Revisions.hpp:75
void load(const iv::file::xml::node &node)
Definition Revisions.cpp:41