cel_errutil.h

Go to the documentation of this file.
00001 //----------------------------------------------------------------------------
00004 //
00005 // (C) 2003-2006 Celartem Technology Inc. All rights reserved.
00006 //----------------------------------------------------------------------------
00007 
00008 #ifndef _cel_errutil_h_
00009 #define _cel_errutil_h_
00010 
00011 #include "cel_types.h"
00012 #include "cel_string.h"
00013 #include "cel_error.h"
00014 #include "cel_exception.h"
00015 
00016 namespace Celartem
00017 {
00022     class ErrorSaver
00023     {
00024     public:
00028         ErrorSaver();
00029 
00033         ~ErrorSaver();
00034 
00038         void restore();
00039 
00043         typedef uint64_t ErrorType;
00044 
00045     private:
00046         int m_errno;
00047         ErrorType m_oserr;
00048     };
00049 
00053     struct Error
00054     {
00061         static GeneralErrorDefinition errorFromOSError();
00062 
00069         static GeneralErrorDefinition errorFromErrno();
00070 
00077         static String stringFromOSError();\
00078 
00085         static String stringFromErrno();\
00086     };
00087 
00088 } // namespace Celartem
00089 
00094 #define celThrowOSError() \
00095     throw::Celartem::Exception( \
00096         ::Celartem::Error::errorFromOSError(), \
00097         ::Celartem::Error::stringFromOSError(), \
00098         __FILE__, __LINE__)
00099 
00106 #define celThrowOSError_1(str) \
00107     throw ::Celartem::Exception( \
00108         ::Celartem::Error::errorFromOSError(), \
00109         (::Celartem::Error::stringFromOSError() + utf8s(" ") + str), \
00110         __FILE__, __LINE__)
00111 
00116 #define celThrow_E(err) \
00117     throw ::Celartem::Exception( \
00118         err, \
00119         ::Celartem::Error::stringFromOSError(), \
00120         __FILE__, __LINE__)
00121 
00122 #endif // _cel_errutil_h_

This document is automatically generated using doxygen 1.5.4 at Fri Jun 27 18:21:54 2008.