blob: acd51344a6e1acf0d73ab51eeada5c339a1238ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstracteditorsupport.h"
#include "cppeditortr.h"
#include "cppfilesettingspage.h"
#include <utils/fileutils.h>
#include <utils/macroexpander.h>
#include <utils/templateengine.h>
using namespace Utils;
namespace CppEditor {
QString licenseTemplate(ProjectExplorer::Project *project,
const FilePath &filePath, const QString &className)
{
const QString license = Internal::cppFileSettingsForProject(project).licenseTemplate();
Utils::MacroExpander expander;
expander.registerVariable("Cpp:License:FileName", Tr::tr("The file name."),
[filePath] { return filePath.fileName(); });
expander.registerVariable("Cpp:License:ClassName", Tr::tr("The class name."),
[className] { return className; });
return TemplateEngine::processText(&expander, license).value_or(QString());
}
bool usePragmaOnce(ProjectExplorer::Project *project)
{
return Internal::cppFileSettingsForProject(project).headerPragmaOnce;
}
} // CppEditor
|