summaryrefslogtreecommitdiffabout
path: root/microkde/kdebug.h
Unidiff
Diffstat (limited to 'microkde/kdebug.h') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdebug.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/microkde/kdebug.h b/microkde/kdebug.h
new file mode 100644
index 0000000..bb9cfe3
--- a/dev/null
+++ b/microkde/kdebug.h
@@ -0,0 +1,92 @@
1#ifndef MINIKDE_KDEBUG_H
2#define MINIKDE_KDEBUG_H
3
4#include <stdio.h>
5
6#include <qstring.h>
7
8
9
10class kdbgstream;
11typedef kdbgstream & (*KDBGFUNC)(kdbgstream &); // manipulator function
12
13class kdbgstream {
14 public:
15 kdbgstream(unsigned int _area, unsigned int _level, bool _print = true) :
16 area(_area), level(_level), print( _print ) { print = false; }
17 /* kdbgstream(const char * initialString, unsigned int _area, unsigned int _level, bool _print = false) :
18 output(QString::fromLatin1(initialString)), area(_area), level(_level), print(_print) { print = false; }*/
19 ~kdbgstream()
20 {
21 // if (!output.isEmpty()) {
22 // fprintf(stderr,"ASSERT: debug output not ended with \\n\n");
23 //*this << "\n";
24 //}
25 }
26 kdbgstream &operator<<(bool) {
27
28 return *this;
29 }
30 kdbgstream &operator<<(short) {
31
32 return *this;
33 }
34 kdbgstream &operator<<(unsigned short) {
35
36 return *this;
37 }
38 kdbgstream &operator<<(char) {
39
40 return *this;
41 }
42 kdbgstream &operator<<(unsigned char) {
43
44 return *this;
45 }
46
47 kdbgstream &operator<<(int) {
48
49 return *this;
50 }
51 kdbgstream &operator<<(unsigned int) {
52
53 return *this;
54 }
55 kdbgstream &operator<<(long) {
56 return *this;
57 }
58 kdbgstream &operator<<(unsigned long) {
59 return *this;
60 }
61 kdbgstream &operator<<(const QString&) {
62 return *this;
63 }
64 kdbgstream &operator<<(const char*) {
65 return *this;
66 }
67 kdbgstream &operator<<(const QCString&) {
68 return *this;
69 }
70 kdbgstream& operator<<(KDBGFUNC f) {
71 return (*f)(*this);
72 }
73 kdbgstream& operator<<(double) {
74 if (!print) return *this;
75 return *this;
76 }
77 void flush() {
78 return;
79 }
80 private:
81 QString output;
82 unsigned int area, level;
83 bool print;
84};
85
86inline kdbgstream &endl( kdbgstream &s) { s << "\n"; return s; }
87
88inline kdbgstream kdDebug(int area = 0) { return kdbgstream(area, 0); }
89inline kdbgstream kdWarning(int area = 0) { return kdbgstream(area, 0); }
90inline kdbgstream kdError(int area = 0) { return kdbgstream(area, 0); }
91
92#endif