Include namespaces inside header guard

Task: QTCREATORBUG-2724
RevBy: Friedemann Kleint <qtc-committer@nokia.com>
This commit is contained in:
Jarek Kobus
2011-01-18 12:18:08 +01:00
parent 11c6ca71ac
commit 0c60770fab
5 changed files with 22 additions and 14 deletions

View File

@@ -74,8 +74,15 @@ void LibraryParameters::generateCode(QtProjectParameters:: Type t,
const QString indent = QString(indentation, QLatin1Char(' '));
// Do we have namespaces?
QStringList namespaceList = className.split(QLatin1String("::"));
if (namespaceList.empty()) // Paranoia!
return;
const QString unqualifiedClassName = namespaceList.takeLast();
// 1) Header
const QString guard = Utils::headerGuard(headerFileName);
const QString guard = Utils::headerGuard(headerFileName, namespaceList);
headerStr << "#ifndef " << guard
<< "\n#define " << guard << '\n' << '\n';
@@ -94,14 +101,6 @@ void LibraryParameters::generateCode(QtProjectParameters:: Type t,
headerStr << '\n';
}
// Do we have namespaces?
QStringList namespaceList = className.split(QLatin1String("::"));
if (namespaceList.empty()) // Paranoia!
return;
const QString unqualifiedClassName = namespaceList.back();
namespaceList.pop_back();
const QString namespaceIndent = Utils::writeOpeningNameSpaces(namespaceList, indent, headerStr);
// Class declaraction