#include "printQtTypes.h" void PrintTo(const QString& str, ::std::ostream* os) { *os << "\"" << str.toStdString() << "\""; } void PrintTo(const QStringList& list, ::std::ostream* os) { *os << "(" << list.join(", ").toStdString() << ")"; } void PrintTo(const QDateTime& time, ::std::ostream* os) { *os << time.toString("yyyy-MM-dd HH:mm:ss").toStdString(); } void PrintTo(const QByteArray& array, ::std::ostream* os) { *os << "\""; const char* hex = array.toHex().constData(); for(int i = 0; i < array.size(); i++) { unsigned char ch = array.constData()[i]; if(ch >= 32 && ch <= 126) *os << ch; else *os << "\\x" << hex[i * 2] << hex[i * 2 + 1] << " "; } *os << "\""; }