Matrix Science header

ms_http_helper_return.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_http_helper_return.hpp                                                   #
00004 # 'msparser' toolkit                                                         #
00005 # Hold a response from an internet function                                  #
00006 ##############################################################################
00007 # COPYRIGHT NOTICE                                                           #
00008 # Copyright 1998-2013 Matrix Science Limited  All Rights Reserved.           #
00009 #                                                                            #
00010 ##############################################################################
00011  * @(#)$Source: parser/inc/ms_http_helper_return.hpp $
00012  * @(#)$Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $
00013  * @(#)$Date: 2018-07-30 16:23:53 +0100 $
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();      } // Deprecated and undocumented - not a normal Parser function name
00076 
00078             int getSystemError() const;
00079             int systemError() const         { return getSystemError();    }  // Deprecated and undocumented - not a normal Parser function name
00080 
00082             int getHttpStatusCode() const;
00083             int httpStatusCode() const      { return getHttpStatusCode(); } // Deprecated and undocumented - not a normal Parser function name
00084 
00086             std::string getErrorText() const;
00087             std::string errorText() const   { return getErrorText();      } // Deprecated and undocumented - not a normal Parser function name
00088 
00089         private:
00090             ErrorTypeCode errorType_;
00091             int           systemError_;
00092             int           httpStatusCode_;
00093             std::string   errorText_;
00094     };
00095  // end of http_client_group
00097 } // namespace matrix_science
00098 
00099 #endif // MS_HTTP_HELPER_RETURN_HPP
00100 
00101 /*------------------------------- End of File -------------------------------*/

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29