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:
@@ -140,6 +140,11 @@ QString CppToolsPlugin::licenseTemplate()
|
||||
return m_instance->m_fileSettings->licenseTemplate();
|
||||
}
|
||||
|
||||
bool CppToolsPlugin::usePragmaOnce()
|
||||
{
|
||||
return m_instance->m_fileSettings->headerPragmaOnce;
|
||||
}
|
||||
|
||||
const QStringList &CppToolsPlugin::headerSearchPaths()
|
||||
{
|
||||
return m_instance->m_fileSettings->headerSearchPaths;
|
||||
@@ -204,6 +209,11 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
tr("The configured path to the license template"),
|
||||
[]() { return CppToolsPlugin::licenseTemplatePath().toString(); });
|
||||
|
||||
expander->registerVariable(
|
||||
"Cpp:PragmaOnce",
|
||||
tr("Insert #pragma once instead of #ifndef include guards into header file"),
|
||||
[] { return usePragmaOnce() ? QString("true") : QString(); });
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user