xbmc
WsgiResponse.h
1 /*
2  * Copyright (C) 2015-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "interfaces/legacy/AddonClass.h"
12 #include "interfaces/legacy/Tuple.h"
13 #include "interfaces/legacy/wsgi/WsgiResponseBody.h"
14 #include "network/httprequesthandler/python/HTTPPythonRequest.h"
15 
16 #include <vector>
17 
18 namespace XBMCAddon
19 {
20  namespace xbmcwsgi
21  {
22  typedef Tuple<String, String> WsgiHttpHeader;
23 
33  class WsgiResponse : public AddonClass
34  {
35  public:
36  WsgiResponse();
37  ~WsgiResponse() override;
38 
39 #ifdef DOXYGEN_SHOULD_USE_THIS
40  operator(...);
59 #else
60  WsgiResponseBody* operator()(const String& status, const std::vector<WsgiHttpHeader>& response_headers, void* exc_info = NULL);
61 #endif
62 
63 #ifndef SWIG
64  void Append(const std::string& data);
65 
66  bool Finalize(HTTPPythonRequest* request) const;
67 
68  private:
69  bool m_called = false;
70  int m_status = MHD_HTTP_INTERNAL_SERVER_ERROR;
71  std::multimap<std::string, std::string> m_responseHeaders;
72 
73  WsgiResponseBody m_body;
74 #endif
75  };
76  }
77 }
Definition: WsgiResponse.h:33
Definition: HTTPPythonRequest.h:18
Definition: WsgiResponseBody.h:26
Defining LOG_LIFECYCLE_EVENTS will log all instantiations, deletions and also reference countings (in...
Definition: Addon.cpp:25
This class is the superclass for all reference counted classes in the api.
Definition: AddonClass.h:57