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// Qt-Security score:critical reason:data-parser
5
6#ifndef QCOMMANDLINEOPTION_H
7#define QCOMMANDLINEOPTION_H
8
9#include <QtCore/qstringlist.h>
10#include <QtCore/qshareddata.h>
11
13
14QT_BEGIN_NAMESPACE
15
16class QCommandLineOptionPrivate;
17
18class Q_CORE_EXPORT QCommandLineOption
19{
20public:
21 enum Flag {
22 HiddenFromHelp = 0x1,
23 ShortOptionStyle = 0x2,
24 IgnoreOptionsAfter = 0x4,
25 };
26 Q_DECLARE_FLAGS(Flags, Flag)
27
28 explicit QCommandLineOption(const QString &name);
29 explicit QCommandLineOption(const QStringList &names);
30 /*implicit*/ QCommandLineOption(const QString &name, const QString &description,
31 const QString &valueName = QString(),
32 const QString &defaultValue = QString());
33 /*implicit*/ QCommandLineOption(const QStringList &names, const QString &description,
34 const QString &valueName = QString(),
35 const QString &defaultValue = QString());
36 QCommandLineOption(const QCommandLineOption &other);
37
38 ~QCommandLineOption();
39
40 QCommandLineOption &operator=(const QCommandLineOption &other);
41 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QCommandLineOption)
42
43 void swap(QCommandLineOption &other) noexcept
44 { d.swap(other.d); }
45
46 QStringList names() const;
47
48 void setValueName(const QString &name);
49 QString valueName() const;
50
51 void setDescription(const QString &description);
52 QString description() const;
53
54 void setDefaultValue(const QString &defaultValue);
55 void setDefaultValues(const QStringList &defaultValues);
56 QStringList defaultValues() const;
57
58 Flags flags() const;
59 void setFlags(Flags aflags);
60
61private:
62 QSharedDataPointer<QCommandLineOptionPrivate> d;
63};
64
66Q_DECLARE_OPERATORS_FOR_FLAGS(QCommandLineOption::Flags)
67
68
69QT_END_NAMESPACE
70
71#endif // QCOMMANDLINEOPTION_H
static QStringList removeInvalidNames(QStringList nameList)
QStringList names
The list of names used for this option.
QString valueName
The documentation name for the value, if one is expected Example: "-o <file>" means valueName == "fil...
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)