debugger: make a 'type' a QByteArray, not a QString

Saves lots of conversion.
This commit is contained in:
hjk
2010-09-01 17:36:09 +02:00
parent d875ad4ebe
commit 4cbbe366af
15 changed files with 266 additions and 257 deletions

View File

@@ -68,7 +68,7 @@ void WatchData::setValue(const QString &value0)
hasChildren = true; // at least one...
}
// strip off quoted characters for chars.
if (value.endsWith(QLatin1Char('\'')) && type.endsWith(QLatin1String("char"))) {
if (value.endsWith(QLatin1Char('\'')) && type.endsWith("char")) {
const int blankPos = value.indexOf(QLatin1Char(' '));
if (blankPos != -1)
value.truncate(blankPos);
@@ -105,26 +105,26 @@ void WatchData::setValueToolTip(const QString &tooltip)
valuetooltip = tooltip;
}
void WatchData::setType(const QString &str, bool guessChildrenFromType)
void WatchData::setType(const QByteArray &str, bool guessChildrenFromType)
{
type = str.trimmed();
bool changed = true;
while (changed) {
if (type.endsWith(QLatin1String("const")))
if (type.endsWith("const"))
type.chop(5);
else if (type.endsWith(QLatin1Char(' ')))
else if (type.endsWith(' '))
type.chop(1);
else if (type.endsWith(QLatin1Char('&')))
else if (type.endsWith('&'))
type.chop(1);
else if (type.startsWith(QLatin1String("const ")))
else if (type.startsWith("const "))
type = type.mid(6);
else if (type.startsWith(QLatin1String("volatile ")))
else if (type.startsWith("volatile "))
type = type.mid(9);
else if (type.startsWith(QLatin1String("class ")))
else if (type.startsWith("class "))
type = type.mid(6);
else if (type.startsWith(QLatin1String("struct ")))
else if (type.startsWith("struct "))
type = type.mid(6);
else if (type.startsWith(QLatin1Char(' ')))
else if (type.startsWith(' '))
type = type.mid(1);
else
changed = false;