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__)
26#define MYGUI_EXCEPT(dest) \
28 MYGUI_LOG(Critical, dest); \
29 std::ostringstream stream; \
30 stream << dest << "\n"; \
31 MYGUI_BASE_EXCEPT(stream.str().c_str(), "MyGUI"); \
34#define MYGUI_ASSERT(exp, dest) \
38 MYGUI_LOG(Critical, dest); \
39 std::ostringstream stream; \
40 stream << dest << "\n"; \
41 MYGUI_BASE_EXCEPT(stream.str().c_str(), "MyGUI"); \
45#define MYGUI_ASSERT_RANGE(index, size, owner) MYGUI_ASSERT(index < size, owner << " : index number " << index << " out of range [" << size << "]")
46#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 << "]")
47#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")
49#if MYGUI_DEBUG_MODE == 1
50# define MYGUI_REGISTER_VALUE(map, value) \
52 MYGUI_LOG(Info, "Register value : '" << #value << "' = " << (int)value); \
53 map[#value] = value; \
55# define MYGUI_DEBUG_ASSERT(exp, dest) MYGUI_ASSERT(exp, dest)
57# define MYGUI_REGISTER_VALUE(map, value) map[#value] = value
58# define MYGUI_DEBUG_ASSERT(exp, dest) ((void)0)
62#if MYGUI_COMPILER == MYGUI_COMPILER_MSVC
63# if MYGUI_COMP_VER < 1310
64# define MYGUI_OBSOLETE_START(text)
65# define MYGUI_OBSOLETE_END
67# define MYGUI_OBSOLETE_START(text) __declspec(deprecated(text))
68# define MYGUI_OBSOLETE_END
71#elif MYGUI_COMPILER == MYGUI_COMPILER_GNUC
72# if MYGUI_PLATFORM == MYGUI_PLATFORM_LINUX && MYGUI_COMP_VER < 310
73# define MYGUI_OBSOLETE_START(text)
74# define MYGUI_OBSOLETE_END
76# define MYGUI_OBSOLETE_START(text)
77# define MYGUI_OBSOLETE_END __attribute__((deprecated))
81# define MYGUI_OBSOLETE_START(text)
82# define MYGUI_OBSOLETE_END
86#define MYGUI_OBSOLETE(text) MYGUI_OBSOLETE_START(text)MYGUI_OBSOLETE_END