mastodon-cpp  0.110.0
Public Member Functions | Public Attributes | Friends | List of all members
Mastodon::Easy::return_entity< T > Struct Template Reference

Return types for calls that return a single Easy::Entity. More...

#include <return_types_easy.hpp>

Inheritance diagram for Mastodon::Easy::return_entity< T >:
Mastodon::return_base

Public Member Functions

 return_entity (const uint8_t ec, const string &em, const uint16_t hec, const T &ent)
 Return type for easy Mastodon::Easy::API. More...
 
 return_entity (const error ec, const string &em, const uint16_t hec, const T &ent)
 Return type for easy Mastodon::Easy::API. More...
 
 operator const T () const
 Same as return_entity::entity. More...
 
 operator const string () const
 Mastodon::Easy::Entity as formatted string. More...
 
- Public Member Functions inherited from Mastodon::return_base
 operator bool () const
 true if return_base::error_code is 0, otherwise false. More...
 
 operator uint8_t () const
 Same as return_base::error_code. More...
 

Public Attributes

entity
 Mastodon::Easy::Entity. More...
 
- Public Attributes inherited from Mastodon::return_base
uint8_t error_code = 0
 Error code. More...
 
string error_message
 The error message, or "". More...
 
uint16_t http_error_code = 0
 HTTP error code. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const return_entity< T > &ret)
 Mastodon::Easy::Entity as formatted string. More...
 

Detailed Description

template<typename T>
struct Mastodon::Easy::return_entity< T >

Return types for calls that return a single Easy::Entity.

Since
0.100.0

Constructor & Destructor Documentation

◆ return_entity() [1/2]

template<typename T >
Easy::return_entity::return_entity ( const uint8_t  ec,
const string &  em,
const uint16_t  hec,
const T &  ent 
)

Return type for easy Mastodon::Easy::API.

Parameters
ecError code
emError message
hecHTTP error code
entAnswer
Since
0.100.0
48  : entity(ent)
49 {
50  error_code = ec;
51  error_message = em;
52  http_error_code = hec;
53 }
T entity
Mastodon::Easy::Entity.
Definition: return_types_easy.hpp:47
uint8_t error_code
Error code.
Definition: return_types.hpp:42
uint16_t http_error_code
HTTP error code.
Definition: return_types.hpp:56
string error_message
The error message, or "".
Definition: return_types.hpp:49

◆ return_entity() [2/2]

template<typename T >
Easy::return_entity::return_entity ( const error  ec,
const string &  em,
const uint16_t  hec,
const T &  ent 
)

Return type for easy Mastodon::Easy::API.

Parameters
ecError code
emError message
hecHTTP error code
entAnswer
Since
0.110.0
58  : entity(ent)
59 {
60  error_code = static_cast<uint8_t>(ec);
61  error_message = em;
62  http_error_code = hec;
63 }
T entity
Mastodon::Easy::Entity.
Definition: return_types_easy.hpp:47
uint8_t error_code
Error code.
Definition: return_types.hpp:42
uint16_t http_error_code
HTTP error code.
Definition: return_types.hpp:56
string error_message
The error message, or "".
Definition: return_types.hpp:49

Member Function Documentation

◆ operator const string()

template<typename T>
Mastodon::Easy::return_entity< T >::operator const string ( ) const

Mastodon::Easy::Entity as formatted string.

Since
0.100.0

◆ operator const T()

template<typename T>
Mastodon::Easy::return_entity< T >::operator const T ( ) const

Same as return_entity::entity.

Since
0.100.0

Friends And Related Function Documentation

◆ operator<<

template<typename T>
std::ostream& operator<< ( std::ostream &  out,
const return_entity< T > &  ret 
)
friend

Mastodon::Easy::Entity as formatted string.

Since
0.100.0
98  {
99  // Could only get it to work by implementing it here.
100  out << ret.entity.to_string();
101  return out;
102  }

Member Data Documentation

◆ entity

template<typename T>
T Mastodon::Easy::return_entity< T >::entity

Mastodon::Easy::Entity.

Since
0.100.0

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