AnCH Framework 0.1
Another C++ Hack Framework
Loading...
Searching...
No Matches
anch::rest::Response Class Reference

HTTP response. More...

#include <response.hpp>

Collaboration diagram for anch::rest::Response:

Classes

class  Builder
 HTTP response builder. More...

Public Member Functions

 Response ()
 Response (uint16_t code)
 Response (const Response &res)=delete
 Response (Response &&res)
virtual ~Response ()
Responseoperator= (Response &&other)
uint16_t getStatus () const
void setStatus (uint16_t code)
const anch::rest::HeadersgetHeaders () const
void setHeaders (const anch::rest::Headers &headers)
std::string getContentType () const
void setContentType (const std::string &contentType)
template<typename T>
void setBody (T body)
void writeBody (std::ostream &out) const

Static Public Member Functions

static Builder builder ()

Detailed Description

HTTP response.

HTTP response representation

Author
Vincent Lachenal
Since
0.1

Constructor & Destructor Documentation

◆ Response() [1/4]

anch::rest::Response::Response ( )

Response default constructor

◆ Response() [2/4]

anch::rest::Response::Response ( uint16_t code)

Response constructor

Parameters
codethe HTTP return code

◆ Response() [3/4]

anch::rest::Response::Response ( const Response & res)
delete

Response copy constructor

Parameters
resthe Response to move
Here is the call graph for this function:

◆ Response() [4/4]

anch::rest::Response::Response ( Response && res)

Response move constructor

Parameters
resthe Response to move
Here is the call graph for this function:

◆ ~Response()

virtual anch::rest::Response::~Response ( )
virtual

Response destructor

Member Function Documentation

◆ builder()

Builder anch::rest::Response::builder ( )
static

Instanciate a new response builder for fluent API usage

Returns
the new builder

◆ getContentType()

std::string anch::rest::Response::getContentType ( ) const

Media type getter

Returns
the media type

◆ getHeaders()

const anch::rest::Headers & anch::rest::Response::getHeaders ( ) const

HTTP headers getter

Returns
the headers

◆ getStatus()

uint16_t anch::rest::Response::getStatus ( ) const

HTTP status code getter

Returns
the code

◆ operator=()

Response & anch::rest::Response::operator= ( Response && other)

Move assignement

Parameters
otherthe Response to move
Returns
the new response
Here is the call graph for this function:

◆ setBody()

template<typename T>
void anch::rest::Response::setBody ( T body)

Response body setter

Template Parameters
Tthe object type
Parameters
bodythe body to set

◆ setContentType()

void anch::rest::Response::setContentType ( const std::string & contentType)

Media type getter

Parameters
contentTypethe media type to set

◆ setHeaders()

void anch::rest::Response::setHeaders ( const anch::rest::Headers & headers)

HTTP headers setter.
This method will override every headers previously set.

Returns
the headers

◆ setStatus()

void anch::rest::Response::setStatus ( uint16_t code)

HTTP status code setter

Parameters
codethe status code to set

◆ writeBody()

void anch::rest::Response::writeBody ( std::ostream & out) const

Write body on output stream

Parameters
outthe output stream to write in

The documentation for this class was generated from the following file: