ANNA Suite  2020b
Multipurpose development suite for Telco applications
Response.hpp
Go to the documentation of this file.
1 // ANNA - Anna is Not Nothingness Anymore //
2 // //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
4 // //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7 
8 
9 #ifndef anna_http_Response_hpp
10 #define anna_http_Response_hpp
11 
12 #include <anna/http/Message.hpp>
13 
14 namespace anna {
15 
16 namespace http {
17 
21 class Response : public Message {
22 public:
26  explicit Response() :
27  Message(Message::Type::Response) { a_statusCode = 0; setStatusCode(200); }
28 
33  int getStatusCode() const { return a_statusCode; }
34 
39  const std::string& getReasonPhrase() const { return a_reasonPhrase; }
40 
89  void setStatusCode(const int statusCode) ;
90 
95  void setReasonPhrase(const std::string& reasonPhrase) { a_reasonPhrase = reasonPhrase; }
96 
101  void setReasonPhrase(const char* reasonPhrase) { a_reasonPhrase = reasonPhrase; }
102 
107  std::string asString() const ;
108 
109 private:
110  int a_statusCode;
111  std::string a_reasonPhrase;
112 
113  std::string codeStartLine() const noexcept(false);
114 };
115 
116 }
117 }
118 
119 #endif
120 
void setReasonPhrase(const std::string &reasonPhrase)
Definition: Response.hpp:95
Definition: Message.hpp:30
void setStatusCode(const int statusCode)
Definition: Message.hpp:45
const std::string & getReasonPhrase() const
Definition: Response.hpp:39
int getStatusCode() const
Definition: Response.hpp:33
std::string asString() const
void setReasonPhrase(const char *reasonPhrase)
Definition: Response.hpp:101
Definition: app.hpp:12
Definition: Response.hpp:21
Response()
Definition: Response.hpp:26