SuperTuxKart
Loading...
Searching...
No Matches
xml_request.hpp
1// SuperTuxKart - a fun racing game with go-kart
2// Copyright (C) 2011-2015 Joerg Henrichs
3// 2013 Glenn De Jonghe
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 3
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19#ifndef HEADER_XML_REQUEST_HPP
20#define HEADER_XML_REQUEST_HPP
21
22#include "online/http_request.hpp"
23#include "utils/cpp2011.hpp"
24#include "utils/synchronised.hpp"
25
26#ifdef WIN32
27# include <winsock2.h>
28#endif
29#include <curl/curl.h>
30#include <assert.h>
31#include <string>
32
33class XMLNode;
34
35namespace Online
36{
39 class XMLRequest : public HTTPRequest
40 {
41 private:
44
45 protected:
46
49 irr::core::stringw m_info;
50
53
54 virtual void afterOperation() OVERRIDE;
55
56 public :
57 XMLRequest(int priority = 1);
58 virtual ~XMLRequest();
59
60 // ------------------------------------------------------------------------
65 const XMLNode * getXMLData() const
66 {
67 assert(hasBeenExecuted());
68 return m_xml_data;
69 } // getXMLData
70
71 // ------------------------------------------------------------------------
77 const irr::core::stringw & getInfo() const
78 {
79 assert(hasBeenExecuted());
80 return m_info;
81 } // getInfo
82
83 // --------------------------------------------------------------------
87 bool isSuccess() const
88 {
89 assert(hasBeenExecuted());
90 return m_success;
91 } // isSuccess
92 }; // class XMLRequest
93} //namespace Online
94#endif // HEADER_XML_REQUEST_HPP
A http request.
Definition: http_request.hpp:56
bool hasBeenExecuted() const
Checks if the request has completed or done (i.e.
Definition: request.hpp:201
A http request expecting a xml return value.
Definition: xml_request.hpp:40
XMLNode * m_xml_data
On a successful download contains the converted XML tree.
Definition: xml_request.hpp:43
bool isSuccess() const
Returns whether the request was successfully executed on the server.
Definition: xml_request.hpp:87
const irr::core::stringw & getInfo() const
Returns the additional information (or error message) contained in a finished request.
Definition: xml_request.hpp:77
irr::core::stringw m_info
Additional info contained the downloaded data (or an error message if a problem occurred).
Definition: xml_request.hpp:49
virtual void afterOperation() OVERRIDE
On a successful download converts the string into an XML tree.
Definition: xml_request.cpp:58
const XMLNode * getXMLData() const
Get the downloaded XML tree.
Definition: xml_request.hpp:65
bool m_success
True if the request was successful executed on the server.
Definition: xml_request.hpp:52
utility class used to parse XML files
Definition: xml_node.hpp:48