debugger: make format for all integer types selectable

This commit is contained in:
hjk
2009-07-03 13:25:51 +02:00
parent ab4348ff4a
commit 89d49e3b20
3 changed files with 13 additions and 5 deletions

View File

@@ -482,7 +482,7 @@ QString niceType(QString type)
static QString formattedValue(const WatchData &data,
int individualFormat, int typeFormat)
{
if (data.type == "int") {
if (isIntType(data.type)) {
int format = individualFormat == -1 ? typeFormat : individualFormat;
int value = data.value.toInt();
if (format == 1)
@@ -649,7 +649,7 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
return true;
case TypeFormatListRole:
if (data.type == "int")
if (isIntType(data.type))
return QStringList() << tr("decimal") << tr("hexadecimal")
<< tr("binary") << tr("octal");
break;

View File

@@ -305,18 +305,25 @@ QString extractTypeFromPTypeOutput(const QString &str)
return res.simplified();
}
bool isIntOrFloatType(const QString &type)
bool isIntType(const QString &type)
{
static const QStringList types = QStringList()
<< QLatin1String("char") << QLatin1String("int") << QLatin1String("short")
<< QLatin1String("float") << QLatin1String("double") << QLatin1String("long")
<< QLatin1String("bool") << QLatin1String("signed char") << QLatin1String("unsigned")
<< QLatin1String("long") << QLatin1String("bool")
<< QLatin1String("signed char") << QLatin1String("unsigned")
<< QLatin1String("unsigned char")
<< QLatin1String("unsigned int") << QLatin1String("unsigned long")
<< QLatin1String("long long") << QLatin1String("unsigned long long");
return types.contains(type);
}
bool isIntOrFloatType(const QString &type)
{
static const QStringList types = QStringList()
<< QLatin1String("float") << QLatin1String("double");
return isIntType(type) || types.contains(type);
}
QString sizeofTypeExpression(const QString &type)
{
if (type.endsWith(QLatin1Char('*')))

View File

@@ -72,6 +72,7 @@ QString gdbQuoteTypes(const QString &type);
bool extractTemplate(const QString &type, QString *tmplate, QString *inner);
QString extractTypeFromPTypeOutput(const QString &str);
bool isIntOrFloatType(const QString &type);
bool isIntType(const QString &type);
QString sizeofTypeExpression(const QString &type);
QString quoteUnprintableLatin1(const QByteArray &ba);