EHS
ehs::Response Class Reference

#include <Response.h>

Public Member Functions

 Response ()
 Default member initialization. More...
 
 Response (const UInt_32 code, const Str_8 &server)
 
 Response (const char *data, const UInt_64 size)
 
 Response (const Str_8 &data)
 
 Response (const Response &res)=default
 
Responseoperator= (const Response &res)
 
void SetCode (const UInt_32 code)
 
UInt_32 GetCode () const
 
void SetServer (const Str_8 &server)
 
Str_8 GetServer () const
 
void SetContentType (const ContentType cType)
 
ContentType GetContentType () const
 
void AddToHeader (const Str_8 &var, const Str_8 &value)
 
Str_8 GetHeader (const Str_8 &var) const
 
Vector< Str_8GetHeader () const
 
void AddToBody (const Str_8 &var, const Str_8 &value)
 
void AddToBody (const Str_8 &data)
 
void SetBody (const Str_8 &body)
 
Str_8 GetVar (const Str_8 &var) const
 
Str_8 GetBody () const
 
Json GetJson () const
 
Str_8 FormResult () const
 
bool IsValid () const
 

Constructor & Destructor Documentation

◆ Response() [1/5]

ehs::Response::Response ( )

Default member initialization.

◆ Response() [2/5]

ehs::Response::Response ( const UInt_32  code,
const Str_8 server 
)

Initializes this response with a given code and server identifier.

Parameters
[in]codeThe code to give.
[in]serverThe server identifier.

◆ Response() [3/5]

ehs::Response::Response ( const char *  data,
const UInt_64  size 
)

Initializes this response with the raw response data.

Parameters
[in]dataThe C-style string of the response.
[in]sizeThe size of the given C-style string.

◆ Response() [4/5]

ehs::Response::Response ( const Str_8 data)

Initializes this response with the raw response data.

Parameters
[in]dataThe string of the response.

◆ Response() [5/5]

ehs::Response::Response ( const Response res)
default

Copies members from another object of the same type.

Parameters
[in]resThe object to copy from.

Member Function Documentation

◆ AddToBody() [1/2]

void ehs::Response::AddToBody ( const Str_8 data)

Adds a value to the body.

Parameters
[in]dataThe value to add.

◆ AddToBody() [2/2]

void ehs::Response::AddToBody ( const Str_8 var,
const Str_8 value 
)

Adds a body variable.

Parameters
[in]varThe variable identifier.
[in]valueThe value of the variable.

◆ AddToHeader()

void ehs::Response::AddToHeader ( const Str_8 var,
const Str_8 value 
)

Adds a header variable.

Parameters
[in]varThe variable identifier.
[in]valueThe value of the variable.

◆ FormResult()

Str_8 ehs::Response::FormResult ( ) const

Forms the raw result of the response to be sent.

Returns
The result.

◆ GetBody()

Str_8 ehs::Response::GetBody ( ) const

Retrieves the entire body.

Returns
The result.

◆ GetCode()

UInt_32 ehs::Response::GetCode ( ) const

Retrieves the response code.

Returns
The result.

◆ GetContentType()

ContentType ehs::Response::GetContentType ( ) const

Retrieves the content type for the body.

Returns
The result.

◆ GetHeader() [1/2]

Vector< Str_8 > ehs::Response::GetHeader ( ) const

Retrieves all the header variables in a vector object.

Returns
The result.

◆ GetHeader() [2/2]

Str_8 ehs::Response::GetHeader ( const Str_8 var) const

Retrieves a header variable.

Parameters
[in]varThe variable identifier to look for.
Returns
The value of the header variable. Empty if it was not found.

◆ GetJson()

Json ehs::Response::GetJson ( ) const

Retrieves the entire body as a Json.

Returns
The result.

◆ GetServer()

Str_8 ehs::Response::GetServer ( ) const

Retrieves the server identifier.

Returns
The result.

◆ GetVar()

Str_8 ehs::Response::GetVar ( const Str_8 var) const

Retrieves a body variable.

Parameters
[in]varThe variable identifier to look for.
Returns
The value of the body variable. Empty if it was not found.

◆ IsValid()

bool ehs::Response::IsValid ( ) const

◆ operator=()

Response & ehs::Response::operator= ( const Response res)

Copies members from another object of the same type.

Parameters
[in]resThe object to copy from.
Returns
The response that has been assigned to.

◆ SetBody()

void ehs::Response::SetBody ( const Str_8 body)

Sets the entire body.

Parameters
[in]bodyThe body to use.

◆ SetCode()

void ehs::Response::SetCode ( const UInt_32  code)

Sets the response code to send to the endpoint.

Parameters
[in]codeThe code for success, error or info.

◆ SetContentType()

void ehs::Response::SetContentType ( const ContentType  cType)

Sets the content type for the body.

Parameters
[in]cTypeThe content type to use.

◆ SetServer()

void ehs::Response::SetServer ( const Str_8 server)

Sets the server identifier.

Parameters
[in]serverThe server identifier to use.

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