Wizards: Enforce use of #pragma once in the Creator Plugin template

This should match Creator style, no matter what the users uses for
own projects.

Change-Id: I32e052b24ed6d029cd3c7a466bdf8191d1657e4e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2023-07-28 15:56:08 +02:00
parent f0ba7bbbea
commit 59a6702271
4 changed files with 3 additions and 35 deletions

View File

@@ -1,9 +1,4 @@
@if '%{Cpp:PragmaOnce}'
#pragma once
@else
#ifndef %{GUARD}
#define %{GUARD}
@endif
#include "%{GlobalHdrFileName}"
@@ -29,7 +24,3 @@ private:
};
} // namespace %{PluginName}::Internal
@if ! '%{Cpp:PragmaOnce}'
#endif // %{GUARD}
@endif

View File

@@ -1,10 +1,5 @@
%{Cpp:LicenseTemplate}\
@if '%{Cpp:PragmaOnce}'
#pragma once
@else
#ifndef %{GLOBAL_GUARD}
#define %{GLOBAL_GUARD}
@endif
#include <qglobal.h>
@@ -13,7 +8,3 @@
#else
# define %{LibraryExport} Q_DECL_IMPORT
#endif
@if ! '%{Cpp:PragmaOnce}'
#endif // %{GLOBAL_GUARD}
@endif

View File

@@ -1,20 +1,9 @@
%{Cpp:LicenseTemplate}\
@if '%{Cpp:PragmaOnce}'
#pragma once
@else
#ifndef %{CONSTANTS_GUARD}
#define %{CONSTANTS_GUARD}
@endif
namespace %{PluginName} {
namespace Constants {
namespace %{PluginName}::Constants {
const char ACTION_ID[] = "%{PluginName}.Action";
const char MENU_ID[] = "%{PluginName}.Menu";
} // namespace Constants
} // namespace %{PluginName}
@if ! '%{Cpp:PragmaOnce}'
#endif // %{CONSTANTS_GUARD}
@endif
} // namespace %{PluginName}::Constants

View File

@@ -23,10 +23,7 @@
{ "key": "GlobalHdrFileName", "value": "%{JS: Util.fileName(value('PluginNameLower') + '_global', Util.preferredSuffix('text/x-c++hdr'))}" },
{ "key": "ConstantsHdrFileName", "value": "%{JS: Util.fileName(value('PluginNameLower') + 'constants', Util.preferredSuffix('text/x-c++hdr'))}" },
{ "key": "CN", "value": "%{JS: Cpp.className(value('PluginName') + 'Plugin')}" },
{ "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('CN'), Util.suffix(value('HdrFileName')))}" },
{ "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" },
{ "key": "GLOBAL_GUARD", "value": "%{JS: Cpp.headerGuard(value('GlobalHdrFileName'))}" },
{ "key": "CONSTANTS_GUARD", "value": "%{JS: Cpp.headerGuard(value('ConstantsHdrFileName'))}" }
{ "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" }
],
"pages":