-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.cpp
41 lines (34 loc) · 2.42 KB
/
client.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
#include "classes.hpp"
#include <ctime>
Client::Client() {}
const char *colors[] = {
"\033[38;5;1m", "\033[38;5;2m", "\033[38;5;3m", "\033[38;5;4m", "\033[38;5;5m", "\033[38;5;6m",
"\033[38;5;7m", "\033[38;5;8m", "\033[38;5;9m", "\033[38;5;10m", "\033[38;5;11m", "\033[38;5;12m",
"\033[38;5;13m", "\033[38;5;14m", "\033[38;5;15m", "\033[38;5;17m", "\033[38;5;18m", "\033[38;5;19m",
"\033[38;5;20m", "\033[38;5;21m", "\033[38;5;22m", "\033[38;5;23m", "\033[38;5;24m", "\033[38;5;25m",
"\033[38;5;26m", "\033[38;5;27m", "\033[38;5;28m", "\033[38;5;29m", "\033[38;5;30m", "\033[38;5;31m",
"\033[38;5;32m", "\033[38;5;33m", "\033[38;5;34m", "\033[38;5;35m", "\033[38;5;36m", "\033[38;5;37m",
"\033[38;5;38m", "\033[38;5;39m", "\033[38;5;40m", "\033[38;5;41m", "\033[38;5;42m", "\033[38;5;43m",
"\033[38;5;44m", "\033[38;5;45m", "\033[38;5;46m", "\033[38;5;47m", "\033[38;5;48m", "\033[38;5;49m",
"\033[38;5;50m", "\033[38;5;51m", "\033[38;5;57m", "\033[38;5;58m", "\033[38;5;59m", "\033[38;5;60m",
"\033[38;5;61m", "\033[38;5;62m", "\033[38;5;63m", "\033[38;5;64m", "\033[38;5;65m", "\033[38;5;67m",
"\033[38;5;68m", "\033[38;5;69m", "\033[38;5;70m", "\033[38;5;71m", "\033[38;5;72m", "\033[38;5;73m",
"\033[38;5;74m", "\033[38;5;75m", "\033[38;5;76m", "\033[38;5;77m", "\033[38;5;78m", "\033[38;5;79m",
"\033[38;5;80m", "\033[38;5;81m", "\033[38;5;82m", "\033[38;5;83m", "\033[38;5;84m", "\033[38;5;85m",
"\033[38;5;86m", "\033[38;5;87m", "\033[38;5;93m", "\033[38;5;98m", "\033[38;5;99m", "\033[38;5;100m",
"\033[38;5;104m", "\033[38;5;105m", "\033[38;5;106m", "\033[38;5;107m", "\033[38;5;108m", "\033[38;5;109m",
"\033[38;5;110m", "\033[38;5;111m", "\033[38;5;112m", "\033[38;5;113m", "\033[38;5;114m", "\033[38;5;115m",
"\033[38;5;116m", "\033[38;5;117m", "\033[38;5;118m", "\033[38;5;119m", "\033[38;5;120m", "\033[38;5;121m",
"\033[38;5;122m", "\033[38;5;123m",
};
std::vector<std::string> Client::_colorsList(colors, colors + sizeof(colors) / sizeof(colors[0]));
Client::Client(int socket) : _socket(socket), _status(IN_MENU), _color("\033[0m") {
srand(time(NULL));
int colorIndex = rand() % _colorsList.size();
_color = _colorsList[colorIndex];
}
Client::~Client() {}
void Client::setName(std::string name) { _name = name; }
const std::string &Client::getName() const { return _name; }
void Client::setStatus(int status) { _status = status; }
const int &Client::getStatus() const { return _status; }