WoW Addon Manager Client  0.0.1-alpha
A p2p World of Warcraft addon manager
response.h
Go to the documentation of this file.
1 //
2 // Created by jordan on 3/12/20.
3 //
4 
5 #ifndef WAM_RESPONSE_H
6 #define WAM_RESPONSE_H
7 
8 #include <string>
9 #include <boost/optional.hpp>
10 
11 template <class T>
12 class Response {
13 public:
14  ~Response() = default;
15  Response() = delete;
16 
17  Response(const std::string &p_message, const int &p_error_code, const boost::optional<T> &p_data) {
18  this->m_message = p_message;
19  this->m_error_code = p_error_code;
20  this->m_data = p_data;
21 
22  }
23 
24  boost::optional<T> get_data(){
25  if(this->m_data != boost::none)
26  return boost::optional<T>{this->m_data};
27  else
28  return boost::none;
29 
30  }
31 
32  std::string get_message() {
33  return this->m_message;
34  }
36  return this->m_error_code;
37  }
38 
39 
40 
41 
42 private:
43  std::string m_message = "";
44  int m_error_code = 0;
45  boost::optional<T> m_data;
46 
47 
48 };
49 
50 
51 #endif //WAM_RESPONSE_H
Response::Response
Response()=delete
Response::~Response
~Response()=default
Response::m_message
std::string m_message
Definition: response.h:43
Response::get_error_code
int get_error_code()
Definition: response.h:35
Response::get_data
boost::optional< T > get_data()
Definition: response.h:24
Response::m_data
boost::optional< T > m_data
Definition: response.h:45
Response::get_message
std::string get_message()
Definition: response.h:32
Response
Definition: response.h:12
Response::Response
Response(const std::string &p_message, const int &p_error_code, const boost::optional< T > &p_data)
Definition: response.h:17
Response::m_error_code
int m_error_code
Definition: response.h:44