File indexing completed on 2025-09-17 09:09:11
0001
0002
0003
0004
0005 #ifndef QCOMMANDLINEOPTION_H
0006 #define QCOMMANDLINEOPTION_H
0007
0008 #include <QtCore/qstringlist.h>
0009 #include <QtCore/qshareddata.h>
0010
0011 QT_REQUIRE_CONFIG(commandlineparser);
0012
0013 QT_BEGIN_NAMESPACE
0014
0015 class QCommandLineOptionPrivate;
0016
0017 class Q_CORE_EXPORT QCommandLineOption
0018 {
0019 public:
0020 enum Flag {
0021 HiddenFromHelp = 0x1,
0022 ShortOptionStyle = 0x2,
0023 IgnoreOptionsAfter = 0x4,
0024 };
0025 Q_DECLARE_FLAGS(Flags, Flag)
0026
0027 explicit QCommandLineOption(const QString &name);
0028 explicit QCommandLineOption(const QStringList &names);
0029 QCommandLineOption(const QString &name, const QString &description,
0030 const QString &valueName = QString(),
0031 const QString &defaultValue = QString());
0032 QCommandLineOption(const QStringList &names, const QString &description,
0033 const QString &valueName = QString(),
0034 const QString &defaultValue = QString());
0035 QCommandLineOption(const QCommandLineOption &other);
0036
0037 ~QCommandLineOption();
0038
0039 QCommandLineOption &operator=(const QCommandLineOption &other);
0040 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QCommandLineOption)
0041
0042 void swap(QCommandLineOption &other) noexcept
0043 { d.swap(other.d); }
0044
0045 QStringList names() const;
0046
0047 void setValueName(const QString &name);
0048 QString valueName() const;
0049
0050 void setDescription(const QString &description);
0051 QString description() const;
0052
0053 void setDefaultValue(const QString &defaultValue);
0054 void setDefaultValues(const QStringList &defaultValues);
0055 QStringList defaultValues() const;
0056
0057 Flags flags() const;
0058 void setFlags(Flags aflags);
0059
0060 private:
0061 QSharedDataPointer<QCommandLineOptionPrivate> d;
0062 };
0063
0064 Q_DECLARE_SHARED(QCommandLineOption)
0065 Q_DECLARE_OPERATORS_FOR_FLAGS(QCommandLineOption::Flags)
0066
0067
0068 QT_END_NAMESPACE
0069
0070 #endif