[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [smokegen] generators/smoke: add template parameters to the smoke types[] table
From: Arno Rehn <arno () arnorehn ! de>
Date: 2012-07-31 19:42:31
Message-ID: 20120731194231.2D57CA6094 () git ! kde ! org
[Download RAW message or body]
Git commit 07e9b9b0018f590c6228f059c3f4ad56444a7c63 by Arno Rehn.
Committed on 31/07/2012 at 21:41.
Pushed by arnorehn into branch 'master'.
add template parameters to the smoke types[] table
M +2 -0 generators/smoke/globals.h
M +16 -1 generators/smoke/helpers.cpp
M +13 -1 generators/smoke/writeSmokeDataFile.cpp
http://commits.kde.org/smokegen/07e9b9b0018f590c6228f059c3f4ad56444a7c63
diff --git a/generators/smoke/globals.h b/generators/smoke/globals.h
index 26c37f2..31ab21e 100644
--- a/generators/smoke/globals.h
+++ b/generators/smoke/globals.h
@@ -69,6 +69,7 @@ struct SmokeDataFile
void write();
bool isClassUsed(const Class* klass);
QString getTypeFlags(const Type *type, int *classIdx);
+ void insertTemplateParameters(const Type& type);
QMap<QString, int> classIndex;
QHash<const Member*, int> methodIdx;
@@ -129,6 +130,7 @@ struct Util
static QString mungedName(const Method&);
static Type* normalizeType(const Type* type);
+ static bool hasTypeNonPublicParts(const Type& type);
static QString stackItemField(const Type* type);
static QString assignmentString(const Type* type, const QString& var);
diff --git a/generators/smoke/helpers.cpp b/generators/smoke/helpers.cpp
index 4fb2c98..43c6844 100644
--- a/generators/smoke/helpers.cpp
+++ b/generators/smoke/helpers.cpp
@@ -183,7 +183,7 @@ void Util::preparse(QSet<Type*> *usedTypes, QSet<const Class*> *superClasses, co
foreach (const Method& m, klass.methods()) {
if (m.access() == Access_private)
continue;
- if ((m.type()->getClass() && m.type()->getClass()->access() == Access_private)
+ if (hasTypeNonPublicParts(*m.type())
|| Options::typeExcluded(m.toString(false, true)))
{
klass.methodsRef().removeOne(m);
@@ -509,6 +509,21 @@ Type* Util::normalizeType(const Type* type) {
return Type::registerType(normalizedType);
}
+bool Util::hasTypeNonPublicParts(const Type& type)
+{
+ if (type.getClass() && type.getClass()->access() != Access_public) {
+ return true;
+ }
+
+ foreach (const Type& t, type.templateArguments()) {
+ if (hasTypeNonPublicParts(t)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
QString Util::stackItemField(const Type* type)
{
if (type->getTypedef()) {
diff --git a/generators/smoke/writeSmokeDataFile.cpp b/generators/smoke/writeSmokeDataFile.cpp
index 6c15fd9..243f787 100644
--- a/generators/smoke/writeSmokeDataFile.cpp
+++ b/generators/smoke/writeSmokeDataFile.cpp
@@ -66,7 +66,11 @@ SmokeDataFile::SmokeDataFile()
declaredVirtualMethods[meth->getClass()] << meth;
}
}
-
+
+ foreach (Type* type, usedTypes) {
+ insertTemplateParameters(*type);
+ }
+
// if a class is used somewhere but not listed in the class list, mark it external
for (QHash<QString, Class>::iterator iter = ::classes.begin(); iter != ::classes.end(); iter++) {
if (iter.value().isTemplate() || Options::voidpTypes.contains(iter.key()))
@@ -96,6 +100,14 @@ SmokeDataFile::SmokeDataFile()
}
}
+void SmokeDataFile::insertTemplateParameters(const Type& type)
+{
+ foreach(const Type& t, type.templateArguments()) {
+ usedTypes << Type::registerType(t);
+ insertTemplateParameters(t);
+ }
+}
+
bool SmokeDataFile::isClassUsed(const Class* klass)
{
for (QSet<Type*>::const_iterator it = usedTypes.constBegin(); it != usedTypes.constEnd(); it++) {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic