Added move/copy constructors to Http & HttpResponse
This commit is contained in:
parent
96567f4338
commit
aa8509e460
@ -79,6 +79,8 @@ namespace fr
|
|||||||
};
|
};
|
||||||
|
|
||||||
Http();
|
Http();
|
||||||
|
Http(Http &&);
|
||||||
|
Http(const Http &);
|
||||||
virtual ~Http() = default;
|
virtual ~Http() = default;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -280,6 +282,11 @@ namespace fr
|
|||||||
*/
|
*/
|
||||||
std::vector<std::pair<std::string, std::string>> parse_argument_list(const std::string &str);
|
std::vector<std::pair<std::string, std::string>> parse_argument_list(const std::string &str);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Parses a header line in a HTTP request/response
|
||||||
|
*
|
||||||
|
* @param str The header. E.g: header: value
|
||||||
|
*/
|
||||||
void parse_header_line(const std::string &str);
|
void parse_header_line(const std::string &str);
|
||||||
|
|
||||||
//Other request info
|
//Other request info
|
||||||
|
|||||||
@ -16,9 +16,10 @@ namespace fr
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//Constructors
|
//Constructors
|
||||||
HttpResponse() = default;
|
HttpResponse(){};
|
||||||
HttpResponse(HttpResponse &&other) = default;
|
HttpResponse(HttpResponse &&other);
|
||||||
virtual ~HttpResponse() = default;
|
HttpResponse(const HttpResponse &);
|
||||||
|
virtual ~HttpResponse(){}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Parse a HTTP response.
|
* Parse a HTTP response.
|
||||||
|
|||||||
23
src/Http.cpp
23
src/Http.cpp
@ -19,6 +19,29 @@ namespace fr
|
|||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Http::Http(Http &&o)
|
||||||
|
: header_data(std::move(o.header_data)),
|
||||||
|
post_data(std::move(o.post_data)),
|
||||||
|
get_data(std::move(o.get_data)),
|
||||||
|
body(std::move(o.body)),
|
||||||
|
request_type(o.request_type),
|
||||||
|
uri(std::move(o.uri)),
|
||||||
|
status(o.status)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Http::Http(const Http &o)
|
||||||
|
: header_data(o.header_data),
|
||||||
|
post_data(o.post_data),
|
||||||
|
get_data(o.get_data),
|
||||||
|
body(o.body),
|
||||||
|
request_type(o.request_type),
|
||||||
|
uri(o.uri),
|
||||||
|
status(o.status)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Http::RequestType Http::get_type() const
|
Http::RequestType Http::get_type() const
|
||||||
{
|
{
|
||||||
return request_type;
|
return request_type;
|
||||||
|
|||||||
@ -7,6 +7,20 @@
|
|||||||
|
|
||||||
namespace fr
|
namespace fr
|
||||||
{
|
{
|
||||||
|
HttpResponse::HttpResponse(HttpResponse &&other)
|
||||||
|
: header_ended(other.header_ended),
|
||||||
|
content_length(other.content_length)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse::HttpResponse(const HttpResponse &other)
|
||||||
|
: header_ended(other.header_ended),
|
||||||
|
content_length(other.content_length)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
bool HttpResponse::parse(const std::string &response_data)
|
bool HttpResponse::parse(const std::string &response_data)
|
||||||
{
|
{
|
||||||
body += response_data;
|
body += response_data;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user