forked from qt-creator/qt-creator
Merge branch 'master' of git://scm.dev.nokia.troll.no/creator/mainline into make_install/master
This commit is contained in:
@@ -36,24 +36,42 @@
|
||||
// this relies on contents copied from qobject_p.h
|
||||
#define PRIVATE_OBJECT_ALLOWED 1
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QHash>
|
||||
#include <QLinkedList>
|
||||
#include <QLocale>
|
||||
#include <QMap>
|
||||
#include <QMetaObject>
|
||||
#include <QMetaProperty>
|
||||
#include <QModelIndex>
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
#include <QString>
|
||||
#include <QTextCodec>
|
||||
#include <QVector>
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QLinkedList>
|
||||
#include <QtCore/QLocale>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QMetaObject>
|
||||
#include <QtCore/QMetaProperty>
|
||||
#include <QtCore/QModelIndex>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QTextCodec>
|
||||
#include <QtCore/QVector>
|
||||
|
||||
int qtGhVersion = QT_VERSION;
|
||||
|
||||
#ifdef QT_GUI_LIB
|
||||
# include <QtGui/QPixmap>
|
||||
# include <QtGui/QImage>
|
||||
#endif
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\class QDumper
|
||||
@@ -91,7 +109,7 @@
|
||||
|
||||
|
||||
'P(d, name, value)' roughly expands to:
|
||||
d << (name) << "=\"" << value << "\"";
|
||||
d << (name) << "='" << value << "'";
|
||||
|
||||
Useful (i.e. understood by the IDE) names include:
|
||||
|
||||
@@ -117,25 +135,6 @@
|
||||
|
||||
*/
|
||||
|
||||
int qtGhVersion = QT_VERSION;
|
||||
|
||||
#ifdef QT_GUI_LIB
|
||||
# include <QPixmap>
|
||||
# include <QImage>
|
||||
#endif
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#undef NS
|
||||
#ifdef QT_NAMESPACE
|
||||
# define STRINGIFY0(s) #s
|
||||
@@ -216,7 +215,8 @@ QT_END_NAMESPACE
|
||||
// this can be mangled typenames of nested templates, each char-by-char
|
||||
// comma-separated integer list
|
||||
static char qDumpInBuffer[10000];
|
||||
static char qDumpBuffer[1000];
|
||||
static char qDumpOutBuffer[100000];
|
||||
static char qDumpSize[20];
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -385,7 +385,6 @@ struct QDumper
|
||||
{
|
||||
explicit QDumper();
|
||||
~QDumper();
|
||||
void flush();
|
||||
void checkFill();
|
||||
QDumper &operator<<(long c);
|
||||
QDumper &operator<<(int i);
|
||||
@@ -407,8 +406,6 @@ struct QDumper
|
||||
void beginHash(); // start of data hash output
|
||||
void endHash(); // start of data hash output
|
||||
|
||||
void write(const void *buf, int len); // raw write to stdout
|
||||
|
||||
// the dumper arguments
|
||||
int protocolVersion; // dumper protocol version
|
||||
int token; // some token to show on success
|
||||
@@ -427,6 +424,7 @@ struct QDumper
|
||||
|
||||
// internal state
|
||||
bool success; // are we finished?
|
||||
bool full;
|
||||
int pos;
|
||||
|
||||
int extraInt[4];
|
||||
@@ -436,34 +434,16 @@ struct QDumper
|
||||
QDumper::QDumper()
|
||||
{
|
||||
success = false;
|
||||
pos = 0;
|
||||
full = false;
|
||||
qDumpOutBuffer[0] = 'f'; // marks output as 'wrong'
|
||||
pos = 1;
|
||||
}
|
||||
|
||||
QDumper::~QDumper()
|
||||
{
|
||||
flush();
|
||||
|
||||
char buf[30];
|
||||
int len = qsnprintf(buf, sizeof(buf) - 1, "%d^done\n", token);
|
||||
write(buf, len);
|
||||
}
|
||||
|
||||
void QDumper::write(const void *buf, int len)
|
||||
{
|
||||
::fwrite(buf, len, 1, stdout);
|
||||
::fflush(stdout);
|
||||
}
|
||||
|
||||
void QDumper::flush()
|
||||
{
|
||||
if (pos != 0) {
|
||||
char buf[30];
|
||||
int len = qsnprintf(buf, sizeof(buf) - 1, "%d#%d,", token, pos);
|
||||
write(buf, len);
|
||||
write(qDumpBuffer, pos);
|
||||
write("\n", 1);
|
||||
pos = 0;
|
||||
}
|
||||
qDumpOutBuffer[pos++] = '\0';
|
||||
if (success)
|
||||
qDumpOutBuffer[0] = (full ? '+' : 't');
|
||||
}
|
||||
|
||||
void QDumper::setupTemplateParameters()
|
||||
@@ -489,49 +469,49 @@ void QDumper::setupTemplateParameters()
|
||||
QDumper &QDumper::operator<<(unsigned long long c)
|
||||
{
|
||||
checkFill();
|
||||
pos += sprintf(qDumpBuffer + pos, "%llu", c);
|
||||
pos += sprintf(qDumpOutBuffer + pos, "%llu", c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::operator<<(unsigned long c)
|
||||
{
|
||||
checkFill();
|
||||
pos += sprintf(qDumpBuffer + pos, "%lu", c);
|
||||
pos += sprintf(qDumpOutBuffer + pos, "%lu", c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::operator<<(float d)
|
||||
{
|
||||
checkFill();
|
||||
pos += sprintf(qDumpBuffer + pos, "%f", d);
|
||||
pos += sprintf(qDumpOutBuffer + pos, "%f", d);
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::operator<<(double d)
|
||||
{
|
||||
checkFill();
|
||||
pos += sprintf(qDumpBuffer + pos, "%f", d);
|
||||
pos += sprintf(qDumpOutBuffer + pos, "%f", d);
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::operator<<(unsigned int i)
|
||||
{
|
||||
checkFill();
|
||||
pos += sprintf(qDumpBuffer + pos, "%u", i);
|
||||
pos += sprintf(qDumpOutBuffer + pos, "%u", i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::operator<<(long c)
|
||||
{
|
||||
checkFill();
|
||||
pos += sprintf(qDumpBuffer + pos, "%ld", c);
|
||||
pos += sprintf(qDumpOutBuffer + pos, "%ld", c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::operator<<(int i)
|
||||
{
|
||||
checkFill();
|
||||
pos += sprintf(qDumpBuffer + pos, "%d", i);
|
||||
pos += sprintf(qDumpOutBuffer + pos, "%d", i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -555,22 +535,23 @@ QDumper &QDumper::operator<<(const void *p)
|
||||
|
||||
void QDumper::checkFill()
|
||||
{
|
||||
if (pos >= int(sizeof(qDumpBuffer)) - 100)
|
||||
flush();
|
||||
if (pos >= int(sizeof(qDumpOutBuffer)) - 100)
|
||||
full = true;
|
||||
}
|
||||
|
||||
void QDumper::put(char c)
|
||||
{
|
||||
checkFill();
|
||||
qDumpBuffer[pos++] = c;
|
||||
if (!full)
|
||||
qDumpOutBuffer[pos++] = c;
|
||||
}
|
||||
|
||||
void QDumper::addCommaIfNeeded()
|
||||
{
|
||||
if (pos == 0)
|
||||
return;
|
||||
char c = qDumpBuffer[pos - 1];
|
||||
if (c == '}' || c == '"' || c == ']')
|
||||
char c = qDumpOutBuffer[pos - 1];
|
||||
if (c == '}' || c == '\'' || c == ']')
|
||||
put(',');
|
||||
}
|
||||
|
||||
@@ -632,7 +613,6 @@ QDumper &QDumper::operator<<(const QString &str)
|
||||
|
||||
void QDumper::disarm()
|
||||
{
|
||||
flush();
|
||||
success = true;
|
||||
}
|
||||
|
||||
@@ -650,7 +630,7 @@ void QDumper::endHash()
|
||||
void QDumper::putEllipsis()
|
||||
{
|
||||
addCommaIfNeeded();
|
||||
*this << "{name=\"<incomplete>\",value=\"\",type=\"" << innertype << "\"}";
|
||||
*this << "{name='<incomplete>',value='',type='" << innertype << "'}";
|
||||
}
|
||||
|
||||
//
|
||||
@@ -662,7 +642,7 @@ void QDumper::putEllipsis()
|
||||
#define P(dumper,name,value) \
|
||||
do { \
|
||||
dumper.addCommaIfNeeded(); \
|
||||
dumper << (name) << "=\"" << value << "\""; \
|
||||
dumper << (name) << "='" << value << "'"; \
|
||||
} while (0)
|
||||
|
||||
// simple string property
|
||||
@@ -760,7 +740,7 @@ static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr
|
||||
return;
|
||||
case 'B':
|
||||
if (isEqual(type, "QByteArray")) {
|
||||
d << key << "encoded=\"1\",";
|
||||
d << key << "encoded='1',";
|
||||
P(d, key, *(QByteArray*)addr);
|
||||
}
|
||||
return;
|
||||
@@ -789,7 +769,7 @@ static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr
|
||||
return;
|
||||
case 'S':
|
||||
if (isEqual(type, "QString")) {
|
||||
d << key << "encoded=\"1\",";
|
||||
d << key << "encoded='1',";
|
||||
P(d, key, *(QString*)addr);
|
||||
}
|
||||
return;
|
||||
@@ -856,7 +836,7 @@ static void qDumpQByteArray(QDumper &d)
|
||||
char buf[20];
|
||||
for (int i = 0; i != ba.size(); ++i) {
|
||||
unsigned char c = ba.at(i);
|
||||
unsigned char u = isprint(c) && c != '"' ? c : '?';
|
||||
unsigned char u = (isprint(c) && c != '\'' && c != '"') ? c : '?';
|
||||
sprintf(buf, "%02x (%u '%c')", c, c, u);
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << i << "]");
|
||||
@@ -2028,7 +2008,7 @@ static void qDumpQVariantHelper(const void *data, QString *value,
|
||||
*numchild = 0;
|
||||
break;
|
||||
case QVariant::String:
|
||||
*value = QLatin1Char('"') + v.toString() + QLatin1Char('"');
|
||||
*value = QLatin1Char('\'') + v.toString() + QLatin1Char('\'');
|
||||
*numchild = 0;
|
||||
break;
|
||||
case QVariant::StringList:
|
||||
@@ -2260,9 +2240,9 @@ static void qDumpStdString(QDumper &d)
|
||||
qCheckAccess(str.c_str() + str.size() - 1);
|
||||
}
|
||||
|
||||
d << ",value=\"";
|
||||
d << ",value='";
|
||||
d.putBase64Encoded(str.c_str(), str.size());
|
||||
d << "\"";
|
||||
d << "'";
|
||||
P(d, "valueencoded", "1");
|
||||
P(d, "type", "std::string");
|
||||
P(d, "numchild", "0");
|
||||
@@ -2279,9 +2259,9 @@ static void qDumpStdWString(QDumper &d)
|
||||
qCheckAccess(str.c_str() + str.size() - 1);
|
||||
}
|
||||
|
||||
d << "value=\"";
|
||||
d << "value='";
|
||||
d.putBase64Encoded((const char *)str.c_str(), str.size() * sizeof(wchar_t));
|
||||
d << "\"";
|
||||
d << "'";
|
||||
P(d, "valueencoded", (sizeof(wchar_t) == 2 ? "2" : "3"));
|
||||
P(d, "type", "std::wstring");
|
||||
P(d, "numchild", "0");
|
||||
@@ -2502,54 +2482,54 @@ void qDumpObjectData440(
|
||||
// They are mentioned here nevertheless. For types that not listed
|
||||
// here, dumpers won't be used.
|
||||
d << "dumpers=["
|
||||
"\""NS"QByteArray\","
|
||||
"\""NS"QDateTime\","
|
||||
"\""NS"QDir\","
|
||||
"\""NS"QFile\","
|
||||
"\""NS"QFileInfo\","
|
||||
"\""NS"QHash\","
|
||||
"\""NS"QHashNode\","
|
||||
"\""NS"QImage\","
|
||||
"\""NS"QLinkedList\","
|
||||
"\""NS"QList\","
|
||||
"\""NS"QLocale\","
|
||||
"\""NS"QMap\","
|
||||
"\""NS"QMapNode\","
|
||||
"\""NS"QModelIndex\","
|
||||
"'"NS"QByteArray',"
|
||||
"'"NS"QDateTime',"
|
||||
"'"NS"QDir',"
|
||||
"'"NS"QFile',"
|
||||
"'"NS"QFileInfo',"
|
||||
"'"NS"QHash',"
|
||||
"'"NS"QHashNode',"
|
||||
"'"NS"QImage',"
|
||||
"'"NS"QLinkedList',"
|
||||
"'"NS"QList',"
|
||||
"'"NS"QLocale',"
|
||||
"'"NS"QMap',"
|
||||
"'"NS"QMapNode',"
|
||||
"'"NS"QModelIndex',"
|
||||
#if QT_VERSION >= 0x040500
|
||||
"\""NS"QMultiMap\","
|
||||
"'"NS"QMultiMap',"
|
||||
#endif
|
||||
"\""NS"QObject\","
|
||||
"\""NS"QObjectMethodList\"," // hack to get nested properties display
|
||||
"\""NS"QObjectPropertyList\","
|
||||
"'"NS"QObject',"
|
||||
"'"NS"QObjectMethodList'," // hack to get nested properties display
|
||||
"'"NS"QObjectPropertyList',"
|
||||
#if PRIVATE_OBJECT_ALLOWED
|
||||
"\""NS"QObjectSignal\","
|
||||
"\""NS"QObjectSignalList\","
|
||||
"\""NS"QObjectSlot\","
|
||||
"\""NS"QObjectSlotList\","
|
||||
"'"NS"QObjectSignal',"
|
||||
"'"NS"QObjectSignalList',"
|
||||
"'"NS"QObjectSlot',"
|
||||
"'"NS"QObjectSlotList',"
|
||||
#endif // PRIVATE_OBJECT_ALLOWED
|
||||
// << "\""NS"QRegion\","
|
||||
"\""NS"QSet\","
|
||||
"\""NS"QString\","
|
||||
"\""NS"QStringList\","
|
||||
"\""NS"QTextCodec\","
|
||||
"\""NS"QVariant\","
|
||||
"\""NS"QVector\","
|
||||
"\""NS"QWidget\","
|
||||
"\"string\","
|
||||
"\"wstring\","
|
||||
"\"std::basic_string\","
|
||||
"\"std::list\","
|
||||
"\"std::map\","
|
||||
"\"std::string\","
|
||||
"\"std::vector\","
|
||||
"\"std::wstring\","
|
||||
// << "'"NS"QRegion',"
|
||||
"'"NS"QSet',"
|
||||
"'"NS"QString',"
|
||||
"'"NS"QStringList',"
|
||||
"'"NS"QTextCodec',"
|
||||
"'"NS"QVariant',"
|
||||
"'"NS"QVector',"
|
||||
"'"NS"QWidget',"
|
||||
"'string',"
|
||||
"'wstring',"
|
||||
"'std::basic_string',"
|
||||
"'std::list',"
|
||||
"'std::map',"
|
||||
"'std::string',"
|
||||
"'std::vector',"
|
||||
"'std::wstring',"
|
||||
"]";
|
||||
d << ",qtversion=["
|
||||
"\"" << ((QT_VERSION >> 16) & 255) << "\","
|
||||
"\"" << ((QT_VERSION >> 8) & 255) << "\","
|
||||
"\"" << ((QT_VERSION) & 255) << "\"]";
|
||||
d << ",namespace=\""NS"\"";
|
||||
"'" << ((QT_VERSION >> 16) & 255) << "',"
|
||||
"'" << ((QT_VERSION >> 8) & 255) << "',"
|
||||
"'" << ((QT_VERSION) & 255) << "']";
|
||||
d << ",namespace='"NS"'";
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user