Files
qt-creator/share/qtcreator/templates/wizards/projects/cpplibrary/lib.h
Eike Ziller 23c222f61b Fix C++ Library wizard when compiled with Qt < 5.12
Only Qt 5.12 got true ECMA Script capabilities, so arrow function
expressions are not supported before that.

To be able to use "regular" inline functions, we allow usage of } by escaping with backslash.
For variables that do not start with "JS:" we already supported backslash for escaping.

Fixes: QTCREATORBUG-22336
Change-Id: I9fc638e64d2757a21fffc16355635e2fcff87a36
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-06-03 06:46:52 +00:00

47 lines
806 B
C++

%{Cpp:LicenseTemplate}\
@if '%{Cpp:PragmaOnce}'
#pragma once
@else
#ifndef %{GUARD}
#define %{GUARD}
@endif
@if %{IsShared}
#include "%{GlobalHdrFileName}"
@elsif %{IsQtPlugin}
#include <%{BaseClassName}>
@endif
%{JS: Cpp.openNamespaces('%{Class}')}\
@if %{IsShared}
class %{LibraryExport} %{CN}
{
public:
%{CN}();
};
@elsif %{IsStatic}
class %{CN}
{
public:
%{CN}();
};
@else
class %{CN} : public %{BaseClassName}
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.%{PluginInterface}" FILE "%{PluginJsonFile}")
public:
explicit %{CN}(QObject *parent = nullptr);
private:
%{JS: '%{PluginMethods}'.split('|').map(function(s) { return ' ' + s + ' override;'; \}).join('\\n')}
};
@endif
%{JS: Cpp.closeNamespaces('%{Class}')}\
@if ! '%{Cpp:PragmaOnce}'
#endif // %{GUARD}
@endif