blob: 0ed1c06e0608c8c92f809c63dbeef5a38f7171ba (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Copyright (C) 2016 Jochen Becher
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "stereotypescontroller.h"
#include <QStringList>
namespace qmt {
StereotypesController::StereotypesController(QObject *parent) :
QObject(parent)
{
}
bool StereotypesController::isParsable(const QString &stereotypes)
{
const QStringList list = stereotypes.split(QLatin1Char(','));
for (const QString &part : list) {
QString stereotype = part.trimmed();
if (stereotype.length() == 0)
return false;
}
return true;
}
QString StereotypesController::toString(const QList<QString> &stereotypes)
{
QString s;
bool first = true;
for (const QString &stereotype : stereotypes) {
if (!first)
s += ", ";
s += stereotype;
first = false;
}
return s;
}
QList<QString> StereotypesController::fromString(const QString &stereotypes)
{
QList<QString> result;
const QStringList list = stereotypes.split(QLatin1Char(','));
for (const QString &part : list) {
QString stereotype = part.trimmed();
if (stereotype.length() > 0)
result.append(stereotype);
}
return result;
}
} // namespace qmt
|