EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
LanguageService.cpp
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Zhur
24 */
25 
26 #include "eve-server.h"
27 
28 #include "PyServiceCD.h"
29 #include "config/LanguageService.h"
30 
31 /*
32 class LanguageBound
33 : public PyBoundObject {
34 public:
35 
36  PyCallable_Make_Dispatcher(LanguageBound)
37 
38  LanguageBound(PyServiceMgr *mgr, LanguageDB *db)
39  : PyBoundObject(mgr, "LanguageBound"),
40  m_db(db),
41  m_dispatch(new Dispatcher(this))
42  {
43  _SetCallDispatcher(m_dispatch);
44 
45  PyCallable_REG_CALL(LanguageBound, )
46  PyCallable_REG_CALL(LanguageBound, )
47  }
48  virtual ~LanguageBound() { delete m_dispatch; }
49  virtual void Release() {
50  //I hate this statement
51  delete this;
52  }
53 
54  PyCallable_DECL_CALL()
55  PyCallable_DECL_CALL()
56 
57 protected:
58  LanguageDB *const m_db;
59  Dispatcher *const m_dispatch; //we own this
60 };
61 */
62 
64 
66 : PyService(mgr, "languageSvc"),
67  m_dispatch(new Dispatcher(this))
68 {
69  _SetCallDispatcher(m_dispatch);
70 
71  PyCallable_REG_CALL(LanguageService, GetLanguages);
72  PyCallable_REG_CALL(LanguageService, GetTextsForGroup);
73 }
74 
76  delete m_dispatch;
77 }
78 
79 
80 /*
81 PyBoundObject *LanguageService::CreateBoundObject(Client *pClient, PyTuple *bind_args) {
82  _log(CLIENT__MESSAGE, "LanguageService bind request for:");
83  bind_args->Dump(CLIENT__MESSAGE, " ");
84 
85  return(new LanguageBound(m_manager, &m_db));
86 }*/
87 
88 
89 PyResult LanguageService::Handle_GetLanguages(PyCallArgs &call) {
90  PyRep *result = NULL;
91 
92  result = m_db.ListLanguages();
93 
94  return result;
95 }
96 PyResult LanguageService::Handle_GetTextsForGroup(PyCallArgs &call) {
97  Call_GetTextsForGroup args;
98 
99  if (!args.Decode(&call.tuple)) {
100  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
101  return nullptr;
102  }
103 
104  return m_db.GetTextsForGroup(args.languageID, args.textgroup);
105 }
106 
Base Python wire object.
Definition: PyRep.h:66
Dispatcher *const m_dispatch
PyCallable_Make_InnerDispatcher(LanguageService) LanguageService
PyRep * GetTextsForGroup(const std::string &langID, uint32 textgroup)
Definition: ConfigDB.cpp:500
virtual ~LanguageService()
const char * GetName() const
Definition: PyService.h:54
* args
PyObject * ListLanguages()
Definition: ConfigDB.cpp:370
#define codelog(type, fmt,...)
Definition: logsys.h:128
#define PyCallable_REG_CALL(c, m)
Definition: PyServiceCD.h:78
Dispatcher *const m_dispatch
PyTuple * tuple
Definition: PyCallable.h:50