Honeycomb  0.1
Component-Model Framework
Debug.h
Go to the documentation of this file.
1 // Honeycomb, Copyright (C) 2015 NewGamePlus Inc. Distributed under the Boost Software License v1.0.
2 #pragma once
3 
4 #include "Honey/Core/Core.h"
5 #include "Honey/Misc/platform/Debug.h"
6 
7 namespace honey
8 {
9 
10 class String;
11 
15 
18 namespace debug
19 {
22 
24  #define assert(...) EVAL(TOKCAT(assert_, NUMARGS(__VA_ARGS__))(__VA_ARGS__))
25  #define verify(...) EVAL(TOKCAT(verify_, NUMARGS(__VA_ARGS__))(__VA_ARGS__))
27 
28  #ifndef FINAL
29  #define debug_if(...) __VA_ARGS__
31  #define debug_print(...) { honey::debug::platform::print(__VA_ARGS__); }
33  #define debug_break(msg) { try { error_(msg); } catch (...) {} }
35  #define assert_1(expr) assert_2(expr, "")
37  #define assert_2(expr, msg) if (!(expr)) { honey::debug::platform::assertFail(#expr, __FUNC__, __FILE__, __LINE__, (msg)); }
39  #define verify_1(expr) assert_1(expr)
41  #define verify_2(expr, msg) assert_2(expr, msg)
43  #define error_(msg) assert_2(false, msg)
45  static const bool enabled = true;
47  #else
48  #define debug_if(...)
49  #define debug_print(...) {}
50  #define debug_break(msg) {}
51  #define assert_1(expr) {}
52  #define assert_2(expr, msg) {}
53  #define verify_1(expr) verify_2(expr, "")
54  #define verify_2(expr, msg) if (!(expr)) { honey::debug::platform::assertFail("", "", "", 0, ""); }
55  #define error_(msg) verify_2(false, msg)
56  static const bool enabled = false;
57  #endif
58 
60 }
61 
63 
64 }
Level debug(nullptr,"debug")
Low-level information for debugging purposes.
Definition: Log.h:26
static const bool enabled
Flag to check if debug mode is enabled at compile-time/runtime.
Definition: Debug.h:46
Global Honeycomb namespace.