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
6
QT_BEGIN_NAMESPACE
7
8
using namespace
Qt::StringLiterals
;
9
10
namespace
QEvdevUtil
{
11
12
ParsedSpecification
parseSpecification
(
const
QString
&specification)
13
{
14
ParsedSpecification
result
;
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
36
QT_END_NAMESPACE
QStringView
\inmodule QtCore
Definition
qstringview.h:76
QString
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition
qstring.h:127
QString::split
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
QEvdevUtil
Definition
qevdevutil.cpp:10
QEvdevUtil::parseSpecification
ParsedSpecification parseSpecification(const QString &specification)
Definition
qevdevutil.cpp:12
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
QT_END_NAMESPACE
Definition
qsharedpointer.cpp:1545
Qt::StringLiterals
Definition
qbytearray.h:716
qevdevutil_p.h
result
GLuint64EXT * result
[6]
Definition
qopenglext.h:10932
arg
SSL_CTX int(*) void arg)
Definition
qsslsocket_openssl_symbols.cpp:404
QEvdevUtil::ParsedSpecification
Definition
qevdevutil_p.h:29
qtbase
src
platformsupport
input
shared
qevdevutil.cpp
Generated by
1.9.7