libbbb  1.2.1
Groups common code used in some applications and libraries.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
libbbb_debug.h
Go to the documentation of this file.
1 /* ========================================================================= */
2 /* ------------------------------------------------------------------------- *//*
11 
12 
13  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14  Please read COPYING and README files in root folder
15  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16 */
17 /* ------------------------------------------------------------------------- */
18 /* ========================================================================= */
19 #ifndef __LIBBBB_DEBUG_INC__
20 #define __LIBBBB_DEBUG_INC__
21 //
22 //
23 //
24 //
25 /* INCLUDES ------------------------------------------------------------ */
26 
27 /* we make sure we have the user settings before this file */
28 #include <libbbb/libbbb_global.h>
29 #include <libbbb/libbbb_config.h>
30 
31 /* INCLUDES ============================================================ */
32 //
33 //
34 //
35 //
36 /* DEFINITIONS --------------------------------------------------------- */
37 
38 
54  BBBDBG_MAX
55 };
56 
57 /* by default enable logging in debug builds */
58 #ifndef BBB_ENABLE_LOGGING
59 # ifndef QT_NO_DEBUG
60 # define BBB_ENABLE_LOGGING 1
61 # else
62 # define BBB_ENABLE_LOGGING 0
63 # endif
64 #endif
65 
66 #if BBB_ENABLE_LOGGING
67 # include <QDebug>
68 
69 /* IS_BBB_DEBUG_ID_ALLOWED should be defined in LIBBBB_config.h */
70 #ifndef IS_BBB_DEBUG_ID_ALLOWED
71 # define IS_BBB_DEBUG_ID_ALLOWED( id ) false
72 #endif
73 
74 # define BBBDBG(id,txt) \
75  if ( IS_BBB_DEBUG_ID_ALLOWED( id ) ) \
76  qDebug() << bbb::debugName(id) << ": " << txt
77 # define BBBDBG2(id,txt1,txt2) \
78  if ( IS_BBB_DEBUG_ID_ALLOWED( id ) ) \
79  qDebug() << bbb::debugName(id) << ": " << txt1 << txt2
80 # define BBBDBG3(id,txt1,txt2,txt3) \
81  if ( IS_BBB_DEBUG_ID_ALLOWED( id ) ) \
82  qDebug() << bbb::debugName(id) << ": " << txt1 << txt2 << txt3
83 # define BBBDBG_FUNC(id) BBBDBG(id, __func__ )
84 # define BBBDBG_CDTOR BBBDBG2(BBBDBG_CTORDTOR, __func__, this )
85 #else
86 # define BBBDBG(id,txt)
87 # define BBBDBG2(id,txt1,txt2)
88 # define BBBDBG3(id,txt1,txt2,txt3)
89 # define BBBDBG_FUNC(id)
90 # define BBBDBG_CDTOR
91 #endif
92 
93 /* DEFINITIONS ========================================================= */
94 //
95 //
96 //
97 //
98 /* DATA ---------------------------------------------------------------- */
99 
100 /* DATA ================================================================ */
101 //
102 //
103 //
104 //
105 /* FUNCTIONS ----------------------------------------------------------- */
106 
107 namespace bbb {
108 #ifndef QT_NO_DEBUG
109 BBBSHARED_EXPORT const char * debugName ( int i );
110 #endif
111 }
112 
113 /* FUNCTIONS =========================================================== */
114 //
115 //
116 //
117 //
118 #endif // __LIBBBB_DEBUG_INC__
119 /* ------------------------------------------------------------------------- */
120 /* ========================================================================= */