Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qevdevutil.cpp
Go to the documentation of this file.
1// Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.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 "qevdevutil_p.h"
5
7
8using namespace Qt::StringLiterals;
9
10namespace QEvdevUtil {
11
13{
15
16 result.args = QStringView{specification}.split(u':');
17
18 for (const auto &arg : std::as_const(result.args)) {
19 if (arg.startsWith("/dev/"_L1)) {
20 // if device is specified try to use it
21 result.devices.append(arg.toString());
22 } else {
23 // build new specification without /dev/ elements
24 result.spec += arg + u':';
25 }
26 }
27
28 if (!result.spec.isEmpty())
29 result.spec.chop(1); // remove trailing ':'
30
31 return result;
32}
33
34} // namespace QEvdevUtil
35
\inmodule QtCore
Definition qstringview.h:76
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
QStringList split(const QString &sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Splits the string into substrings wherever sep occurs, and returns the list of those strings.
Definition qstring.cpp:7956
ParsedSpecification parseSpecification(const QString &specification)
Combined button and popup list for selecting options.
GLuint64EXT * result
[6]
SSL_CTX int(*) void arg)