| 1 | // Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include "util.h" |
| 5 | |
| 6 | #include <QtCore/qstringlist.h> |
| 7 | |
| 8 | using namespace Qt::Literals::StringLiterals; |
| 9 | |
| 10 | QString Util::indent(int level) |
| 11 | { |
| 12 | return u"%1"_s .arg(a: ' '_L1, fieldWidth: level * 4, fillChar: ' '_L1); |
| 13 | } |
| 14 | |
| 15 | QString Util::lineBreak(int n) |
| 16 | { |
| 17 | return u"%1"_s .arg(a: '\n'_L1, fieldWidth: n, fillChar: '\n'_L1); |
| 18 | } |
| 19 | |
| 20 | QString Util::removeNamespace(const QString &typeName) |
| 21 | { |
| 22 | return typeName.split(sep: ':'_L1).value(i: 1, defaultValue: QString()); |
| 23 | } |
| 24 | |
| 25 | QString Util::lowerFirstLetter(const QString &temp) |
| 26 | { |
| 27 | if (temp.isEmpty()) |
| 28 | return temp; |
| 29 | |
| 30 | auto result = temp; |
| 31 | result.front() = result.at(i: 0).toLower(); |
| 32 | return result; |
| 33 | } |
| 34 | |