forked from qt-creator/qt-creator
Merge branch '0.9.1-beta' of git@scm.dev.nokia.troll.no:creator/mainline into 0.9.1-beta
This commit is contained in:
@@ -411,7 +411,7 @@ static QString niceType(QString type)
|
|||||||
"std::allocator<wchar_t> >", "std::wstring");
|
"std::allocator<wchar_t> >", "std::wstring");
|
||||||
|
|
||||||
// std::vector
|
// std::vector
|
||||||
static QRegExp re1("std::vector<(.*)\\s*,std::allocator<(.*)>\\s*>");
|
static QRegExp re1("std::vector<(.*), std::allocator<(.*)>\\s*>");
|
||||||
re1.setMinimal(true);
|
re1.setMinimal(true);
|
||||||
for (int i = 0; i != 10; ++i) {
|
for (int i = 0; i != 10; ++i) {
|
||||||
if (re1.indexIn(type) == -1 || re1.cap(1) != re1.cap(2))
|
if (re1.indexIn(type) == -1 || re1.cap(1) != re1.cap(2))
|
||||||
@@ -420,7 +420,7 @@ static QString niceType(QString type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// std::list
|
// std::list
|
||||||
static QRegExp re2("std::list<(.*)\\s*,std::allocator<(.*)>\\s*>");
|
static QRegExp re2("std::list<(.*), std::allocator<(.*)>\\s*>");
|
||||||
re2.setMinimal(true);
|
re2.setMinimal(true);
|
||||||
for (int i = 0; i != 10; ++i) {
|
for (int i = 0; i != 10; ++i) {
|
||||||
if (re2.indexIn(type) == -1 || re2.cap(1) != re2.cap(2))
|
if (re2.indexIn(type) == -1 || re2.cap(1) != re2.cap(2))
|
||||||
@@ -428,6 +428,17 @@ static QString niceType(QString type)
|
|||||||
type.replace(re2.cap(0), "std::list<" + re2.cap(1) + ">");
|
type.replace(re2.cap(0), "std::list<" + re2.cap(1) + ">");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// std::map
|
||||||
|
static QRegExp re3("std::map<(.*), (.*), std::less<(.*)\\s*>, "
|
||||||
|
"std::allocator<std::pair<const (.*), (.*)\\s*> > >");
|
||||||
|
re3.setMinimal(true);
|
||||||
|
for (int i = 0; i != 10; ++i) {
|
||||||
|
if (re3.indexIn(type) == -1 || re3.cap(1) != re3.cap(3)
|
||||||
|
|| re3.cap(1) != re3.cap(4) || re3.cap(2) != re3.cap(5))
|
||||||
|
break;
|
||||||
|
type.replace(re3.cap(0), "std::map<" + re3.cap(1) + ", " + re3.cap(2) + ">");
|
||||||
|
}
|
||||||
|
|
||||||
type.replace(" >", ">");
|
type.replace(" >", ">");
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
#include <QtNetwork/QHostAddress>
|
#include <QtNetwork/QHostAddress>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <map>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -131,7 +132,6 @@ void testArray()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void testQByteArray()
|
void testQByteArray()
|
||||||
{
|
{
|
||||||
QByteArray ba = "Hello";
|
QByteArray ba = "Hello";
|
||||||
@@ -142,7 +142,6 @@ void testQByteArray()
|
|||||||
ba += 2;
|
ba += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void testQHash()
|
void testQHash()
|
||||||
{
|
{
|
||||||
QHash<int, float> hgg0;
|
QHash<int, float> hgg0;
|
||||||
@@ -412,6 +411,41 @@ void testStdList()
|
|||||||
vec.push_back(false);
|
vec.push_back(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void testStdMap()
|
||||||
|
{
|
||||||
|
std::map<uint, QStringList> ggl;
|
||||||
|
ggl[11] = QStringList() << "11";
|
||||||
|
ggl[22] = QStringList() << "22";
|
||||||
|
|
||||||
|
typedef std::map<uint, QStringList> T;
|
||||||
|
T ggt;
|
||||||
|
ggt[11] = QStringList() << "11";
|
||||||
|
ggt[22] = QStringList() << "22";
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
std::map<uint, float> gg0;
|
||||||
|
gg0[11] = 11.0;
|
||||||
|
gg0[22] = 22.0;
|
||||||
|
|
||||||
|
|
||||||
|
std::map<QString, float> gg1;
|
||||||
|
gg1["22.0"] = 22.0;
|
||||||
|
|
||||||
|
std::map<int, QString> gg2;
|
||||||
|
gg2[22] = "22.0";
|
||||||
|
|
||||||
|
std::map<QString, Foo> gg3;
|
||||||
|
gg3["22.0"] = Foo(22);
|
||||||
|
gg3["33.0"] = Foo(33);
|
||||||
|
|
||||||
|
QObject ob;
|
||||||
|
std::map<QString, QPointer<QObject> > map;
|
||||||
|
map.insert("Hallo", QPointer<QObject>(&ob));
|
||||||
|
map.insert("Welt", QPointer<QObject>(&ob));
|
||||||
|
map.insert(".", QPointer<QObject>(&ob));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void testStdStack()
|
void testStdStack()
|
||||||
{
|
{
|
||||||
std::stack<int *> plist1;
|
std::stack<int *> plist1;
|
||||||
@@ -795,6 +829,7 @@ int main(int argc, char *argv[])
|
|||||||
testArray();
|
testArray();
|
||||||
|
|
||||||
testStdList();
|
testStdList();
|
||||||
|
testStdMap();
|
||||||
testStdStack();
|
testStdStack();
|
||||||
testStdString();
|
testStdString();
|
||||||
testStdVector();
|
testStdVector();
|
||||||
|
|||||||
Reference in New Issue
Block a user