SEGS  0.4.2
Super Entity Game Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GameServer.hpp
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2018 SEGS Team (see Authors.txt)
5  * This software is licensed! (See License.txt for details)
6  */
7 
8 #ifndef MPRPC_GameServer_48179120_HPP__
9 #define MPRPC_GameServer_48179120_HPP__
10 
11 #include "types.hpp"
12 
13 namespace StickWorld {
14 
15 namespace GameServer {
16 
17 
18 struct login {
19 
21  {
22  }
23 
24  std::string login;
25  std::string passw;
26 
27  template <typename Packer>
28  void msgpack_pack(Packer& _Pk) const {
29  _Pk.pack_array(2);
30  _Pk.pack(login);
31  _Pk.pack(passw);
32  }
33 
34  void msgpack_unpack(msgpack::object _Obj) {
35  if(_Obj.type != msgpack::type::ARRAY) {
36  throw msgpack::type_error();
37  }
38  const size_t _Length = _Obj.via.array.size;
39  msgpack::object* const _Array = _Obj.via.array.ptr;
40 
41  if(_Length < 0) {
42  throw msgpack::type_error();
43  }
44 
45 
46  if(_Length <= 0) { return; }
47  if(!_Array[0].is_nil()) {
48  _Array[0].convert(&login);
49  }
50 
51 
52  if(_Length <= 1) { return; }
53  if(!_Array[1].is_nil()) {
54  _Array[1].convert(&passw);
55  }
56 
57  }
58 };
59 
60 
61 } // namespace GameServer
62 
63 } // namespace StickWorld
64 #endif
std::string passw
Definition: GameServer.hpp:25
login()
Definition: GameServer.hpp:20
void msgpack_pack(Packer &_Pk) const
Definition: GameServer.hpp:28
std::string login
Definition: GameServer.hpp:24
Definition: GameServer.hpp:18
void msgpack_unpack(msgpack::object _Obj)
Definition: GameServer.hpp:34
Definition: GameServer.h:18