author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Mon, 19 Apr 2010 10:15:19 +0300 | |
branch | RCL_3 |
changeset 9 | b5b118452c7d |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtCore module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifdef QT_NO_DEBUG |
|
43 |
#undef QT_NO_DEBUG |
|
44 |
#endif |
|
45 |
#ifdef qDebug |
|
46 |
#undef qDebug |
|
47 |
#endif |
|
48 |
||
49 |
#include "qdebug.h" |
|
50 |
||
51 |
// This file is needed to force compilation of QDebug into the kernel library. |
|
52 |
||
53 |
/*! |
|
54 |
\class QDebug |
|
55 |
||
56 |
\brief The QDebug class provides an output stream for debugging information. |
|
57 |
||
58 |
QDebug is used whenever the developer needs to write out debugging or tracing |
|
59 |
information to a device, file, string or console. |
|
60 |
||
61 |
\section1 Basic Use |
|
62 |
||
63 |
In the common case, it is useful to call the qDebug() function to obtain a |
|
64 |
default QDebug object to use for writing debugging information. |
|
65 |
||
66 |
\snippet doc/src/snippets/qdebug/qdebugsnippet.cpp 1 |
|
67 |
||
68 |
This constructs a QDebug object using the constructor that accepts a QtMsgType |
|
69 |
value of QtDebugMsg. Similarly, the qWarning(), qCritical() and qFatal() |
|
70 |
functions also return QDebug objects for the corresponding message types. |
|
71 |
||
72 |
The class also provides several constructors for other situations, including |
|
73 |
a constructor that accepts a QFile or any other QIODevice subclass that is |
|
74 |
used to write debugging information to files and other devices. The constructor |
|
75 |
that accepts a QString is used to write to a string for display or serialization. |
|
76 |
||
77 |
\section1 Writing Custom Types to a Stream |
|
78 |
||
79 |
Many standard types can be written to QDebug objects, and Qt provides support for |
|
80 |
most Qt value types. To add support for custom types, you need to implement a |
|
81 |
streaming operator, as in the following example: |
|
82 |
||
83 |
\snippet doc/src/snippets/qdebug/qdebugsnippet.cpp 0 |
|
84 |
||
85 |
This is described in the \l{Debugging Techniques} and |
|
86 |
\l{Creating Custom Qt Types#Making the Type Printable}{Creating Custom Qt Types} |
|
87 |
documents. |
|
88 |
*/ |
|
89 |
||
90 |
/*! |
|
91 |
\fn QDebug::QDebug(QIODevice *device) |
|
92 |
||
93 |
Constructs a debug stream that writes to the given \a device. |
|
94 |
*/ |
|
95 |
||
96 |
/*! |
|
97 |
\fn QDebug::QDebug(QString *string) |
|
98 |
||
99 |
Constructs a debug stream that writes to the given \a string. |
|
100 |
*/ |
|
101 |
||
102 |
/*! |
|
103 |
\fn QDebug::QDebug(QtMsgType type) |
|
104 |
||
105 |
Constructs a debug stream that writes to the handler for the message type specified by \a type. |
|
106 |
*/ |
|
107 |
||
108 |
/*! |
|
109 |
\fn QDebug::QDebug(const QDebug &other) |
|
110 |
||
111 |
Constructs a copy of the \a other debug stream. |
|
112 |
*/ |
|
113 |
||
114 |
/*! |
|
115 |
\fn QDebug &QDebug::operator=(const QDebug &other) |
|
116 |
||
117 |
Assigns the \a other debug stream to this stream and returns a reference to |
|
118 |
this stream. |
|
119 |
*/ |
|
120 |
||
121 |
/*! |
|
122 |
\fn QDebug::~QDebug() |
|
123 |
||
124 |
Flushes any pending data to be written and destroys the debug stream. |
|
125 |
*/ |
|
126 |
||
127 |
/*! |
|
128 |
\fn QDebug &QDebug::space() |
|
129 |
||
130 |
Writes a space character to the debug stream and returns a reference to |
|
131 |
the stream. |
|
132 |
||
133 |
The stream will record that the last character sent to the stream was a |
|
134 |
space. |
|
135 |
||
136 |
\sa nospace(), maybeSpace() |
|
137 |
*/ |
|
138 |
||
139 |
/*! |
|
140 |
\fn QDebug &QDebug::nospace() |
|
141 |
||
142 |
Clears the stream's internal flag that records whether the last character |
|
143 |
was a space and returns a reference to the stream. |
|
144 |
||
145 |
\sa space(), maybeSpace() |
|
146 |
*/ |
|
147 |
||
148 |
/*! |
|
149 |
\fn QDebug &QDebug::maybeSpace() |
|
150 |
||
151 |
Writes a space character to the debug stream, depending on the last |
|
152 |
character sent to the stream, and returns a reference to the stream. |
|
153 |
||
154 |
If the last character was a space character, this function writes a space |
|
155 |
character to the stream; otherwise, no characters are written to the stream. |
|
156 |
||
157 |
\sa space(), nospace() |
|
158 |
*/ |
|
159 |
||
160 |
/*! |
|
161 |
\fn QDebug &QDebug::operator<<(QChar t) |
|
162 |
||
163 |
Writes the character, \a t, to the stream and returns a reference to the |
|
164 |
stream. |
|
165 |
*/ |
|
166 |
||
167 |
/*! |
|
168 |
\fn QDebug &QDebug::operator<<(QBool t) |
|
169 |
\internal |
|
170 |
||
171 |
Writes the boolean value, \a t, to the stream and returns a reference to the |
|
172 |
stream. |
|
173 |
*/ |
|
174 |
||
175 |
/*! |
|
176 |
\fn QDebug &QDebug::operator<<(bool t) |
|
177 |
||
178 |
Writes the boolean value, \a t, to the stream and returns a reference to the |
|
179 |
stream. |
|
180 |
*/ |
|
181 |
||
182 |
/*! |
|
183 |
\fn QDebug &QDebug::operator<<(char t) |
|
184 |
||
185 |
Writes the character, \a t, to the stream and returns a reference to the |
|
186 |
stream. |
|
187 |
*/ |
|
188 |
||
189 |
/*! |
|
190 |
\fn QDebug &QDebug::operator<<(signed short i) |
|
191 |
||
192 |
Writes the signed short integer, \a i, to the stream and returns a reference |
|
193 |
to the stream. |
|
194 |
*/ |
|
195 |
||
196 |
/*! |
|
197 |
\fn QDebug &QDebug::operator<<(unsigned short i) |
|
198 |
||
199 |
Writes then unsigned short integer, \a i, to the stream and returns a |
|
200 |
reference to the stream. |
|
201 |
*/ |
|
202 |
||
203 |
/*! |
|
204 |
\fn QDebug &QDebug::operator<<(signed int i) |
|
205 |
||
206 |
Writes the signed integer, \a i, to the stream and returns a reference |
|
207 |
to the stream. |
|
208 |
*/ |
|
209 |
||
210 |
/*! |
|
211 |
\fn QDebug &QDebug::operator<<(unsigned int i) |
|
212 |
||
213 |
Writes then unsigned integer, \a i, to the stream and returns a reference to |
|
214 |
the stream. |
|
215 |
*/ |
|
216 |
||
217 |
/*! |
|
218 |
\fn QDebug &QDebug::operator<<(signed long l) |
|
219 |
||
220 |
Writes the signed long integer, \a l, to the stream and returns a reference |
|
221 |
to the stream. |
|
222 |
*/ |
|
223 |
||
224 |
/*! |
|
225 |
\fn QDebug &QDebug::operator<<(unsigned long l) |
|
226 |
||
227 |
Writes then unsigned long integer, \a l, to the stream and returns a reference |
|
228 |
to the stream. |
|
229 |
*/ |
|
230 |
||
231 |
/*! |
|
232 |
\fn QDebug &QDebug::operator<<(qint64 i) |
|
233 |
||
234 |
Writes the signed 64-bit integer, \a i, to the stream and returns a reference |
|
235 |
to the stream. |
|
236 |
*/ |
|
237 |
||
238 |
/*! |
|
239 |
\fn QDebug &QDebug::operator<<(quint64 i) |
|
240 |
||
241 |
Writes then unsigned 64-bit integer, \a i, to the stream and returns a |
|
242 |
reference to the stream. |
|
243 |
*/ |
|
244 |
||
245 |
/*! |
|
246 |
\fn QDebug &QDebug::operator<<(float f) |
|
247 |
||
248 |
Writes the 32-bit floating point number, \a f, to the stream and returns a |
|
249 |
reference to the stream. |
|
250 |
*/ |
|
251 |
||
252 |
/*! |
|
253 |
\fn QDebug &QDebug::operator<<(double f) |
|
254 |
||
255 |
Writes the 64-bit floating point number, \a f, to the stream and returns a |
|
256 |
reference to the stream. |
|
257 |
*/ |
|
258 |
||
259 |
/*! |
|
260 |
\fn QDebug &QDebug::operator<<(const char *s) |
|
261 |
||
262 |
Writes the '\0'-terminated string, \a s, to the stream and returns a |
|
263 |
reference to the stream. |
|
264 |
*/ |
|
265 |
||
266 |
/*! |
|
267 |
\fn QDebug &QDebug::operator<<(const QString &s) |
|
268 |
||
269 |
Writes the string, \a s, to the stream and returns a reference to the stream. |
|
270 |
*/ |
|
271 |
||
272 |
/*! |
|
273 |
\fn QDebug &QDebug::operator<<(const QStringRef &s) |
|
274 |
||
275 |
Writes the string reference, \a s, to the stream and returns a reference to |
|
276 |
the stream. |
|
277 |
*/ |
|
278 |
||
279 |
/*! |
|
280 |
\fn QDebug &QDebug::operator<<(const QLatin1String &s) |
|
281 |
||
282 |
Writes the Latin1-encoded string, \a s, to the stream and returns a reference |
|
283 |
to the stream. |
|
284 |
*/ |
|
285 |
||
286 |
/*! |
|
287 |
\fn QDebug &QDebug::operator<<(const QByteArray &b) |
|
288 |
||
289 |
Writes the byte array, \a b, to the stream and returns a reference to the |
|
290 |
stream. |
|
291 |
*/ |
|
292 |
||
293 |
/*! |
|
294 |
\fn QDebug &QDebug::operator<<(const void *p) |
|
295 |
||
296 |
Writes a pointer, \a p, to the stream and returns a reference to the stream. |
|
297 |
*/ |
|
298 |
||
299 |
/*! |
|
300 |
\fn QDebug &QDebug::operator<<(QTextStreamFunction f) |
|
301 |
\internal |
|
302 |
*/ |
|
303 |
||
304 |
/*! |
|
305 |
\fn QDebug &QDebug::operator<<(QTextStreamManipulator m) |
|
306 |
\internal |
|
307 |
*/ |