Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
12ParsedSpecification parseSpecification(const QString &specification)
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#ifdef Q_OS_VXWORKS
23 } else if (arg.startsWith("/input/"_L1)) {
24 result.devices.append(arg.toString());
25#endif
26 } else {
27 // build new specification without /dev/ elements
28 result.spec += arg + u':';
29 }
30 }
31
32 if (!result.spec.isEmpty())
33 result.spec.chop(1); // remove trailing ':'
34
35 return result;
36}
37
38} // namespace QEvdevUtil
39
40QT_END_NAMESPACE
ParsedSpecification parseSpecification(const QString &specification)