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