aboutsummaryrefslogtreecommitdiffstats
path: root/src/QtUtils.cpp
diff options
context:
space:
mode:
authorSergio Martins <smartins@kde.org>2017-08-06 11:06:35 +0100
committerSergio Martins <smartins@kde.org>2017-08-06 11:11:28 +0100
commit079ddfcd58f79fed8ab3792f08722e56523f5c61 (patch)
tree3a995bee865e555f7dbf9c968bd0b431c94cd542 /src/QtUtils.cpp
parentfa1dcf6138bd3bf6bc3bc2647d9451e35ce359aa (diff)
Merge two std::map, they had mostly the same contents
- Moved to QtUtils, so it can be shared with more checks - Removed the duplicate one from foreach, which was even wrong since it included QVarLengthArray, but that container isn't implicitly shared kfunk: ^^
Diffstat (limited to 'src/QtUtils.cpp')
-rw-r--r--src/QtUtils.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/QtUtils.cpp b/src/QtUtils.cpp
index 5d1ffbb2..6bda1eb0 100644
--- a/src/QtUtils.cpp
+++ b/src/QtUtils.cpp
@@ -58,6 +58,32 @@ const vector<string> & QtUtils::qtCOWContainers()
return classes;
}
+
+std::map<string, std::vector<string> > QtUtils::detachingMethods()
+{
+ static std::map<string, std::vector<string> > map;
+ if (map.empty()) {
+ map["QList"] = {"first", "last", "begin", "end", "front", "back", "operator[]"};
+ map["QVector"] = {"first", "last", "begin", "end", "front", "back", "data", "operator[]", "fill" };
+ map["QMap"] = {"begin", "end", "first", "find", "last", "lowerBound", "upperBound", "operator[]" };
+ map["QHash"] = {"begin", "end", "find", "operator[]" };
+ map["QLinkedList"] = {"first", "last", "begin", "end", "front", "back", "operator[]" };
+ map["QSet"] = {"begin", "end", "find", "operator[]" };
+ map["QStack"] = map["QVector"];
+ map["QStack"].push_back({"top"});
+ map["QQueue"] = map["QVector"];
+ map["QQueue"].push_back({"head"});
+ map["QMultiMap"] = map["QMap"];
+ map["QMultiHash"] = map["QHash"];
+ map["QString"] = {"begin", "end", "data", "operator[]"};
+ map["QByteArray"] = {"data", "operator[]"};
+ map["QImage"] = {"bits", "scanLine"};
+ }
+
+ return map;
+}
+
+
bool QtUtils::isQtCOWIterableClass(clang::CXXRecordDecl *record)
{
if (!record)
@@ -297,5 +323,3 @@ CXXMethodDecl *QtUtils::pmfFromUnary(UnaryOperator *uo)
return nullptr;
}
-
-