aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-12-08 15:54:21 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-12-08 16:01:53 -0300
commit23ade48975d7755c38219c86a141f0a910c3e00e (patch)
tree4b99d53a9bb81430aa9d49d144b23b28293c09ab
parent459b585c20262c17f7efe0702aa0251bf678cbc6 (diff)
Added convenience method to get the file name for a module's global header.
Reviewed by Hugo Lima <hugo.lima@openbossa.org>
-rw-r--r--cppgenerator.cpp4
-rw-r--r--headergenerator.cpp8
-rw-r--r--shibokengenerator.cpp7
-rw-r--r--shibokengenerator.h4
4 files changed, 17 insertions, 6 deletions
diff --git a/cppgenerator.cpp b/cppgenerator.cpp
index 72c4f824c..53f2ac0a8 100644
--- a/cppgenerator.cpp
+++ b/cppgenerator.cpp
@@ -96,7 +96,7 @@ void CppGenerator::generateClass(QTextStream &s, const AbstractMetaClass *metaCl
if (hasMultipleInheritanceInAncestry(metaClass))
s << "#include <set>" << endl;
- s << "#include \"" << moduleName().toLower() << "_python.h\"" << endl << endl;
+ s << "#include \"" << getModuleHeaderFileName() << '"' << endl << endl;
QString converterImpl;
QTextStream convImpl(&converterImpl);
@@ -2270,7 +2270,7 @@ void CppGenerator::finishGeneration()
s << "#include <Python.h>" << endl;
s << "#include <shiboken.h>" << endl;
- s << "#include \"" << moduleName().toLower() << "_python.h\"" << endl << endl;
+ s << "#include \"" << getModuleHeaderFileName() << '"' << endl << endl;
foreach (const QString& include, includes)
s << "#include \"" << include << '\"' << endl;
s << endl;
diff --git a/headergenerator.cpp b/headergenerator.cpp
index 48d3e587c..f160fe870 100644
--- a/headergenerator.cpp
+++ b/headergenerator.cpp
@@ -253,11 +253,11 @@ void HeaderGenerator::finishGeneration()
}
}
- QString moduleHeaderFileName(outputDirectory() + QDir::separator()
- + subDirectoryForPackage(packageName()));
- moduleHeaderFileName += QDir::separator() + moduleName().toLower() + "_python.h";
+ QString moduleHeaderFileName(outputDirectory()
+ + QDir::separator() + subDirectoryForPackage(packageName())
+ + QDir::separator() + getModuleHeaderFileName());
- QString includeShield = moduleName().toUpper() + "_PYTHON_H";
+ QString includeShield("SBK_" + moduleName().toUpper() + "_PYTHON_H");
QFile file(moduleHeaderFileName);
if (file.open(QFile::WriteOnly)) {
diff --git a/shibokengenerator.cpp b/shibokengenerator.cpp
index 2094749fc..ba3d03e35 100644
--- a/shibokengenerator.cpp
+++ b/shibokengenerator.cpp
@@ -1149,6 +1149,13 @@ QString ShibokenGenerator::getApiExportMacro() const
return "SHIBOKEN_"+moduleName().toUpper()+"_API"; // a longer name to avoid name clashes
}
+QString ShibokenGenerator::getModuleHeaderFileName(QString modName) const
+{
+ if (modName.isEmpty())
+ modName = moduleName();
+ return QString("%1_python.h").arg(modName.toLower());
+}
+
/*
static void dumpFunction(AbstractMetaFunctionList lst)
{
diff --git a/shibokengenerator.h b/shibokengenerator.h
index beb88e4c6..f7a79e708 100644
--- a/shibokengenerator.h
+++ b/shibokengenerator.h
@@ -257,6 +257,10 @@ public:
/// Returns the name of the macro used to export symbols
QString getApiExportMacro() const;
+
+ /// Returns the file name for the module global header. If no module name is provided the current will be used.
+ QString getModuleHeaderFileName(QString moduleName = QString()) const;
+
QMap< QString, QString > options() const;
/// Returns true if the user enabled the so called "parent constructor heuristic".