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
qcommandlineoption.h
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef QCOMMANDLINEOPTION_H
6#define QCOMMANDLINEOPTION_H
7
8#include <QtCore/qstringlist.h>
9#include <QtCore/qshareddata.h>
10
12
13QT_BEGIN_NAMESPACE
14
15class QCommandLineOptionPrivate;
16
17class Q_CORE_EXPORT QCommandLineOption
18{
19public:
20 enum Flag {
21 HiddenFromHelp = 0x1,
22 ShortOptionStyle = 0x2,
23 IgnoreOptionsAfter = 0x4,
24 };
25 Q_DECLARE_FLAGS(Flags, Flag)
26
27 explicit QCommandLineOption(const QString &name);
28 explicit QCommandLineOption(const QStringList &names);
29 /*implicit*/ QCommandLineOption(const QString &name, const QString &description,
30 const QString &valueName = QString(),
31 const QString &defaultValue = QString());
32 /*implicit*/ QCommandLineOption(const QStringList &names, const QString &description,
33 const QString &valueName = QString(),
34 const QString &defaultValue = QString());
35 QCommandLineOption(const QCommandLineOption &other);
36
37 ~QCommandLineOption();
38
39 QCommandLineOption &operator=(const QCommandLineOption &other);
40 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QCommandLineOption)
41
42 void swap(QCommandLineOption &other) noexcept
43 { d.swap(other.d); }
44
45 QStringList names() const;
46
47 void setValueName(const QString &name);
48 QString valueName() const;
49
50 void setDescription(const QString &description);
51 QString description() const;
52
53 void setDefaultValue(const QString &defaultValue);
54 void setDefaultValues(const QStringList &defaultValues);
55 QStringList defaultValues() const;
56
57 Flags flags() const;
58 void setFlags(Flags aflags);
59
60private:
61 QSharedDataPointer<QCommandLineOptionPrivate> d;
62};
63
65Q_DECLARE_OPERATORS_FOR_FLAGS(QCommandLineOption::Flags)
66
67
68QT_END_NAMESPACE
69
70#endif // QCOMMANDLINEOPTION_H
static QStringList removeInvalidNames(QStringList nameList)
QStringList names
The list of names used for this option.
QStringList defaultValues
The list of default values used for this option.
QString description
The description used for this option.
The QCommandLineOption class defines a possible command-line option. \inmodule QtCore.
Combined button and popup list for selecting options.
QT_REQUIRE_CONFIG(commandlineparser)