-
Notifications
You must be signed in to change notification settings - Fork 1
/
data.h
63 lines (44 loc) · 1.16 KB
/
data.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
/*
* Author: David Strauß, Mathias Paumgarten
*/
#ifndef DATA_H
#define DATA_H
#include <string>
#include <list>
#include <set>
#include <iostream>
using namespace std;
struct client {
string name;
int descriptor;
set<string> following;
set<string> followed;
bool online;
};
struct tweetInfo {
string name;
string message;
};
class Data {
public:
Data();
~Data();
void addClient(string name, int descriptor);
void removeClient(int descriptor);
void addFollower(string clientName, string personToFollow);
void removeFollower(string clientName, string followedPerson);
set<string> getFollowers(string clientName);
bool isClient(string name);
bool isOnline(string name);
void setClientOnline(string name, bool value);
void setClientDescriptor(string clientName, int descriptor);
int getDescriptorByName(string name);
string getNameByDescriptor(int descriptor);
void addTweet(string name, string tweet);
list<string>* getTweetsByPublisher(string name);
list<string>* getTweetsForClient(string name);
private:
list<client> *users;
list<tweetInfo> *tweets;
};
#endif