]> SALOME platform Git repositories - modules/gde.git/blob - projects/GDE_API_CPP/api/src/CommandResultTO.hpp
Salome HOME
API c++
[modules/gde.git] / projects / GDE_API_CPP / api / src / CommandResultTO.hpp
1 #ifndef GDE_COMMAND_RESULT_TO_HPP
2 #define GDE_COMMAND_RESULT_TO_HPP
3
4 #include <string>
5 #include <map>
6
7 namespace gde {
8
9   class CommandResultTO {
10
11   public :
12     // WARNING: keep enum values synchronized to WEB API (CommandResultTO)
13     enum { OK = 1, ERROR = 2};
14
15   public:
16     CommandResultTO(int code = -1,
17                     std::string message = std::string(),
18                     std::string data = std::string())
19       : _code(code), _message(message), _data(data) {}
20     CommandResultTO(const CommandResultTO&);
21     ~CommandResultTO() {}
22
23     inline std::string getMessage() const { return _message; }
24     inline void setMessage(std::string message) { this->_message = message; }
25
26     inline std::string getData() const { return _data; }
27     inline void setData(std::string data) { this->_data = data; }
28
29     inline int getCode() const { return _code; }
30     inline void setCode(int code) { this->_code = code; }
31
32     static CommandResultTO fromJson(std::string json);
33     std::string toJson();
34
35   private:
36     int _code;
37     std::string _message; // JSON format
38     std::string _data; // JSON format
39   };
40
41 };
42
43 #endif