qcommandlineparser.sip 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // qcommandlineparser.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtCore Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. class QCommandLineParser
  22. {
  23. %TypeHeaderCode
  24. #include <qcommandlineparser.h>
  25. %End
  26. public:
  27. QCommandLineParser();
  28. ~QCommandLineParser();
  29. enum SingleDashWordOptionMode
  30. {
  31. ParseAsCompactedShortOptions,
  32. ParseAsLongOptions,
  33. };
  34. void setSingleDashWordOptionMode(QCommandLineParser::SingleDashWordOptionMode parsingMode);
  35. bool addOption(const QCommandLineOption &commandLineOption);
  36. QCommandLineOption addVersionOption();
  37. QCommandLineOption addHelpOption();
  38. void setApplicationDescription(const QString &description);
  39. QString applicationDescription() const;
  40. void addPositionalArgument(const QString &name, const QString &description, const QString &syntax = QString());
  41. void clearPositionalArguments();
  42. void process(const QStringList &arguments) /ReleaseGIL/;
  43. void process(const QCoreApplication &app) /ReleaseGIL/;
  44. bool parse(const QStringList &arguments);
  45. QString errorText() const;
  46. bool isSet(const QString &name) const;
  47. QString value(const QString &name) const;
  48. QStringList values(const QString &name) const;
  49. bool isSet(const QCommandLineOption &option) const;
  50. QString value(const QCommandLineOption &option) const;
  51. QStringList values(const QCommandLineOption &option) const;
  52. QStringList positionalArguments() const;
  53. QStringList optionNames() const;
  54. QStringList unknownOptionNames() const;
  55. void showHelp(int exitCode = 0) /ReleaseGIL/;
  56. QString helpText() const;
  57. bool addOptions(const QList<QCommandLineOption> &options);
  58. void showVersion();
  59. enum OptionsAfterPositionalArgumentsMode
  60. {
  61. ParseAsOptions,
  62. ParseAsPositionalArguments,
  63. };
  64. void setOptionsAfterPositionalArgumentsMode(QCommandLineParser::OptionsAfterPositionalArgumentsMode mode);
  65. %If (Qt_6_9_0 -)
  66. enum class MessageType
  67. {
  68. Information,
  69. Error,
  70. };
  71. %End
  72. %If (Qt_6_9_0 -)
  73. static void showMessageAndExit(QCommandLineParser::MessageType type, const QString &message, int exitCode = 0);
  74. %End
  75. private:
  76. QCommandLineParser(const QCommandLineParser &);
  77. };