-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReply.cpp
More file actions
53 lines (42 loc) · 1.06 KB
/
Reply.cpp
File metadata and controls
53 lines (42 loc) · 1.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
#include "Reply.h"
Reply::Reply(const MyString& text, size_t id, size_t createrId, size_t postId)
: text(text), commentId(postId), SecondaryDataObject(id, createrId)
{}
const MyString& Reply::getText() const
{
return this->text;
}
size_t Reply::getCommentId() const
{
return this->commentId;
}
void Reply::setText(const MyString& text)
{
this->text = text;
}
void Reply::setCommentId(size_t postId)
{
this->commentId = postId;
}
void Reply::serialize(std::ostream& os) const
{
os << getId() << std::endl
<< getCreaterId() << std::endl
<< getText() << std::endl << std::endl;
}
void Reply::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 >> text;
//std::cout << "Record with id: " << getId() << ' '
// << getCreaterId() << ' ' << getText() << std::endl;
}