forked from Miaoshuai/netlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
message.h
44 lines (37 loc) · 1 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
/*======================================================
> File Name: message.h
> Author: MiaoShuai
> E-mail:
> Other :
> Created Time: 2016年02月15日 星期一 20时15分22秒
=======================================================*/
/*各种消息处理函数*/
#pragma once
#include <memory>
#include "connection.h"
#include "message.pb.h"
#include "codec.h"
#include "mysql.h"
#include <list>
#include <string>
class User
{
public:
std::string userName;
int fd;
};
class MessageType
{
public:
typedef std::shared_ptr<Login> LoginPtr;
typedef std::shared_ptr<Register> RegisterPtr;
MessageType(ProtobufCodec codec)
:codec_(codec)
{}
void onLogin(netlib::connectionPtr conn,LoginPtr message);
void onRegister(netlib::connectionPtr conn,RegisterPtr message);
private:
Sql sql_; //数据库
std::list<std::shared_ptr<User>> userList_;
ProtobufCodec codec_;
};