ASPiK SDK
vstguidebug.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #ifndef __vstguidebug__
6 #define __vstguidebug__
7 
8 #include "vstguibase.h"
9 #include <functional>
10 
11 //------------------------------------------------------------------------
12 namespace VSTGUI {
13 
14 using AssertionHandler = std::function<void (const char* filename, const char* line, const char* desc)>;
15 void setAssertionHandler (const AssertionHandler& handler);
16 bool hasAssertionHandler ();
17 void doAssert (const char* filename, const char* line, const char* desc = nullptr) noexcept (false);
18 
19 #define vstgui_assert(x, ...) if (!(x)) VSTGUI::doAssert (__FILE__, VSTGUI_MAKE_STRING(__LINE__), ## __VA_ARGS__);
20 
21 } // VSTGUI
22 
23 #if DEBUG
24 
25 #include <ctime>
26 #include <cassert>
27 
28 namespace VSTGUI {
29 
30 //-----------------------------------------------------------------------------
31 extern void DebugPrint (const char *format, ...);
32 
33 //-----------------------------------------------------------------------------
34 class TimeWatch
35 {
36 public:
37  TimeWatch (UTF8StringPtr name = nullptr, bool startNow = true);
38  ~TimeWatch () noexcept;
39 
40  void start ();
41  void stop ();
42 
43 protected:
44  std::string name;
45  std::clock_t startTime;
46 };
47 
48 } // namespace
49 
50 #else
51 
52 #endif // DEBUG
53 
54 #endif
Definition: customcontrols.cpp:8