forked from qt-creator/qt-creator
Wizards: Support using #pragma once instead of include guards
Allow users to choose #pragma once instead of #ifndef include guards in generated header files. Fixes: QTCREATORBUG-12166 Change-Id: I3ba41c7570beb9c5958e174b5581fcc25855050f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Filip Bucek <fbucek@atlas.cz>
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
#include <cpptools/abstracteditorsupport.h>
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/macroexpander.h>
|
||||
#include <utils/templateengine.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
@@ -311,7 +313,20 @@ QString PluginGenerator::processTemplate(const QString &tmpl,
|
||||
if (!reader.fetch(tmpl, errorMessage))
|
||||
return QString();
|
||||
|
||||
|
||||
QString cont = QString::fromUtf8(reader.data());
|
||||
|
||||
// Expander needed to handle extra variable "Cpp:PragmaOnce"
|
||||
Utils::MacroExpander *expander = Utils::globalMacroExpander();
|
||||
QString errMsg;
|
||||
cont = Utils::TemplateEngine::processText(expander, cont, &errMsg);
|
||||
if (!errMsg.isEmpty()) {
|
||||
qWarning("Error processing custom plugin file: %s\nFile:\n%s",
|
||||
qPrintable(errMsg), qPrintable(cont));
|
||||
errorMessage = &errMsg;
|
||||
return QString();
|
||||
}
|
||||
|
||||
const QChar atChar = QLatin1Char('@');
|
||||
int offset = 0;
|
||||
for (;;) {
|
||||
|
||||
Reference in New Issue
Block a user