From a447645422db4435701a8bc80954a47098769d6f Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 14 Oct 2015 13:02:53 +0200 Subject: [PATCH] AbstractEditorSupport: Simplify licenseheader handling Change-Id: I6bad3870b14066716fff5adc2a03b18f1840b6c7 Reviewed-by: David Schulz --- .../cpptools/abstracteditorsupport.cpp | 26 ++----------------- 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/plugins/cpptools/abstracteditorsupport.cpp b/src/plugins/cpptools/abstracteditorsupport.cpp index 3733f668cc5..afe3a701033 100644 --- a/src/plugins/cpptools/abstracteditorsupport.cpp +++ b/src/plugins/cpptools/abstracteditorsupport.cpp @@ -35,6 +35,7 @@ #include #include +#include namespace CppTools { @@ -63,30 +64,7 @@ QString AbstractEditorSupport::licenseTemplate(const QString &file, const QStrin expander.registerVariable("Cpp:License:ClassName", tr("The class name"), [className]() { return className; }); - QString out = expander.expand(license); - // Expand \n, \t and handle line continuation: - QString result; - result.reserve(out.count()); - bool isEscaped = false; - for (int i = 0; i < out.count(); ++i) { - const QChar c = out.at(i); - - if (isEscaped) { - if (c == QLatin1Char('n')) - result.append(QLatin1Char('\n')); - else if (c == QLatin1Char('t')) - result.append(QLatin1Char('\t')); - else if (c != QLatin1Char('\n')) - result.append(c); - isEscaped = false; - } else { - if (c == QLatin1Char('\\')) - isEscaped = true; - else - result.append(c); - } - } - return result; + return Utils::TemplateEngine::processText(&expander, license, 0); } } // namespace CppTools