Commit 06f35cbb authored by hjk's avatar hjk

Debugger: Split type simplification into file of its own

This still needs to use a proper parser at some time.

Change-Id: Ia0afe593dd9dc32f22f80adb7232c04f4db79cf6
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 846ee38f
......@@ -72,7 +72,8 @@ HEADERS += \
debuggersourcepathmappingwidget.h \
memoryview.h \
localsandexpressionswindow.h \
imageviewer.h
imageviewer.h \
simplifytype.h
SOURCES += \
basewindow.cpp \
......@@ -127,7 +128,8 @@ SOURCES += \
debuggersourcepathmappingwidget.cpp \
memoryview.cpp \
localsandexpressionswindow.cpp \
imageviewer.cpp
imageviewer.cpp \
simplifytype.cpp
FORMS += \
localsandexpressionsoptionspage.ui
......
......@@ -88,6 +88,7 @@ QtcPlugin {
"watchhandler.cpp", "watchhandler.h",
"watchutils.cpp", "watchutils.h",
"watchwindow.cpp", "watchwindow.h",
"simplifytype.cpp", "simplifytype.h",
]
}
......
This diff is collapsed.
......@@ -221,11 +221,6 @@ enum DebuggerDisplay {
// Decode string data as returned by the dumper helpers.
QString decodeData(const QByteArray &baIn, int encoding);
// Simplify complicated STL template types, such as
// 'std::basic_string<char,std::char_traits<char>,std::allocator<char> > '->
// 'std::string'.
QString simplifySTLType(const QString &typeIn);
} // namespace Internal
} // namespace Debugger
......
This diff is collapsed.
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef DEBUGGER_SIMPLIFY_TYPE_H
#define DEBUGGER_SIMPLIFY_TYPE_H
#include <QString>
namespace Debugger {
namespace Internal {
// Simplify complicated STL template types, such as
// 'std::basic_string<char,std::char_traits<char>,std::allocator<char> > '->
// 'std::string'.
QString simplifyType(const QString &typeIn);
} // namespace Internal
} // namespace Debugger
#endif // DEBUGGER_SIMPLIFY_TYPE_H
......@@ -36,6 +36,7 @@
#include "debuggerengine.h"
#include "debuggerinternalconstants.h"
#include "debuggerprotocol.h"
#include "simplifytype.h"
#include "imageviewer.h"
#include "watchutils.h"
......@@ -477,7 +478,7 @@ static QString niceTypeHelper(const QByteArray &typeIn)
const Cache::const_iterator it = cache.constFind(typeIn);
if (it != cache.constEnd())
return it.value();
const QString simplified = simplifySTLType(QLatin1String(typeIn));
const QString simplified = simplifyType(QLatin1String(typeIn));
cache.insert(typeIn, simplified); // For simplicity, also cache unmodified types
return simplified;
}
......
......@@ -23,12 +23,14 @@ include($$IDE_SOURCE_TREE/src/rpath.pri)
SOURCES += \
$$DEBUGGERDIR/debuggerprotocol.cpp \
$$DEBUGGERDIR/simplifytype.cpp \
$$DEBUGGERDIR/watchdata.cpp \
$$DEBUGGERDIR/watchutils.cpp \
tst_dumpers.cpp
HEADERS += \
$$DEBUGGERDIR/debuggerprotocol.h \
$$DEBUGGERDIR/simplifytype.h \
$$DEBUGGERDIR/watchdata.h \
$$DEBUGGERDIR/watchutils.h \
temporarydir.h
......
......@@ -9,4 +9,4 @@ INCLUDEPATH += $$DEBUGGERDIR
SOURCES += \
tst_simplifytypes.cpp \
$$DEBUGGERDIR/debuggerprotocol.cpp \
$$DEBUGGERDIR/simplifytype.cpp \
......@@ -28,6 +28,7 @@
****************************************************************************/
#include "debuggerprotocol.h"
#include "simplifytype.h"
#include "watchdata.h"
#include "watchutils.h"
......@@ -348,7 +349,7 @@ struct Type
}
}
QByteArray actualType =
simplifySTLType(QString::fromLatin1(actualType0)).toLatin1();
simplifyType(QString::fromLatin1(actualType0)).toLatin1();
actualType.replace(' ', "");
actualType.replace("const", "");
QByteArray expectedType = type;
......
......@@ -27,7 +27,7 @@
**
****************************************************************************/
#include "debuggerprotocol.h"
#include "simplifytype.h"
#include <QString>
#include <QtTest>
......@@ -154,7 +154,7 @@ void SimplifyTypesTest::test()
{
QFETCH(QString, input);
QFETCH(QString, expected);
const QString output = simplifySTLType(input);
const QString output = simplifyType(input);
QCOMPARE(output, expected);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment