aboutsummaryrefslogtreecommitdiffstats
path: root/abstractmetabuilder.cpp
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.lima@openbossa.org>2010-04-15 18:45:40 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:00 -0300
commit8c03a55d03b2e63b760ec3be4a37285304b65b32 (patch)
tree4da79f7d8342ffdc5bc3fc6f317caad44f9f068e /abstractmetabuilder.cpp
parentf267a89cfb4d5bf4e405db9ab1360d90ee70f867 (diff)
Do not set the include file on TypeEntries when the include file does not exists or
it's the global header.
Diffstat (limited to 'abstractmetabuilder.cpp')
-rw-r--r--abstractmetabuilder.cpp41
1 files changed, 23 insertions, 18 deletions
diff --git a/abstractmetabuilder.cpp b/abstractmetabuilder.cpp
index 994448b9..797f76d2 100644
--- a/abstractmetabuilder.cpp
+++ b/abstractmetabuilder.cpp
@@ -522,8 +522,7 @@ bool AbstractMetaBuilder::build(QIODevice* input)
continue;
}
- QFileInfo info(func->fileName());
- funcEntry->setInclude(Include(Include::IncludePath, info.fileName()));
+ setInclude(funcEntry, func->fileName());
m_globalFunctions << metaFunc;
}
@@ -634,10 +633,8 @@ AbstractMetaClass *AbstractMetaBuilder::traverseNamespace(NamespaceModelItem nam
popScope();
m_namespacePrefix = currentScope()->qualifiedName().join("::");
- if (!type->include().isValid()) {
- QFileInfo info(namespaceItem->fileName());
- type->setInclude(Include(Include::IncludePath, info.fileName()));
- }
+ if (!type->include().isValid())
+ setInclude(type, namespaceItem->fileName());
return metaClass;
}
@@ -939,10 +936,9 @@ AbstractMetaEnum *AbstractMetaBuilder::traverseEnum(EnumModelItem enumItem, Abst
m_enums << metaEnum;
- if (!metaEnum->typeEntry()->include().isValid()) {
- QFileInfo info(enumItem->fileName());
- metaEnum->typeEntry()->setInclude(Include(Include::IncludePath, info.fileName()));
- }
+ if (!metaEnum->typeEntry()->include().isValid())
+ setInclude(metaEnum->typeEntry(), enumItem->fileName());
+
metaEnum->setOriginalAttributes(metaEnum->attributes());
return metaEnum;
@@ -985,10 +981,8 @@ AbstractMetaClass* AbstractMetaBuilder::traverseTypeAlias(TypeAliasModelItem typ
*metaClass += AbstractMetaAttributes::Public;
// Set the default include file name
- if (!type->include().isValid()) {
- QFileInfo info(typeAlias->fileName());
- type->setInclude(Include(Include::IncludePath, info.fileName()));
- }
+ if (!type->include().isValid())
+ setInclude(type, typeAlias->fileName());
return metaClass;
}
@@ -1098,10 +1092,8 @@ AbstractMetaClass *AbstractMetaBuilder::traverseClass(ClassModelItem classItem)
m_currentClass = oldCurrentClass;
// Set the default include file name
- if (!type->include().isValid()) {
- QFileInfo info(classItem->fileName());
- type->setInclude(Include(Include::IncludePath, info.fileName()));
- }
+ if (!type->include().isValid())
+ setInclude(type, classItem->fileName());
return metaClass;
}
@@ -2749,3 +2741,16 @@ AbstractMetaArgumentList AbstractMetaBuilder::reverseList(const AbstractMetaArgu
return ret;
}
+
+void AbstractMetaBuilder::setGlobalHeader(const QString& globalHeader)
+{
+ m_globalHeader = QFileInfo(globalHeader);
+}
+
+void AbstractMetaBuilder::setInclude(TypeEntry* te, const QString& fileName) const
+{
+
+ QFileInfo info(fileName);
+ if (info.exists() && m_globalHeader != info)
+ te->setInclude(Include(Include::IncludePath, info.fileName()));
+}