diff options
author | Tobias Hunger <tobias.hunger@theqtcompany.com> | 2015-10-14 13:02:53 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@theqtcompany.com> | 2015-10-14 12:05:30 +0000 |
commit | a447645422db4435701a8bc80954a47098769d6f (patch) | |
tree | 84aea7418dd1bf679c2669914ede6eb432a240b9 /src/plugins/cpptools/abstracteditorsupport.cpp | |
parent | fe8e14eb4c3c16375180186a52cc098f518fcc61 (diff) |
AbstractEditorSupport: Simplify licenseheader handling
Change-Id: I6bad3870b14066716fff5adc2a03b18f1840b6c7
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Diffstat (limited to 'src/plugins/cpptools/abstracteditorsupport.cpp')
-rw-r--r-- | src/plugins/cpptools/abstracteditorsupport.cpp | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/src/plugins/cpptools/abstracteditorsupport.cpp b/src/plugins/cpptools/abstracteditorsupport.cpp index 3733f668cc..afe3a70103 100644 --- a/src/plugins/cpptools/abstracteditorsupport.cpp +++ b/src/plugins/cpptools/abstracteditorsupport.cpp @@ -35,6 +35,7 @@ #include <utils/fileutils.h> #include <utils/macroexpander.h> +#include <utils/templateengine.h> 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 |