00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef MS_HTTP_HELPER_RETURN_HPP
00018 #define MS_HTTP_HELPER_RETURN_HPP
00019
00020
00021 #include <string>
00022
00023 namespace matrix_science
00024 {
00030
00031
00036 class MS_MASCOTRESFILE_API ms_http_helper_return
00037 {
00038 public:
00040
00043 enum ErrorTypeCode
00044 {
00045 ERR_NONE,
00046 ERR_ABORTEDBYUSER,
00047 ERR_SYSTEM,
00048 ERR_HTTP,
00049 ERR_UNSPECIFIED
00050 };
00051
00053 static ms_http_helper_return systemError(int systemError);
00055 static ms_http_helper_return httpError(int httpStatusCode, std::string errorText);
00057 static ms_http_helper_return unspecifiedError();
00059 static ms_http_helper_return abortedByUser();
00060
00061 #ifndef SWIG
00062
00063 ms_http_helper_return();
00064 #endif
00065
00067 bool isOk() const;
00068 #ifndef SWIG
00069
00070 operator bool () const;
00071 #endif
00072
00074 ErrorTypeCode getErrorType() const;
00075 ErrorTypeCode errorType() const { return getErrorType(); }
00076
00078 int getSystemError() const;
00079 int systemError() const { return getSystemError(); }
00080
00082 int getHttpStatusCode() const;
00083 int httpStatusCode() const { return getHttpStatusCode(); }
00084
00086 std::string getErrorText() const;
00087 std::string errorText() const { return getErrorText(); }
00088
00089 private:
00090 ErrorTypeCode errorType_;
00091 int systemError_;
00092 int httpStatusCode_;
00093 std::string errorText_;
00094 };
00095
00097 }
00098
00099 #endif // MS_HTTP_HELPER_RETURN_HPP
00100
00101