assert.h

Go to the documentation of this file.
00001 #ifndef VVELIB_UTIL_ASSERT_H
00002 #define VVELIB_UTIL_ASSERT_H
00003 
00012 #include <config.h>
00013 #include <cassert>
00014 
00015 class QString;
00016 
00017 namespace util
00018 {
00019   void __assert_fail(const QString& assertion, const char* file,
00020                      unsigned int line, const char* function);
00021   void __assert_fail_txt(const QString& assertion, const char* file,
00022                          unsigned int line, const char* function);
00023 #ifdef _MSC_VER
00024 #  define __PRETTY_FUNCTION__ __FUNCSIG__
00025 #endif
00026 
00027 #ifdef NDEBUG
00028 #  define vvassert(expr) do { expr; } while(false)
00029 #  define vvassert_msg(expr, msg) do { expr; } while(false)
00030 #else
00031 #  ifndef TEXT_VVASSERT
00032 
00040 #    define vvassert(expr) ((expr) \
00041                             ? static_cast<void>(0) \
00042                             : util::__assert_fail(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__))
00043 #    define vvassert_msg(expr, msg) ((expr) \
00044                             ? static_cast<void>(0) \
00045                             : util::__assert_fail(msg, __FILE__, __LINE__, __PRETTY_FUNCTION__))
00046 #  else
00047 #    define vvassert(expr) ((expr) \
00048                             ? static_cast<void>(0) \
00049                             : util::__assert_fail_txt(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__))
00050 #    define vvassert_msg(expr, msg) ((expr) \
00051                             ? static_cast<void>(0) \
00052                             : util::__assert_fail_txt(msg, __FILE__, __LINE__, __PRETTY_FUNCTION__))
00053 #  endif
00054 #endif
00055 }
00056 
00057 #endif // VVELIB_UTIL_ASSERT_H
00058 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Fri May 31 15:37:52 2013 for VVE by  doxygen 1.6.3