aboutsummaryrefslogtreecommitdiff
path: root/src/User.cpp
blob: 16b3648e06fc847e38dd0b252332935f0bc11a18 (plain)
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 "../include/User.hpp"
#include <odhtdb/User.hpp>
#include <cassert>

namespace dchat
{
    const static std::string SYSTEM_USER_NAME = "System";
    
    User::User(Type _type) : 
        type(_type)
    {
        
    }
    
    OnlineUser::OnlineUser(const odhtdb::User *_databaseUser) :
        User(Type::ONLINE),
        name("randomUser69"),
        databaseUser(_databaseUser)
    {
        assert(databaseUser);
    }
    
    const std::string& OnlineUser::getName() const
    {
        return name;
    }
    
    OfflineUser::OfflineUser(const std::string &_name) : 
        User(Type::OFFLINE),
        name(_name)
    {
        
    }
    
    const std::string& OfflineUser::getName() const
    {
        return name;
    }
    
    SystemUser::SystemUser() : 
        User(Type::SYSTEM)
    {
        
    }
    
    const std::string& SystemUser::getName() const
    {
        return SYSTEM_USER_NAME;
    }
}