| 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 | QString Util::indent(int level) |
| 9 | { |
| 10 | return QStringLiteral("%1").arg(a: " ", fieldWidth: level * 4, fillChar: ' '); |
| 11 | } |
| 12 | |
| 13 | QString Util::lineBreak(int n) |
| 14 | { |
| 15 | return QStringLiteral("%1").arg(a: "\n", fieldWidth: n, fillChar: '\n'); |
| 16 | } |
| 17 | |
| 18 | QString Util::removeNamespace(const QString &typeName) |
| 19 | { |
| 20 | return typeName.split(sep: ":").value(i: 1, defaultValue: QString()); |
| 21 | } |
| 22 | |
| 23 | QString Util::lowerFirstLetter(const QString &temp) |
| 24 | { |
| 25 | if (temp.isEmpty()) |
| 26 | return temp; |
| 27 | |
| 28 | auto result = temp; |
| 29 | result.front() = result.at(i: 0).toLower(); |
| 30 | return result; |
| 31 | } |
| 32 |
