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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#include "Issue.hpp"
#include "types/IdentifierRegistry.hpp"
using namespace OpenVic;
IssueType::IssueType(const std::string_view new_identifier) : HasIdentifier { new_identifier } {}
IssueGroup::IssueGroup(const std::string_view new_identifier, IssueType const& new_type, bool ordered)
: HasIdentifier { new_identifier }, type { new_type }, ordered { ordered } {}
IssueType const& IssueGroup::get_type() const {
return type;
}
bool IssueGroup::is_ordered() const {
return ordered;
}
Issue::Issue(const std::string_view new_identifier, IssueGroup const& new_group, size_t ordinal)
: HasIdentifier { new_identifier }, group { new_group }, ordinal { ordinal } {}
IssueType const& Issue::get_type() const {
return group.get_type();
}
IssueGroup const& Issue::get_group() const {
return group;
}
size_t Issue::get_ordinal() const {
return ordinal;
}
IssueManager::IssueManager() : issue_types { "issue types" }, issue_groups { "issue groups" }, issues { "issues" } {}
bool IssueManager::add_issue_type(const std::string_view identifier) {
if (identifier.empty()) {
Logger::error("Invalid issue type identifier - empty!");
return false;
}
return issue_types.add_item({ identifier });
}
bool IssueManager::add_issue_group(const std::string_view identifier, IssueType const* type, bool ordered) {
if (identifier.empty()) {
Logger::error("Invalid issue group identifier - empty!");
return false;
}
if (type == nullptr) {
Logger::error("Null issue type for ", identifier);
return false;
}
return issue_groups.add_item({ identifier, *type, ordered });
}
bool IssueManager::add_issue(const std::string_view identifier, IssueGroup const* group, size_t ordinal) {
if (identifier.empty()) {
Logger::error("Invalid issue identifier - empty!");
return false;
}
if (group == nullptr) {
Logger::error("Null issue group for ", identifier);
return false;
}
return issues.add_item({ identifier, *group, ordinal });
}
|