MorphoGraphX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Assert.hpp
Go to the documentation of this file.
1 #ifndef ASSERT_HPP
2 #define ASSERT_HPP
3 
12 #include <cassert>
13 
14 class QString;
15 
16 namespace mgx {
17 namespace util {
18 void __assert_fail(const QString& assertion, const char* file, unsigned int line, const char* function);
19 
20 #ifdef NDEBUG
21 # define mgx_assert(expr) static_cast<void>(0)
22 # define mgx_assert_msg(expr, msg) static_cast<void>(0)
23 #else
24 
32 # define mgx_assert(expr) \
33  ((expr) ? static_cast<void>(0) : mgx::util::__assert_fail(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__))
34 # define mgx_assert_msg(expr, msg) \
35  ((expr) ? static_cast<void>(0) : mgx::util::__assert_fail(msg, __FILE__, __LINE__, __PRETTY_FUNCTION__))
36 #endif
37 } // namespace util
38 } // namespace mgx
39 
40 #endif