forked from qt-creator/qt-creator
add custom dumpers for std::list
This commit is contained in:
@@ -402,18 +402,30 @@ bool WatchHandler::setData(const QModelIndex &idx,
|
||||
static QString niceType(QString type)
|
||||
{
|
||||
if (type.contains("std::")) {
|
||||
static QRegExp re("std::vector<(.*)\\s*,std::allocator<(.*)>\\s*>");
|
||||
re.setMinimal(true);
|
||||
|
||||
// std::string
|
||||
type.replace("std::basic_string<char, std::char_traits<char>, "
|
||||
"std::allocator<char> >", "std::string");
|
||||
|
||||
// std::wstring
|
||||
type.replace("std::basic_string<wchar_t, std::char_traits<wchar_t>, "
|
||||
"std::allocator<wchar_t> >", "std::wstring");
|
||||
|
||||
// std::vector
|
||||
static QRegExp re1("std::vector<(.*)\\s*,std::allocator<(.*)>\\s*>");
|
||||
re1.setMinimal(true);
|
||||
for (int i = 0; i != 10; ++i) {
|
||||
if (re.indexIn(type) == -1 || re.cap(1) != re.cap(2))
|
||||
if (re1.indexIn(type) == -1 || re1.cap(1) != re1.cap(2))
|
||||
break;
|
||||
type.replace(re.cap(0), "std::vector<" + re.cap(1) + ">");
|
||||
type.replace(re1.cap(0), "std::vector<" + re1.cap(1) + ">");
|
||||
}
|
||||
|
||||
// std::list
|
||||
static QRegExp re2("std::list<(.*)\\s*,std::allocator<(.*)>\\s*>");
|
||||
re2.setMinimal(true);
|
||||
for (int i = 0; i != 10; ++i) {
|
||||
if (re2.indexIn(type) == -1 || re2.cap(1) != re2.cap(2))
|
||||
break;
|
||||
type.replace(re2.cap(0), "std::list<" + re2.cap(1) + ">");
|
||||
}
|
||||
|
||||
type.replace(" >", ">");
|
||||
|
||||
Reference in New Issue
Block a user