TrinityCore
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
25void process_message(struct soap* soap_message);
26void TCSoapThread(const std::string& host, uint16 port);
27
29{
30 public:
32 m_success(false)
33 {
34 }
35
37 {
38 }
39
40 void appendToPrintBuffer(std::string_view msg)
41 {
42 m_printBuffer += msg;
43 }
44
45 void setCommandSuccess(bool val)
46 {
47 m_success = val;
48 finishedPromise.set_value();
49 }
50
52 {
53 return m_success;
54 }
55
56 static void print(void* callbackArg, std::string_view msg)
57 {
58 ((SOAPCommand*)callbackArg)->appendToPrintBuffer(msg);
59 }
60
61 static void commandFinished(void* callbackArg, bool success);
62
64 std::string m_printBuffer;
65 std::promise<void> finishedPromise;
66};
67
68#endif
uint16_t uint16
Definition: Define.h:143
void process_message(struct soap *soap_message)
Definition: TCSoap.cpp:64
void TCSoapThread(const std::string &host, uint16 port)
Definition: TCSoap.cpp:26
void appendToPrintBuffer(std::string_view msg)
Definition: TCSoap.h:40
static void commandFinished(void *callbackArg, bool success)
Definition: TCSoap.cpp:133
bool hasCommandSucceeded() const
Definition: TCSoap.h:51
SOAPCommand()
Definition: TCSoap.h:31
static void print(void *callbackArg, std::string_view msg)
Definition: TCSoap.h:56
std::string m_printBuffer
Definition: TCSoap.h:64
bool m_success
Definition: TCSoap.h:63
~SOAPCommand()
Definition: TCSoap.h:36
void setCommandSuccess(bool val)
Definition: TCSoap.h:45
std::promise< void > finishedPromise
Definition: TCSoap.h:65