Go to the documentation of this file.
7 #ifndef __MYGUI_DIAGNOSTIC_H__
8 #define __MYGUI_DIAGNOSTIC_H__
16 #if MYGUI_COMPILER == MYGUI_COMPILER_MSVC
20 #define MYGUI_LOG_SECTION "Core"
21 #define MYGUI_LOG_FILENAME "MyGUI.log"
22 #define MYGUI_LOG(level, text) MYGUI_LOGGING(MYGUI_LOG_SECTION, level, text)
24 #define MYGUI_BASE_EXCEPT(desc, src) throw MyGUI::Exception(desc, src, __FILE__, __LINE__);
27 #if MYGUI_COMPILER == MYGUI_COMPILER_MSVC
28 # define MYGUI_DBG_BREAK _CrtDbgBreak();
30 # define MYGUI_DBG_BREAK
33 #define MYGUI_EXCEPT(dest) \
35 MYGUI_LOG(Critical, dest); \
37 std::ostringstream stream; \
38 stream << dest << "\n"; \
39 MYGUI_BASE_EXCEPT(stream.str().c_str(), "MyGUI"); \
42 #define MYGUI_ASSERT(exp, dest) \
46 MYGUI_LOG(Critical, dest); \
48 std::ostringstream stream; \
49 stream << dest << "\n"; \
50 MYGUI_BASE_EXCEPT(stream.str().c_str(), "MyGUI"); \
54 #define MYGUI_ASSERT_RANGE(index, size, owner) MYGUI_ASSERT(index < size, owner << " : index number " << index << " out of range [" << size << "]");
55 #define MYGUI_ASSERT_RANGE_AND_NONE(index, size, owner) MYGUI_ASSERT(index < size || index == MyGUI::ITEM_NONE, owner << " : index number " << index << " out of range [" << size << "]");
56 #define MYGUI_ASSERT_RANGE_INSERT(index, size, owner) MYGUI_ASSERT((index <= size) || (index == MyGUI::ITEM_NONE), owner << " : insert index number " << index << " out of range [" << size << "] or not ITEM_NONE");
58 #if MYGUI_DEBUG_MODE == 1
59 # define MYGUI_REGISTER_VALUE(map, value) \
61 MYGUI_LOG(Info, "Register value : '" << #value << "' = " << (int)value); \
62 map[#value] = value; \
64 # define MYGUI_DEBUG_ASSERT(exp, dest) MYGUI_ASSERT(exp, dest)
66 # define MYGUI_REGISTER_VALUE(map, value) map[#value] = value;
67 # define MYGUI_DEBUG_ASSERT(exp, dest) ((void)0)
71 #if MYGUI_COMPILER == MYGUI_COMPILER_MSVC
72 # if MYGUI_COMP_VER < 1310 // VC++ 7.1
73 # define MYGUI_OBSOLETE_START(text)
74 # define MYGUI_OBSOLETE_END
76 # define MYGUI_OBSOLETE_START(text) __declspec(deprecated(text))
77 # define MYGUI_OBSOLETE_END
80 #elif MYGUI_COMPILER == MYGUI_COMPILER_GNUC
81 # if MYGUI_PLATFORM == MYGUI_PLATFORM_LINUX && MYGUI_COMP_VER < 310 // gcc 3.1
82 # define MYGUI_OBSOLETE_START(text)
83 # define MYGUI_OBSOLETE_END
85 # define MYGUI_OBSOLETE_START(text)
86 # define MYGUI_OBSOLETE_END __attribute__((deprecated))
90 # define MYGUI_OBSOLETE_START(text)
91 # define MYGUI_OBSOLETE_END
95 #define MYGUI_OBSOLETE(text) MYGUI_OBSOLETE_START(text)MYGUI_OBSOLETE_END
97 #endif // __MYGUI_DIAGNOSTIC_H__