Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef UT_DEBUGMSG_H
00021 #define UT_DEBUGMSG_H
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include "config.h"
00025 #endif
00026
00027
00028
00029
00030
00031 #ifndef UT_TYPES_H
00032 #include "ut_types.h"
00033 #endif
00034
00035 template<class T>
00036 class UT_DebugOnly
00037 {
00038 public:
00039
00040 #if DEBUG
00041 T value;
00042 UT_DebugOnly()
00043 {
00044 }
00045 UT_DebugOnly(const T& other)
00046 : value(other)
00047 {
00048 }
00049 UT_DebugOnly& operator=(const T& rhs)
00050 {
00051 value = rhs;
00052 return *this;
00053 }
00054 void operator++(int)
00055 {
00056 value++;
00057 }
00058 void operator--(int)
00059 {
00060 value--;
00061 }
00062
00063 operator T&()
00064 {
00065 return value;
00066 }
00067 operator const T&() const
00068 {
00069 return value;
00070 }
00071
00072 T& operator->()
00073 {
00074 return value;
00075 }
00076
00077 #else
00078 UT_DebugOnly()
00079 {
00080 }
00081 UT_DebugOnly(const T&)
00082 {
00083 }
00084 UT_DebugOnly& operator=(const T&)
00085 {
00086 return *this;
00087 }
00088 void operator++(int)
00089 {
00090 }
00091 void operator--(int)
00092 {
00093 }
00094 #endif
00095
00096 ~UT_DebugOnly()
00097 {
00098 }
00099 };
00100
00101
00102 ABI_EXPORT void _UT_OutputMessage(const char *s, ...) ABI_PRINTF_FORMAT(1,2);
00103
00104 #ifdef DEBUG
00105 #define UT_DEBUGMSG(M) _UT_OutputMessage M
00106 #else
00107 #define UT_DEBUGMSG(M)
00108 #endif
00109
00110
00111
00112
00113 #define xxx_UT_DEBUGMSG(M)
00114
00115
00116
00117
00118
00119 #ifdef _WIN32
00120 ABI_EXPORT void _UT_WarningMessage(const char *s, ...);
00121 #else
00122 #define _UT_WarningMessage _UT_OutputMessage
00123 #endif
00124 #define UT_WARNINGMSG(M) _UT_WarningMessage M
00125
00126
00127 #endif