Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-21 09:21:17

0001 // Copyright (C) 2020 The Qt Company Ltd.
0002 // Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
0003 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0004 // Qt-Security score:critical reason:data-parser
0005 
0006 #ifndef QCOMMANDLINEOPTION_H
0007 #define QCOMMANDLINEOPTION_H
0008 
0009 #include <QtCore/qstringlist.h>
0010 #include <QtCore/qshareddata.h>
0011 
0012 QT_REQUIRE_CONFIG(commandlineparser);
0013 
0014 QT_BEGIN_NAMESPACE
0015 
0016 class QCommandLineOptionPrivate;
0017 
0018 class Q_CORE_EXPORT QCommandLineOption
0019 {
0020 public:
0021     enum Flag {
0022         HiddenFromHelp = 0x1,
0023         ShortOptionStyle = 0x2,
0024         IgnoreOptionsAfter = 0x4,
0025     };
0026     Q_DECLARE_FLAGS(Flags, Flag)
0027 
0028     explicit QCommandLineOption(const QString &name);
0029     explicit QCommandLineOption(const QStringList &names);
0030     /*implicit*/ QCommandLineOption(const QString &name, const QString &description,
0031                                 const QString &valueName = QString(),
0032                                 const QString &defaultValue = QString());
0033     /*implicit*/ QCommandLineOption(const QStringList &names, const QString &description,
0034                                 const QString &valueName = QString(),
0035                                 const QString &defaultValue = QString());
0036     QCommandLineOption(const QCommandLineOption &other);
0037 
0038     ~QCommandLineOption();
0039 
0040     QCommandLineOption &operator=(const QCommandLineOption &other);
0041     QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QCommandLineOption)
0042 
0043     void swap(QCommandLineOption &other) noexcept
0044     { d.swap(other.d); }
0045 
0046     QStringList names() const;
0047 
0048     void setValueName(const QString &name);
0049     QString valueName() const;
0050 
0051     void setDescription(const QString &description);
0052     QString description() const;
0053 
0054     void setDefaultValue(const QString &defaultValue);
0055     void setDefaultValues(const QStringList &defaultValues);
0056     QStringList defaultValues() const;
0057 
0058     Flags flags() const;
0059     void setFlags(Flags aflags);
0060 
0061 private:
0062     QSharedDataPointer<QCommandLineOptionPrivate> d;
0063 };
0064 
0065 Q_DECLARE_SHARED(QCommandLineOption)
0066 Q_DECLARE_OPERATORS_FOR_FLAGS(QCommandLineOption::Flags)
0067 
0068 
0069 QT_END_NAMESPACE
0070 
0071 #endif // QCOMMANDLINEOPTION_H