-
Notifications
You must be signed in to change notification settings - Fork 0
/
DbgUtils.h
66 lines (52 loc) · 2.47 KB
/
DbgUtils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//----------------------------------------------------------------------------------------
// DbgUtils.h - Cocoa debugging and error handling
//
// Copyright © Chris, 2003 - 2009. All rights reserved.
//----------------------------------------------------------------------------------------
#pragma once
#ifndef qConstCStr
typedef const char* ConstCStr;
#define qConstCStr
#endif
#ifndef qDebug
#define qDebug 1
#endif
#ifndef kAppName
#define kAppName ""
#endif
#define qTime (qDebug && 0)
//----------------------------------------------------------------------------------------
#pragma mark -
//----------------------------------------------------------------------------------------
#if qDebug
#define _F_L_F_ __FILE__, __LINE__, __PRETTY_FUNCTION__
#define WarnIf(expr) DbgWarnIf(_F_L_F_, (expr))
#define WarnIfNot(expr, ex) DbgWarnIfNot(_F_L_F_, (expr), (ex))
#define Assert(expr) do { if (!(expr)) DbgAssert(_F_L_F_, #expr); } while (0)
#define AssertClass(OBJ, CLASS) Assert([(OBJ) isKindOfClass: [CLASS class]])
#define Log(expr) DbgLog(_F_L_F_, #expr)
#define dprintf(fmt...) DbgLogF(_F_L_F_, fmt)
#define dprintf_(fmt...) DbgLogF2(fmt)
#define ReportCatch(expr) DbgReportCatch(_F_L_F_, (expr))
ConstCStr LeafName (ConstCStr file);
ConstCStr Demangle (ConstCStr func);
OSStatus DbgWarnIf (ConstCStr file, int line, ConstCStr func, OSStatus err);
OSStatus DbgWarnIfNot (ConstCStr file, int line, ConstCStr func, OSStatus err, OSStatus exclude);
void DbgAssert (ConstCStr file, int line, ConstCStr func, ConstCStr expr);
void DbgLogF (ConstCStr file, int line, ConstCStr func, ConstCStr fmt, ...);
void DbgLog (ConstCStr file, int line, ConstCStr func, ConstCStr msg);
void DbgReportCatch (ConstCStr file, int line, ConstCStr func, NSObject* err);
void DbgLogF2 (ConstCStr fmt, ...);
//----------------------------------------------------------------------------------------
#elif !qDebug
#define WarnIf(expr) (expr)
#define WarnIfNot(expr, ex) (expr)
#define Assert(expr) /*DbgAssert(_F_L_F_, #expr)*/
#define AssertClass(OBJ, CLASS) /*AssertClass*/
#define Log(expr) /*DbgLog(_F_L_F_, #expr)*/
#define dprintf(fmt, args...) /*DbgLog(_F_L_F_, fmt, args)*/
#define dprintf_(fmt, args...) /*DbgLogF2(fmt, args)*/
#define ReportCatch(expr) /*DbgReportCatch(_F_L_F_, (expr))*/
#endif
//----------------------------------------------------------------------------------------
// End of DbgUtils.h