TurtleBrains  0.3.5
High quality, portable, C++ framework for rapid 2D game development.
tb_http_response.hpp
1 
9 #ifndef TurtleBrains_HTTPResponse_hpp
10 #define TurtleBrains_HTTPResponse_hpp
11 
12 #include <turtle_brains/core/tb_configuration.hpp>
13 #if defined(tb_with_networking)
14 
15 #include <turtle_brains/core/tb_types.hpp>
16 
17 #include <vector>
18 
19 namespace TurtleBrains
20 {
21  namespace Network
22  {
23  namespace HTTP {
24  class Request;
25 
26  class Response
27  {
28  public:
29  explicit Response(const tbCore::int32 code = 0, const std::vector<char>& data = std::vector<char>(),
30  const std::vector<tbCore::tbString>& headerLines = std::vector<tbCore::tbString>());
31  Response(const Response& other);
32  ~Response(void);
33 
34  bool IsValid(void) const;
35  operator bool() const { return IsValid(); }
36 
37  tbCore::int32 GetResponseCode(void) const;
38  const tbCore::tbString& GetResponseBody(void) const;
39  const std::vector<char>& GetResponseData(void) const;
40 
45  bool HasHeader(const tbCore::tbString& header) const;
46 
53  const tbCore::tbString& GetHeader(const size_t headerIndex) const;
54 
58  size_t GetNumberOfHeaders(void) const;
59 
63  const std::vector<tbCore::tbString>& GetHeaders(void) const;
64 
65  Response& operator=(const Response& other);
66 
67  private:
68  friend class TurtleBrains::Network::HTTP::Request;
69 
70  std::vector<char> mRawResponseData;
71  std::vector<tbCore::tbString> mHeaderLines;
72  tbCore::tbString mResponseBody;
73  tbCore::int32 mResponseCode;
74  };
75 
76  }; /* namespace HTTP */
77  }; /* namespace Network */
78 }; /* namespace TurtleBrains */
79 
80 namespace tbNetwork = TurtleBrains::Network;
81 
82 #endif /* tb_with_networking */
83 #endif /* TurtleBrains_HTTPResponse_hpp */
Here is some information about the primary namespace.
Definition: tb_application_dialog.hpp:21
int32_t int32
Signed integer with a size of 32 bits. Supports values from -2147483648 to 2147483647.
Definition: tb_types.hpp:27
std::string tbString
Definition: tb_string.hpp:335