-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetadata.cpp
More file actions
53 lines (45 loc) · 1002 Bytes
/
Copy pathmetadata.cpp
File metadata and controls
53 lines (45 loc) · 1002 Bytes
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
#include "metadata.hpp"
#include <fstream>
#include <iostream>
#include "book.hpp"
#include "utils.hpp"
#include "config.hpp"
#include "renderer.hpp"
Metadata::Metadata(int id, const std::string& name, std::string const& sort):
Data(id, name, sort)
{
}
Metadata::Metadata(int id, const std::string& name):
Data(id, name)
{
}
void Metadata::addBook(Book* book)
{
_books.insert(book);
}
std::string Metadata::renderLink() const
{
return Renderer::instance().renderLink(
_name,
"../../" + type() + "/" + std::to_string(_id)
);
}
std::string Metadata::renderItem(std::string const &dir) const
{
return Renderer::instance().renderItem(
(!_sort.empty()) ? _sort : "Unknown",
std::to_string(_id),
dir + url(),
dir + type() + "/icon.png",
_books.size()
);
}
std::string Metadata::render() const
{
return Renderer::instance().renderSection(
_books,
type(),
_name,
"../"
);
}