-
Notifications
You must be signed in to change notification settings - Fork 14
/
Message.h
69 lines (50 loc) · 1.2 KB
/
Message.h
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
#ifndef MESSAGE_H
#define MESSAGE_H
#include<string>
#include<set>
#include<iostream>
class Folder;
class Message
{
friend class Folder;
friend void swap(Message &lhs, Message &rhs);
public:
explicit Message(const std::string &str = "") : contents(str) { }
Message(const Message &);
Message & operator=(const Message &);
~Message();
Message(Message &&m);
Message & operator=(Message && rhs);
void save(Folder &);
void remove(Folder &);
std::ostream & print(std::ostream & os) const;
private:
void addFolder(Folder *);
void remFolder(Folder *);
std::string contents;
std::set<Folder *> folders;
void add_to_Folders(const Message &);
void remove_from_Folders();
void move_Folders(Message * m);
};
class Folder
{
friend class Message;
friend void swap(Message &lhs, Message &rhs);
public:
Folder() = default;
Folder(const Folder &);
Folder & operator=(const Folder &f);
~Folder();
Folder(Folder &&f);
Folder & operator=(Folder && rhs);
void show(std::ostream & os);
private:
void addMsg(Message *m);
void remMsg(Message *m);
void move_Messages(Folder * f);
void add_to_Messages(const Folder &);
void remove_from_Messages();
std::set<Message *> messages;
};
#endif