Qt 4.8
Classes | Functions
qdebug.h File Reference
#include <QtCore/qalgorithms.h>
#include <QtCore/qhash.h>
#include <QtCore/qlist.h>
#include <QtCore/qmap.h>
#include <QtCore/qpair.h>
#include <QtCore/qtextstream.h>
#include <QtCore/qstring.h>
#include <QtCore/qvector.h>
#include <QtCore/qset.h>
#include <QtCore/qcontiguouscache.h>

Go to the source code of this file.

Classes

class  QDebug
 The QDebug class provides an output stream for debugging information. More...
 
struct  QDebug::Stream
 
class  QNoDebug
 

Functions

template<class T >
QDebug operator<< (QDebug debug, const QList< T > &list)
 
template<typename T >
QDebug operator<< (QDebug debug, const QVector< T > &vec)
 
template<class aKey , class aT >
QDebug operator<< (QDebug debug, const QMap< aKey, aT > &map)
 
template<class aKey , class aT >
QDebug operator<< (QDebug debug, const QHash< aKey, aT > &hash)
 
template<class T1 , class T2 >
QDebug operator<< (QDebug debug, const QPair< T1, T2 > &pair)
 
template<typename T >
QDebug operator<< (QDebug debug, const QSet< T > &set)
 
template<class T >
QDebug operator<< (QDebug debug, const QContiguousCache< T > &cache)
 
template<class T >
QDebug operator<< (QDebug debug, const QFlags< T > &flags)
 
Q_CORE_EXPORT_INLINE QDebug qCritical ()
 
Q_CORE_EXPORT_INLINE QDebug qDebug ()
 
Q_CORE_EXPORT_INLINE QDebug qWarning ()
 

Function Documentation

◆ operator<<() [1/8]

template<class T >
QDebug operator<< ( QDebug  debug,
const QList< T > &  list 
)
inline

Definition at line 160 of file qdebug.h.

Referenced by operator<<().

162 {
163  debug.nospace() << '(';
164  for (Q_TYPENAME QList<T>::size_type i = 0; i < list.count(); ++i) {
165  if (i)
166  debug << ", ";
167  debug << list.at(i);
168  }
169  debug << ')';
170  return debug.space();
171 }
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
int size_type
Typedef for int.
Definition: qlist.h:305
#define Q_TYPENAME
Definition: qglobal.h:1717
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91

◆ operator<<() [2/8]

template<typename T >
QDebug operator<< ( QDebug  debug,
const QVector< T > &  vec 
)
inline

Definition at line 178 of file qdebug.h.

180 {
181  debug.nospace() << "QVector";
182  return operator<<(debug, vec.toList());
183 }
QList< T > toList() const
Returns a QList object with the data contained in this QVector.
Definition: qvector.h:770
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
QDataStream & operator<<(QDataStream &out, const QUrl &url)
Writes url url to the stream out and returns a reference to the stream.
Definition: qurl.cpp:6757

◆ operator<<() [3/8]

template<class aKey , class aT >
QDebug operator<< ( QDebug  debug,
const QMap< aKey, aT > &  map 
)
inline

Definition at line 190 of file qdebug.h.

192 {
193  debug.nospace() << "QMap(";
194  for (typename QMap<aKey, aT>::const_iterator it = map.constBegin();
195  it != map.constEnd(); ++it) {
196  debug << '(' << it.key() << ", " << it.value() << ')';
197  }
198  debug << ')';
199  return debug.space();
200 }
#define it(className, varName)
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the map.
Definition: qmap.h:374
The QMap::const_iterator class provides an STL-style const iterator for QMap and QMultiMap.
Definition: qmap.h:301
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the map...
Definition: qmap.h:380
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91

◆ operator<<() [4/8]

template<class aKey , class aT >
QDebug operator<< ( QDebug  debug,
const QHash< aKey, aT > &  hash 
)
inline

Definition at line 207 of file qdebug.h.

209 {
210  debug.nospace() << "QHash(";
211  for (typename QHash<aKey, aT>::const_iterator it = hash.constBegin();
212  it != hash.constEnd(); ++it)
213  debug << '(' << it.key() << ", " << it.value() << ')';
214  debug << ')';
215  return debug.space();
216 }
The QHash::const_iterator class provides an STL-style const iterator for QHash and QMultiHash...
Definition: qhash.h:395
#define it(className, varName)
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the hash.
Definition: qhash.h:466
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:469
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91

◆ operator<<() [5/8]

template<class T1 , class T2 >
QDebug operator<< ( QDebug  debug,
const QPair< T1, T2 > &  pair 
)
inline

Definition at line 223 of file qdebug.h.

225 {
226  debug.nospace() << "QPair(" << pair.first << ',' << pair.second << ')';
227  return debug.space();
228 }
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
T1 first
Definition: qpair.h:65
T2 second
Definition: qpair.h:66
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91

◆ operator<<() [6/8]

template<typename T >
QDebug operator<< ( QDebug  debug,
const QSet< T > &  set 
)
inline

Definition at line 231 of file qdebug.h.

232 {
233  debug.nospace() << "QSet";
234  return operator<<(debug, set.toList());
235 }
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
static QList< QVariant > toList(char **buf, int count, T *=0)
Definition: qsql_ibase.cpp:472
QDataStream & operator<<(QDataStream &out, const QUrl &url)
Writes url url to the stream out and returns a reference to the stream.
Definition: qurl.cpp:6757

◆ operator<<() [7/8]

template<class T >
QDebug operator<< ( QDebug  debug,
const QContiguousCache< T > &  cache 
)
inline

Definition at line 242 of file qdebug.h.

244 {
245  debug.nospace() << "QContiguousCache(";
246  for (int i = cache.firstIndex(); i <= cache.lastIndex(); ++i) {
247  debug << cache[i];
248  if (i != cache.lastIndex())
249  debug << ", ";
250  }
251  debug << ')';
252  return debug.space();
253 }
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
int firstIndex() const
Returns the first valid index in the cache.
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91
int lastIndex() const
Returns the last valid index in the cache.

◆ operator<<() [8/8]

template<class T >
QDebug operator<< ( QDebug  debug,
const QFlags< T > &  flags 
)
inline

Definition at line 260 of file qdebug.h.

262 {
263  debug.nospace() << "QFlags(";
264  bool needSeparator = false;
265  for (uint i = 0; i < sizeof(T) * 8; ++i) {
266  if (flags.testFlag(T(1 << i))) {
267  if (needSeparator)
268  debug.nospace() << '|';
269  else
270  needSeparator = true;
271  debug.nospace() << "0x" << QByteArray::number(T(1 << i), 16).constData();
272  }
273  }
274  debug << ')';
275  return debug.space();
276 }
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
bool testFlag(Enum f) const
Returns true if the flag is set, otherwise false.
Definition: qglobal.h:2345
unsigned int uint
Definition: qglobal.h:996
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91
static QByteArray number(int, int base=10)
Returns a byte array containing the string equivalent of the number n to base base (10 by default)...

◆ qCritical()

Definition at line 144 of file qdebug.h.

144 { return QDebug(QtCriticalMsg); }
The QDebug class provides an output stream for debugging information.
Definition: qdebug.h:62

◆ qDebug()

Definition at line 279 of file qdebug.h.

279 { return QDebug(QtDebugMsg); }
The QDebug class provides an output stream for debugging information.
Definition: qdebug.h:62

◆ qWarning()

Definition at line 289 of file qdebug.h.

289 { return QDebug(QtWarningMsg); }
The QDebug class provides an output stream for debugging information.
Definition: qdebug.h:62