-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbook.hpp
More file actions
103 lines (84 loc) · 2.06 KB
/
Copy pathbook.hpp
File metadata and controls
103 lines (84 loc) · 2.06 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#ifndef __BOOK_H__
#define __BOOK_H__
#include <map>
#include <set>
#include <string>
#include "utils.hpp"
#include "data.hpp"
class Author;
class Tag;
class Publisher;
class Serie;
class Format;
class Book : public Data {
friend struct Factory;
public:
virtual ~Book() {}
int index() const {
return _index;
}
std::string summary() const {
return _summary;
}
int rating() const {
return _rating;
}
std::string path() const {
return _path;
}
std::set<Data*> const& authors() const {
return _authors;
}
std::set<Data*> const& tags() const {
return _tags;
}
std::set<Data*> const& publishers() const {
return _publishers;
}
std::set<Data*> const& series() const {
return _series;
}
std::set<Data*> const& formats() const {
return _formats;
}
virtual std::string type() const override {
return "book";
}
void addAuthor(Author* author);
void addTag(Tag* tag);
void addPublisher(Publisher* pub);
void addSerie(Serie* serie);
void addFormat(Format* format);
static Book* create(
int id,
std::string const& name,
std::string const& sort,
int index,
std::string const& summary = std::string(),
int rating = -1,
std::string const& path = std::string()
);
virtual std::string renderLink() const override;
virtual std::string renderItem(std::string const &dir) const override;
virtual std::string render() const override;
protected:
Book(
int id,
std::string const& name,
std::string const& sort,
int index,
std::string const& summary,
int rating,
std::string const& path
);
int _index;
std::string _summary;
int _rating;
std::string _path;
std::set<Data*> _authors;
std::set<Data*> _tags;
std::set<Data*> _publishers;
std::set<Data*> _series;
std::set<Data*> _formats;
};
#endif