aboutsummaryrefslogtreecommitdiffstats
path: root/typedatabase.cpp
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-08-29 18:22:00 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:19 -0300
commitf60da508aa6e45232dbb1ae2831c4a45479d168e (patch)
tree7b8140e14e0f4e3db81c62db4bf614e3c3b5b4b0 /typedatabase.cpp
parent16dc50e25109274f400a064b4d672384d09b22f7 (diff)
Revert "Implement getTypeIndex function for types no generated types and primitive types."
This commit broke the macosx build of PySide. This reverts commit e9758a01f15bc53de8e03b77ec8beb5673b1b1af.
Diffstat (limited to 'typedatabase.cpp')
-rw-r--r--typedatabase.cpp60
1 files changed, 17 insertions, 43 deletions
diff --git a/typedatabase.cpp b/typedatabase.cpp
index 25933501f..d5c1eb6ce 100644
--- a/typedatabase.cpp
+++ b/typedatabase.cpp
@@ -430,12 +430,8 @@ void TypeDatabase::setDropTypeEntries(QStringList dropTypeEntries)
// This global variable exists only because we can't break the ABI
typedef QHash<const TypeEntry*, std::pair<int, int> > TypeRevisionMap;
Q_GLOBAL_STATIC(TypeRevisionMap, typeEntryFields);
-// Hash of: packageName -> (max type index found, max primitive type index found)
-typedef QMap<QString, QPair<int, int> > MaxTypeIndexes;
-Q_GLOBAL_STATIC(MaxTypeIndexes, maxTypeIndexes);
static bool computeTypeIndexes = true;
-// This is kept for API compatibility issues with previous versions
-int oldMaxTypeIndex;
+static int maxTypeIndex;
int getTypeRevision(const TypeEntry* typeEntry)
{
@@ -457,51 +453,39 @@ static void _computeTypeIndexes()
{
TypeDatabase* tdb = TypeDatabase::instance();
typedef QMap<int, QList<TypeEntry*> > GroupedTypeEntries;
- typedef QHash<QString, GroupedTypeEntries> GroupedPerPackageGroups;
- GroupedPerPackageGroups groupsPerPackage;
+ GroupedTypeEntries groupedEntries;
// Group type entries by revision numbers
TypeEntryHash allEntries = tdb->allEntries();
- QString pkgName;
- oldMaxTypeIndex = 0;
foreach (QList<TypeEntry*> entryList, allEntries) {
foreach (TypeEntry* entry, entryList) {
- if (entry->isCppPrimitive()
+ if (entry->isPrimitive()
|| entry->isContainer()
|| entry->isFunction()
+ || !entry->generateCode()
|| entry->isEnumValue()
|| entry->isVarargs()
|| entry->isTypeSystem()
|| entry->isVoid()
|| entry->isCustom())
continue;
-
- if (entry->generateCode() && !entry->isPrimitive())
- oldMaxTypeIndex++;
- pkgName = entry->targetLangPackage();
- groupsPerPackage[pkgName][getTypeRevision(entry)] << entry;
+ groupedEntries[getTypeRevision(entry)] << entry;
}
}
-
- GroupedPerPackageGroups::iterator pkg = groupsPerPackage.begin();
- for (; pkg != groupsPerPackage.end() ; ++pkg) {
- GroupedTypeEntries::iterator it = pkg.value().begin();
- for (; it != pkg.value().end(); ++it) {
- // Remove duplicates
- QList<TypeEntry*>::iterator newEnd = std::unique(it.value().begin(), it.value().end());
- it.value().erase(newEnd, it.value().end());
- // Sort the type entries by name
- qSort(it.value().begin(), newEnd, compareTypeEntriesByName);
-
- foreach (TypeEntry* entry, it.value()) {
- QPair<int, int>& pair = (*maxTypeIndexes())[pkg.key()];
- int value = entry->isPrimitive() ? pair.second++ : pair.first++;
- (*typeEntryFields())[entry].second = value;
- }
+ maxTypeIndex = 0;
+ GroupedTypeEntries::iterator it = groupedEntries.begin();
+ for (; it != groupedEntries.end(); ++it) {
+ // Remove duplicates
+ QList<TypeEntry*>::iterator newEnd = std::unique(it.value().begin(), it.value().end());
+ it.value().erase(newEnd, it.value().end());
+ // Sort the type entries by name
+ qSort(it.value().begin(), newEnd, compareTypeEntriesByName);
+
+ foreach (TypeEntry* entry, it.value()) {
+ (*typeEntryFields())[entry].second = maxTypeIndex++;
}
}
-
computeTypeIndexes = false;
}
@@ -516,17 +500,7 @@ int getMaxTypeIndex()
{
if (computeTypeIndexes)
_computeTypeIndexes();
- return oldMaxTypeIndex;
-}
-
-int getMaxTypeIndex(const QString& packageName)
-{
- return maxTypeIndexes()->value(packageName).first - 1;
-}
-
-int getMaxPrimitiveTypeIndex(const QString& packageName)
-{
- return maxTypeIndexes()->value(packageName).second - 1;
+ return maxTypeIndex;
}
void TypeDatabase::setApiVersion(const QString& package, const QByteArray& version)