TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TCSoap.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef _TCSOAP_H
19 #define _TCSOAP_H
20 
21 #include "Define.h"
22 #include <mutex>
23 #include <future>
24 #include <string>
25 
26 void process_message(struct soap* soap_message);
27 void TCSoapThread(const std::string& host, uint16 port);
28 
30 {
31  public:
34  {
35  }
36 
38  {
39  }
40 
41  void appendToPrintBuffer(const char* msg)
42  {
43  m_printBuffer += msg;
44  }
45 
46  void setCommandSuccess(bool val)
47  {
48  m_success = val;
49  finishedPromise.set_value();
50  }
51 
52  bool hasCommandSucceeded() const
53  {
54  return m_success;
55  }
56 
57  static void print(void* callbackArg, const char* msg)
58  {
59  ((SOAPCommand*)callbackArg)->appendToPrintBuffer(msg);
60  }
61 
62  static void commandFinished(void* callbackArg, bool success);
63 
64  bool m_success;
65  std::string m_printBuffer;
66  std::promise<void> finishedPromise;
67 };
68 
69 #endif
Definition: stdsoap2.h:1933
static void print(void *callbackArg, const char *msg)
Definition: TCSoap.h:57
#define false
Definition: CascPort.h:18
void process_message(struct soap *soap_message)
Definition: TCSoap.cpp:57
bool hasCommandSucceeded() const
Definition: TCSoap.h:52
void setCommandSuccess(bool val)
Definition: TCSoap.h:46
static void commandFinished(void *callbackArg, bool success)
Definition: TCSoap.cpp:127
uint16_t uint16
Definition: Define.h:151
SOAPCommand()
Definition: TCSoap.h:32
bool m_success
Definition: TCSoap.h:64
void appendToPrintBuffer(const char *msg)
Definition: TCSoap.h:41
Definition: TCSoap.h:29
void TCSoapThread(const std::string &host, uint16 port)
Definition: TCSoap.cpp:25
std::string m_printBuffer
Definition: TCSoap.h:65
std::promise< void > finishedPromise
Definition: TCSoap.h:66
~SOAPCommand()
Definition: TCSoap.h:37