blob: 68f20ece07c739b939c9a608241bf5c8d6513628 (
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)
{
QStringList list = stereotypes.split(QLatin1Char(','));
foreach (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;
foreach (const QString &stereotype, stereotypes) {
if (!first)
s += ", ";
s += stereotype;
first = false;
}
return s;
}
QList<QString> StereotypesController::fromString(const QString &stereotypes)
{
QList<QString> result;
QStringList list = stereotypes.split(QLatin1Char(','));
foreach (const QString &part, list) {
QString stereotype = part.trimmed();
if (stereotype.length() > 0)
result.append(stereotype);
}
return result;
}
} // namespace qmt
|