00001
00031 #ifndef INC_MI32_ERRHANDLER_H
00032 #define INC_MI32_ERRHANDLER_H
00033
00034 #ifndef INC_MI32_STDDEFNS_H
00035 #include <mi32/stddefns.h>
00036 #endif
00037
00038 #ifdef MISYSTEMDLL
00039 #define CLASSLIBEXPORT MI_DLLCLASSEXPORT
00040 #define LIBEXPORT MI_DLLEXPORT
00041 #else
00042 #define CLASSLIBEXPORT MI_DLLCLASSIMPORT
00043 #define LIBEXPORT MI_DLLIMPORT
00044 #endif
00045
00046
00047 #ifdef __cplusplus
00048 class MISTRING;
00049 #endif
00050
00053
00054 #ifndef GENERATING_DOXYGEN_OUTPUT
00055 #if defined(__cplusplus)
00056 extern "C" {
00057 #endif
00058 #endif
00059
00061 LIBEXPORT void ClearLastErr (void);
00062
00065 LIBEXPORT const MIUNICODE* GetErrDetails ();
00066
00067 #if defined(__cplusplus)
00068
00072 LIBEXPORT MISTRING& GetErrString (
00073 );
00074
00077 LIBEXPORT const MIUNICODE* GetErrStrUC (
00078 ERRVALUE errcode,
00079 int *errlevel = 0
00080 );
00081
00082
00085 LIBEXPORT const MIUNICODE* GetErrStrLine1UC (
00086 ERRVALUE errcode,
00087 int *errlevel = 0
00088 );
00089
00092 LIBEXPORT bool IsErrPosnDisabled ();
00093
00094 #else
00095 #ifndef GENERATING_DOXYGEN_OUTPUT
00099
00100 LIBEXPORT const MIUNICODE* GetErrStrUC (
00101 ERRVALUE errcode,
00102 int *errlevel
00103 );
00104
00105 LIBEXPORT const MIUNICODE* GetErrStrLine1UC (
00106 ERRVALUE errcode,
00107 int *errlevel
00108 );
00109
00110 #endif // GENERATING_DOXYGEN_OUTPUT
00111 #endif
00112
00114 LIBEXPORT ERRVALUE GetLastErrCode ();
00115
00120 LIBEXPORT void SetErrDetails (
00121 const MIUNICODE*
00122 );
00123
00124 #ifndef GENERATING_DOXYGEN_OUTPUT
00125 LIBEXPORT int _SetErrPosn (int, const char*, int);
00126 LIBEXPORT int _SetErrPosnC (int, const char*, int);
00127 #endif // GENERATING_DOXYGEN_OUTPUT
00128
00144 #define SetErrPosn(e) _SetErrPosn(e,RCSID,__LINE__)
00145
00151 #define SetErrPosnC(e) _SetErrPosnC(e,RCSID,__LINE__)
00152
00153
00160 #define SetErrPosnGoto(e) { err=SetErrPosn(e); goto Error; }
00161
00167 #define SetErrPosnGotoC(e) { err=SetErrPosnC(e); goto Error; }
00168
00169
00177 LIBEXPORT void SetErrPosnDisable (void);
00178
00182 LIBEXPORT void SetErrPosnEnable (void);
00183
00184 #if defined(__cplusplus)
00185 }
00186 #endif
00187
00189
00190
00191 #if defined(__cplusplus)
00193 class ERRORPOSNDISABLE {
00194 public:
00195 ERRORPOSNDISABLE (
00196 ) { SetErrPosnDisable(); }
00197
00198 ~ERRORPOSNDISABLE (
00199 ) { SetErrPosnEnable(); }
00200 };
00201
00202
00203 class CLASSLIBEXPORT ERRORSTATE {
00204 public:
00206 ERRORSTATE (
00207 );
00208
00210 ERRORSTATE (
00211 const ERRORSTATE& rhs
00212 );
00213
00215 ~ERRORSTATE (
00216 );
00217
00219 ERRORSTATE& operator= (
00220 const ERRORSTATE& rhs
00221 );
00222
00224 void Clear (
00225 );
00226
00228 void CopyFromThread (
00229 ) { *this = GetThreadErrStateRef(); }
00230
00238 void Disable (
00239 );
00240
00243 void Enable (
00244 );
00245
00247 const MISTRING& GetDetails (
00248 ) const;
00249
00251 ERRVALUE GetErrValue (
00252 ) const;
00253
00255 const MISTRING& GetMessage (
00256 ) const;
00257
00259 static MISTRING GetMessageFirstLine (
00260 int errcode
00261 );
00262
00266 MISTRING& GetMessageRef (
00267 );
00268
00270 static MISTRING GetMessageSingleLine (
00271 int errcode
00272 );
00273
00277 MISTRING& GetPlaceHolderRef (
00278 );
00279
00281 MISTRING GetReport (
00282 ) const;
00283
00289 static ERRORSTATE& GetThreadErrStateRef (
00290 );
00291
00296 static ERRORSTATE& GetThreadErrStateRefFast (
00297 );
00298
00300 const MISTRING& GetTrace (
00301 ) const;
00302
00304 bool IsDisabled (
00305 ) const;
00306
00311 void SetDetails (
00312 const MISTRING& details
00313 );
00314
00316 ERRVALUE SetPosn (
00317 ERRVALUE errcode,
00318 const char *rcsid,
00319 int line
00320 );
00321
00322 private:
00323 #ifndef GENERATING_DOXYGEN_OUTPUT
00324 class PRIV;
00325 PRIV* m_pPriv;
00326 #endif
00327 };
00328
00329 #endif
00330
00331 #undef LIBEXPORT
00332 #undef CLASSLIBEXPORT
00333
00334 #endif // INC_MI32_ERRHANDLER_H