TrinityCore
Loading...
Searching...
No Matches
TCSoap.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
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 <future>
23#include <string>
24#include <thread>
25
26void process_message(struct soap* soap_message);
27std::thread* CreateSoapThread(const std::string& host, uint16 port);
28
30{
31 public:
33 m_success(false)
34 {
35 }
36
38 {
39 }
40
41 void appendToPrintBuffer(std::string_view msg)
42 {
43 m_printBuffer += msg;
44 }
45
46 void setCommandSuccess(bool val)
47 {
48 m_success = val;
49 finishedPromise.set_value();
50 }
51
53 {
54 return m_success;
55 }
56
57 static void print(void* callbackArg, std::string_view msg)
58 {
59 ((SOAPCommand*)callbackArg)->appendToPrintBuffer(msg);
60 }
61
62 static void commandFinished(void* callbackArg, bool success);
63
65 std::string m_printBuffer;
66 std::promise<void> finishedPromise;
67};
68
69#endif
uint16_t uint16
Definition Define.h:155
std::thread * CreateSoapThread(const std::string &host, uint16 port)
Definition TCSoap.cpp:28
void process_message(struct soap *soap_message)
Definition TCSoap.cpp:72
void appendToPrintBuffer(std::string_view msg)
Definition TCSoap.h:41
static void commandFinished(void *callbackArg, bool success)
Definition TCSoap.cpp:141
bool hasCommandSucceeded() const
Definition TCSoap.h:52
SOAPCommand()
Definition TCSoap.h:32
static void print(void *callbackArg, std::string_view msg)
Definition TCSoap.h:57
std::string m_printBuffer
Definition TCSoap.h:65
bool m_success
Definition TCSoap.h:64
~SOAPCommand()
Definition TCSoap.h:37
void setCommandSuccess(bool val)
Definition TCSoap.h:46
std::promise< void > finishedPromise
Definition TCSoap.h:66