-
Notifications
You must be signed in to change notification settings - Fork 0
/
Title.cpp
50 lines (40 loc) · 818 Bytes
/
Title.cpp
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
#include "Title.h"
Title::Title()
{
str = "";
}
Title::Title(const std::string& Str)
{
str = Str;
}
Title& Title::operator=(const std::string& Str)
{
str = Str;
return *this;
}
bool Title::read_quoted_from(std::istream &is)
{
return read_quoted(is, str);
}
//outputs title (quoted if it contains spaces)
std::ostream& operator<<(std::ostream &os, const Title &tit)
{
os << c_light_blue << quote(tit.str) << c_white;
return os;
}
//reads a (possibly quoted) title from input stream
std::istream& operator>>(std::istream &is, Title &tit)
{
read_quoted(is, tit.str);
return is;
}
//equality relation
bool operator==(const Title &tit1, const Title &tit2)
{
return (tit1.str == tit2.str);
}
//inequality relation
bool operator!=(const Title &tit1, const Title &tit2)
{
return (tit1.str != tit2.str);
}