-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTopic.cpp
More file actions
56 lines (44 loc) · 1.22 KB
/
Topic.cpp
File metadata and controls
56 lines (44 loc) · 1.22 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
#include "Topic.h"
Topic::Topic(const MyString& title, const MyString& description, size_t createrId, size_t id)
: title(title), description(description), SecondaryDataObject(id, createrId)
{}
const MyString& Topic::getTitle() const
{
return this->title;
}
const MyString& Topic::getDescription() const
{
return this->description;
}
void Topic::setTitle(const MyString& title)
{
this->title = title;
}
void Topic::setDescription(const MyString& description)
{
this->description = description;
}
void Topic::serialize(std::ostream& os) const
{
os << getId() << std::endl
<< getCreaterId() << std::endl
<< getTitle() << std::endl
<< getDescription() << std::endl << std::endl;
}
void Topic::deserialize(std::istream& is)
{
char emptyLine = is.get();
//std::cout << emptyLine;
size_t id;
is >> id;
setId(id);
emptyLine = is.get();
size_t createrId;
is >> createrId;
setCreaterId(createrId);
emptyLine = is.get();
is >> title;
is >> description;
//std::cout << "Record with id: " << getId() << ' '
// << getCreaterId() << ' ' << getTitle() << ' ' << getDescription() << std::endl;
}