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: /vol/cvsroot/parser/inc/ms_http_helper_return.hpp,v $
00012  * @(#)$Revision: 1.2 $
00013  * @(#)$Date: 2015/06/16 15:30:11 $
00014 ##############################################################################
00015  */
00016 
00017 #ifndef MS_HTTP_HELPER_RETURN_HPP
00018 #define MS_HTTP_HELPER_RETURN_HPP
00019 
00020 #ifdef _WIN32
00021 #pragma warning(disable:4251)   // Don't want all classes to be exported
00022 #pragma warning(disable:4786)   // Debug symbols too long
00023 #   ifndef _MATRIX_USE_STATIC_LIB
00024 #       ifdef MS_MASCOTRESFILE_EXPORTS
00025 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00026 #       else
00027 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00028 #       endif
00029 #   else
00030 #       define MS_MASCOTRESFILE_API
00031 #   endif
00032 #else
00033 #   define MS_MASCOTRESFILE_API
00034 #endif
00035 
00036 #include <string>
00037 
00038 namespace matrix_science
00039 {
00045 
00046 
00051     class MS_MASCOTRESFILE_API ms_http_helper_return
00052     {
00053         public:
00055 
00058             enum ErrorTypeCode
00059             {
00060                 ERR_NONE, 
00061                 ERR_ABORTEDBYUSER, 
00062                 ERR_SYSTEM, 
00063                 ERR_HTTP,  
00064                 ERR_UNSPECIFIED 
00065             };
00066 
00068             static ms_http_helper_return systemError(int systemError);
00070             static ms_http_helper_return httpError(int httpStatusCode, std::string errorText);
00072             static ms_http_helper_return unspecifiedError();
00074             static ms_http_helper_return abortedByUser();
00075 
00076 #ifndef SWIG
00077 
00078             ms_http_helper_return();
00079 #endif
00080 
00082             bool isOk() const;
00083 #ifndef SWIG
00084 
00085             operator bool () const;
00086 #endif
00087 
00089             ErrorTypeCode getErrorType() const;
00090             ErrorTypeCode errorType() const { return getErrorType();      } // Deprecated and undocumented - not a normal Parser function name
00091 
00093             int getSystemError() const;
00094             int systemError() const         { return getSystemError();    }  // Deprecated and undocumented - not a normal Parser function name
00095 
00097             int getHttpStatusCode() const;
00098             int httpStatusCode() const      { return getHttpStatusCode(); } // Deprecated and undocumented - not a normal Parser function name
00099 
00101             std::string getErrorText() const;
00102             std::string errorText() const   { return getErrorText();      } // Deprecated and undocumented - not a normal Parser function name
00103 
00104         private:
00105             ErrorTypeCode errorType_;
00106             int           systemError_;
00107             int           httpStatusCode_;
00108             std::string   errorText_;
00109     };
00110  // end of http_client_group
00112 } // namespace matrix_science
00113 
00114 #endif // MS_HTTP_HELPER_RETURN_HPP
00115 
00116 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51