QtBase  v6.3.1
qcommandlineparser.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
4 ** Copyright (C) 2013 David Faure <faure@kde.org>
5 ** Contact: https://www.qt.io/licensing/
6 **
7 ** This file is part of the QtCore module of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** Commercial License Usage
11 ** Licensees holding valid commercial Qt licenses may use this file in
12 ** accordance with the commercial license agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and The Qt Company. For licensing terms
15 ** and conditions see https://www.qt.io/terms-conditions. For further
16 ** information use the contact form at https://www.qt.io/contact-us.
17 **
18 ** GNU Lesser General Public License Usage
19 ** Alternatively, this file may be used under the terms of the GNU Lesser
20 ** General Public License version 3 as published by the Free Software
21 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
22 ** packaging of this file. Please review the following information to
23 ** ensure the GNU Lesser General Public License version 3 requirements
24 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
25 **
26 ** GNU General Public License Usage
27 ** Alternatively, this file may be used under the terms of the GNU
28 ** General Public License version 2.0 or (at your option) the GNU General
29 ** Public license version 3 or any later version approved by the KDE Free
30 ** Qt Foundation. The licenses are as published by the Free Software
31 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
32 ** included in the packaging of this file. Please review the following
33 ** information to ensure the GNU General Public License requirements will
34 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
35 ** https://www.gnu.org/licenses/gpl-3.0.html.
36 **
37 ** $QT_END_LICENSE$
38 **
39 ****************************************************************************/
40 
41 #include "qcommandlineparser.h"
42 
43 #include <qcoreapplication.h>
44 #include <private/qcoreapplication_p.h>
45 #include <qhash.h>
46 #include <qlist.h>
47 #include <qdebug.h>
48 #if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED)
49 # include <qt_windows.h>
50 #endif
51 #include <stdio.h>
52 #include <stdlib.h>
53 
55 
56 extern void Q_CORE_EXPORT qt_call_post_routines();
57 
59 
61 {
62 public:
64  : singleDashWordOptionMode(QCommandLineParser::ParseAsCompactedShortOptions),
69  { }
70 
71  bool parse(const QStringList &args);
72  void checkParsed(const char *method);
73  QStringList aliases(const QString &name) const;
74  QString helpText(bool includeQtOptions) const;
75  bool registerFoundOption(const QString &optionName);
76  bool parseOptionValue(const QString &optionName, const QString &argument,
77  QStringList::const_iterator *argumentIterator,
79  Q_NORETURN void showHelp(int exitCode, bool includeQtOptions);
80 
83 
86 
89 
92 
95 
98 
101 
104 
107  {
111  };
113 
116 
119 
122 
125 
128 };
130 
132 {
133  const NameHash_t::const_iterator it = nameHash.constFind(optionName);
134  if (it == nameHash.cend()) {
135  qWarning("QCommandLineParser: option not defined: \"%ls\"", qUtf16Printable(optionName));
136  return QStringList();
137  }
138  return commandLineOptionList.at(*it).names();
139 }
140 
272 {
273 }
274 
279 {
280  delete d;
281 }
282 
314 {
315  d->singleDashWordOptionMode = singleDashWordOptionMode;
316 }
317 
349 {
350  d->optionsAfterPositionalArgumentsMode = parsingMode;
351 }
352 
362 {
363  const QStringList optionNames = option.names();
364 
365  if (!optionNames.isEmpty()) {
366  for (const QString &name : optionNames) {
367  if (d->nameHash.contains(name)) {
368  qWarning() << "QCommandLineParser: already having an option named" << name;
369  return false;
370  }
371  }
372 
374 
375  const int offset = d->commandLineOptionList.size() - 1;
376  for (const QString &name : optionNames)
377  d->nameHash.insert(name, offset);
378 
379  return true;
380  }
381 
382  return false;
383 }
384 
397 {
398  // should be optimized (but it's no worse than what was possible before)
399  bool result = true;
400  for (QList<QCommandLineOption>::const_iterator it = options.begin(), end = options.end(); it != end; ++it)
401  result &= addOption(*it);
402  return result;
403 }
404 
415 {
416  QCommandLineOption opt(QStringList() << QStringLiteral("v") << QStringLiteral("version"), tr("Displays version information."));
417  addOption(opt);
418  d->builtinVersionOption = true;
419  return opt;
420 }
421 
437 {
439 #ifdef Q_OS_WIN
440  << QStringLiteral("?")
441 #endif
442  << QStringLiteral("h")
443  << QStringLiteral("help"), tr("Displays help on commandline options."));
444  addOption(opt);
445  QCommandLineOption optHelpAll(QStringLiteral("help-all"), tr("Displays help including Qt specific options."));
446  addOption(optHelpAll);
447  d->builtinHelpOption = true;
448  return opt;
449 }
450 
455 {
456  d->description = description;
457 }
458 
463 {
464  return d->description;
465 }
466 
479 void QCommandLineParser::addPositionalArgument(const QString &name, const QString &description, const QString &syntax)
480 {
482  arg.name = name;
483  arg.description = description;
484  arg.syntax = syntax.isEmpty() ? name : syntax;
486 }
487 
500 {
502 }
503 
524 {
525  return d->parse(arguments);
526 }
527 
533 {
534  if (!d->errorText.isEmpty())
535  return d->errorText;
536  if (d->unknownOptionNames.count() == 1)
537  return tr("Unknown option '%1'.").arg(d->unknownOptionNames.first());
538  if (d->unknownOptionNames.count() > 1)
539  return tr("Unknown options: %1.").arg(d->unknownOptionNames.join(QStringLiteral(", ")));
540  return QString();
541 }
542 
544 
545 #if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED)
546 // Return whether to use a message box. Use handles if a console can be obtained
547 // or we are run with redirected handles (for example, by QProcess).
548 static inline bool displayMessageBox()
549 {
550  if (GetConsoleWindow())
551  return false;
552  STARTUPINFO startupInfo;
553  startupInfo.cb = sizeof(STARTUPINFO);
554  GetStartupInfo(&startupInfo);
555  return !(startupInfo.dwFlags & STARTF_USESTDHANDLES);
556 }
557 #endif // Q_OS_WIN && !QT_BOOTSTRAPPED
558 
559 static void showParserMessage(const QString &message, MessageType type)
560 {
561 #if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED)
562  if (displayMessageBox()) {
563  const UINT flags = MB_OK | MB_TOPMOST | MB_SETFOREGROUND
564  | (type == UsageMessage ? MB_ICONINFORMATION : MB_ICONERROR);
565  QString title;
567  title = QCoreApplication::instance()->property("applicationDisplayName").toString();
568  if (title.isEmpty())
570  MessageBoxW(0, reinterpret_cast<const wchar_t *>(message.utf16()),
571  reinterpret_cast<const wchar_t *>(title.utf16()), flags);
572  return;
573  }
574 #endif // Q_OS_WIN && !QT_BOOTSTRAPPED
575  fputs(qPrintable(message), type == UsageMessage ? stdout : stderr);
576 }
577 
593 {
594  if (!d->parse(arguments)) {
595  showParserMessage(QCoreApplication::applicationName() + QLatin1String(": ") + errorText() + QLatin1Char('\n'), ErrorMessage);
597  ::exit(EXIT_FAILURE);
598  }
599 
600  if (d->builtinVersionOption && isSet(QStringLiteral("version")))
601  showVersion();
602 
603  if (d->builtinHelpOption && isSet(QStringLiteral("help")))
604  d->showHelp(EXIT_SUCCESS, false);
605 
606  if (d->builtinHelpOption && isSet(QStringLiteral("help-all")))
607  d->showHelp(EXIT_SUCCESS, true);
608 }
609 
616 {
617  // QCoreApplication::arguments() is static, but the app instance must exist so we require it as parameter
618  Q_UNUSED(app);
620 }
621 
623 {
624  if (needsParsing)
625  qWarning("QCommandLineParser: call process() or parse() before %s", method);
626 }
627 
634 {
635  if (nameHash.contains(optionName)) {
636  optionNames.append(optionName);
637  return true;
638  } else {
639  unknownOptionNames.append(optionName);
640  return false;
641  }
642 }
643 
657  QStringList::const_iterator *argumentIterator, QStringList::const_iterator argsEnd)
658 {
659  const QLatin1Char assignChar('=');
660  const NameHash_t::const_iterator nameHashIt = nameHash.constFind(optionName);
661  if (nameHashIt != nameHash.constEnd()) {
662  const int assignPos = argument.indexOf(assignChar);
663  const NameHash_t::mapped_type optionOffset = *nameHashIt;
664  const bool withValue = !commandLineOptionList.at(optionOffset).valueName().isEmpty();
665  if (withValue) {
666  if (assignPos == -1) {
667  ++(*argumentIterator);
668  if (*argumentIterator == argsEnd) {
669  errorText = QCommandLineParser::tr("Missing value after '%1'.").arg(argument);
670  return false;
671  }
672  optionValuesHash[optionOffset].append(*(*argumentIterator));
673  } else {
674  optionValuesHash[optionOffset].append(argument.mid(assignPos + 1));
675  }
676  } else {
677  if (assignPos != -1) {
678  errorText = QCommandLineParser::tr("Unexpected value after '%1'.").arg(argument.left(assignPos));
679  return false;
680  }
681  }
682  }
683  return true;
684 }
685 
698 {
699  needsParsing = false;
700  bool error = false;
701 
702  const QString doubleDashString(QStringLiteral("--"));
703  const QLatin1Char dashChar('-');
704  const QLatin1Char assignChar('=');
705 
706  bool forcePositional = false;
707  errorText.clear();
708  positionalArgumentList.clear();
709  optionNames.clear();
710  unknownOptionNames.clear();
712 
713  if (args.isEmpty()) {
714  qWarning("QCommandLineParser: argument list cannot be empty, it should contain at least the executable name");
715  return false;
716  }
717 
718  QStringList::const_iterator argumentIterator = args.begin();
719  ++argumentIterator; // skip executable name
720 
721  for (; argumentIterator != args.end() ; ++argumentIterator) {
722  QString argument = *argumentIterator;
723 
724  if (forcePositional) {
726  } else if (argument.startsWith(doubleDashString)) {
727  if (argument.length() > 2) {
728  QString optionName = argument.mid(2).section(assignChar, 0, 0);
729  if (registerFoundOption(optionName)) {
730  if (!parseOptionValue(optionName, argument, &argumentIterator, args.end()))
731  error = true;
732  } else {
733  error = true;
734  }
735  } else {
736  forcePositional = true;
737  }
738  } else if (argument.startsWith(dashChar)) {
739  if (argument.size() == 1) { // single dash ("stdin")
741  continue;
742  }
743  switch (singleDashWordOptionMode) {
745  {
746  QString optionName;
747  bool valueFound = false;
748  for (int pos = 1 ; pos < argument.size(); ++pos) {
749  optionName = argument.mid(pos, 1);
750  if (!registerFoundOption(optionName)) {
751  error = true;
752  } else {
753  const NameHash_t::const_iterator nameHashIt = nameHash.constFind(optionName);
754  Q_ASSERT(nameHashIt != nameHash.constEnd()); // checked by registerFoundOption
755  const NameHash_t::mapped_type optionOffset = *nameHashIt;
756  const bool withValue = !commandLineOptionList.at(optionOffset).valueName().isEmpty();
757  if (withValue) {
758  if (pos + 1 < argument.size()) {
759  if (argument.at(pos + 1) == assignChar)
760  ++pos;
761  optionValuesHash[optionOffset].append(argument.mid(pos + 1));
762  valueFound = true;
763  }
764  break;
765  }
766  if (pos + 1 < argument.size() && argument.at(pos + 1) == assignChar)
767  break;
768  }
769  }
770  if (!valueFound && !parseOptionValue(optionName, argument, &argumentIterator, args.end()))
771  error = true;
772  break;
773  }
775  {
776  if (argument.size() > 2) {
777  const QString possibleShortOptionStyleName = argument.mid(1, 1);
778  const auto shortOptionIt = nameHash.constFind(possibleShortOptionStyleName);
779  if (shortOptionIt != nameHash.constEnd()) {
780  const auto &arg = commandLineOptionList.at(*shortOptionIt);
782  registerFoundOption(possibleShortOptionStyleName);
783  optionValuesHash[*shortOptionIt].append(argument.mid(2));
784  break;
785  }
786  }
787  }
788  const QString optionName = argument.mid(1).section(assignChar, 0, 0);
789  if (registerFoundOption(optionName)) {
790  if (!parseOptionValue(optionName, argument, &argumentIterator, args.end()))
791  error = true;
792  } else {
793  error = true;
794  }
795  break;
796  }
797  }
798  } else {
801  forcePositional = true;
802  }
803  if (argumentIterator == args.end())
804  break;
805  }
806  return !error;
807 }
808 
824 {
825  d->checkParsed("isSet");
826  if (d->optionNames.contains(name))
827  return true;
828  const QStringList aliases = d->aliases(name);
829  for (const QString &optionName : qAsConst(d->optionNames)) {
830  if (aliases.contains(optionName))
831  return true;
832  }
833  return false;
834 }
835 
854 QString QCommandLineParser::value(const QString &optionName) const
855 {
856  d->checkParsed("value");
857  const QStringList valueList = values(optionName);
858 
859  if (!valueList.isEmpty())
860  return valueList.last();
861 
862  return QString();
863 }
864 
884 {
885  d->checkParsed("values");
886  const NameHash_t::const_iterator it = d->nameHash.constFind(optionName);
887  if (it != d->nameHash.cend()) {
888  const int optionOffset = *it;
889  QStringList values = d->optionValuesHash.value(optionOffset);
890  if (values.isEmpty())
891  values = d->commandLineOptionList.at(optionOffset).defaultValues();
892  return values;
893  }
894 
895  qWarning("QCommandLineParser: option not defined: \"%ls\"", qUtf16Printable(optionName));
896  return QStringList();
897 }
898 
911 {
912  // option.names() might be empty if the constructor failed
913  const auto names = option.names();
914  return !names.isEmpty() && isSet(names.first());
915 }
916 
931 {
932  return value(option.names().constFirst());
933 }
934 
949 {
950  return values(option.names().constFirst());
951 }
952 
961 {
962  d->checkParsed("positionalArguments");
963  return d->positionalArgumentList;
964 }
965 
983 {
984  d->checkParsed("optionNames");
985  return d->optionNames;
986 }
987 
1003 {
1004  d->checkParsed("unknownOptionNames");
1005  return d->unknownOptionNames;
1006 }
1007 
1019 {
1020  showParserMessage(QCoreApplication::applicationName() + QLatin1Char(' ')
1022  UsageMessage);
1024  ::exit(EXIT_SUCCESS);
1025 }
1026 
1039 {
1040  d->showHelp(exitCode, false);
1041 }
1042 
1043 Q_NORETURN void QCommandLineParserPrivate::showHelp(int exitCode, bool includeQtOptions)
1044 {
1045  showParserMessage(helpText(includeQtOptions), UsageMessage);
1047  ::exit(exitCode);
1048 }
1049 
1056 {
1057  return d->helpText(false);
1058 }
1059 
1060 static QString wrapText(const QString &names, int optionNameMaxWidth, const QString &description)
1061 {
1062  const QLatin1Char nl('\n');
1063  const QLatin1String indentation(" ");
1064 
1065  // In case the list of option names is very long, wrap it as well
1066  int nameIndex = 0;
1067  auto nextNameSection = [&]() {
1068  QString section = names.mid(nameIndex, optionNameMaxWidth);
1069  nameIndex += section.size();
1070  return section;
1071  };
1072 
1073  QString text;
1074  int lineStart = 0;
1075  int lastBreakable = -1;
1076  const int max = 79 - (indentation.size() + optionNameMaxWidth + 1);
1077  int x = 0;
1078  const int len = description.length();
1079 
1080  for (int i = 0; i < len; ++i) {
1081  ++x;
1082  const QChar c = description.at(i);
1083  if (c.isSpace())
1084  lastBreakable = i;
1085 
1086  int breakAt = -1;
1087  int nextLineStart = -1;
1088  if (x > max && lastBreakable != -1) {
1089  // time to break and we know where
1090  breakAt = lastBreakable;
1091  nextLineStart = lastBreakable + 1;
1092  } else if ((x > max - 1 && lastBreakable == -1) || i == len - 1) {
1093  // time to break but found nowhere [-> break here], or end of last line
1094  breakAt = i + 1;
1095  nextLineStart = breakAt;
1096  } else if (c == nl) {
1097  // forced break
1098  breakAt = i;
1099  nextLineStart = i + 1;
1100  }
1101 
1102  if (breakAt != -1) {
1103  const int numChars = breakAt - lineStart;
1104  //qDebug() << "breakAt=" << description.at(breakAt) << "breakAtSpace=" << breakAtSpace << lineStart << "to" << breakAt << description.mid(lineStart, numChars);
1105  text += indentation + nextNameSection().leftJustified(optionNameMaxWidth) + QLatin1Char(' ');
1106  text += QStringView{description}.mid(lineStart, numChars) + nl;
1107  x = 0;
1108  lastBreakable = -1;
1109  lineStart = nextLineStart;
1110  if (lineStart < len && description.at(lineStart).isSpace())
1111  ++lineStart; // don't start a line with a space
1112  i = lineStart;
1113  }
1114  }
1115 
1116  while (nameIndex < names.size()) {
1117  text += indentation + nextNameSection() + nl;
1118  }
1119 
1120  return text;
1121 }
1122 
1123 QString QCommandLineParserPrivate::helpText(bool includeQtOptions) const
1124 {
1125  const QLatin1Char nl('\n');
1126  QString text;
1127  QString usage;
1128  // executable name
1129  usage += qApp ? QCoreApplication::arguments().constFirst() : QStringLiteral("<executable_name>");
1131  if (includeQtOptions && qApp)
1132  qApp->d_func()->addQtOptions(&options);
1133  if (!options.isEmpty())
1134  usage += QLatin1Char(' ') + QCommandLineParser::tr("[options]");
1136  usage += QLatin1Char(' ') + arg.syntax;
1137  text += QCommandLineParser::tr("Usage: %1").arg(usage) + nl;
1138  if (!description.isEmpty())
1139  text += description + nl;
1140  text += nl;
1141  if (!options.isEmpty())
1142  text += QCommandLineParser::tr("Options:") + nl;
1143  QStringList optionNameList;
1144  optionNameList.reserve(options.size());
1145  int longestOptionNameString = 0;
1146  for (const QCommandLineOption &option : qAsConst(options)) {
1148  continue;
1149  const QStringList optionNames = option.names();
1150  QString optionNamesString;
1151  for (const QString &optionName : optionNames) {
1152  const int numDashes = optionName.length() == 1 ? 1 : 2;
1153  optionNamesString += QLatin1String("--", numDashes) + optionName + QLatin1String(", ");
1154  }
1155  if (!optionNames.isEmpty())
1156  optionNamesString.chop(2); // remove trailing ", "
1157  const auto valueName = option.valueName();
1158  if (!valueName.isEmpty())
1159  optionNamesString += QLatin1String(" <") + valueName + QLatin1Char('>');
1160  optionNameList.append(optionNamesString);
1161  longestOptionNameString = qMax(longestOptionNameString, optionNamesString.length());
1162  }
1163  ++longestOptionNameString;
1164  const int optionNameMaxWidth = qMin(50, longestOptionNameString);
1165  auto optionNameIterator = optionNameList.cbegin();
1166  for (const QCommandLineOption &option : qAsConst(options)) {
1168  continue;
1169  text += wrapText(*optionNameIterator, optionNameMaxWidth, option.description());
1170  ++optionNameIterator;
1171  }
1172  if (!positionalArgumentDefinitions.isEmpty()) {
1173  if (!options.isEmpty())
1174  text += nl;
1175  text += QCommandLineParser::tr("Arguments:") + nl;
1177  text += wrapText(arg.name, optionNameMaxWidth, arg.description);
1178  }
1179  return text;
1180 }
1181 
small capitals from c petite p scientific i
[1]
Definition: afcover.h:80
FT_Error error
Definition: cffdrivr.c:657
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:84
constexpr bool isSpace() const noexcept
Definition: qchar.h:497
The QCommandLineOption class defines a possible command-line option. \inmodule QtCore.
QString valueName() const
QStringList defaultValues() const
QStringList names() const
The QCommandLineParser class provides a means for handling the command line options.
QString value(const QString &name) const
bool parse(const QStringList &arguments)
void addPositionalArgument(const QString &name, const QString &description, const QString &syntax=QString())
QString applicationDescription() const
QStringList positionalArguments() const
QStringList unknownOptionNames() const
void setSingleDashWordOptionMode(SingleDashWordOptionMode parsingMode)
Q_NORETURN void showVersion()
QStringList values(const QString &name) const
void setApplicationDescription(const QString &description)
bool addOptions(const QList< QCommandLineOption > &options)
bool addOption(const QCommandLineOption &commandLineOption)
Q_NORETURN void showHelp(int exitCode=0)
QString errorText() const
bool isSet(const QString &name) const
QStringList optionNames() const
void process(const QStringList &arguments)
void setOptionsAfterPositionalArgumentsMode(OptionsAfterPositionalArgumentsMode mode)
QCommandLineOption addVersionOption()
QCommandLineOption addHelpOption()
QStringList aliases(const QString &name) const
bool parseOptionValue(const QString &optionName, const QString &argument, QStringList::const_iterator *argumentIterator, QStringList::const_iterator argsEnd)
bool registerFoundOption(const QString &optionName)
NameHash_t nameHash
Hash mapping option names to their offsets in commandLineOptionList and optionArgumentList.
bool builtinVersionOption
Whether addVersionOption was called.
QStringList optionNames
Names of options found on the command line.
QString helpText(bool includeQtOptions) const
QString description
Application description.
bool needsParsing
True if parse() needs to be called.
void checkParsed(const char *method)
QCommandLineParser::SingleDashWordOptionMode singleDashWordOptionMode
The parsing mode for "-abc".
bool parse(const QStringList &args)
bool builtinHelpOption
Whether addHelpOption was called.
QStringList unknownOptionNames
Names of options which were unknown.
QCommandLineParser::OptionsAfterPositionalArgumentsMode optionsAfterPositionalArgumentsMode
How to parse "arg -option".
QStringList positionalArgumentList
Arguments which did not belong to any option.
QList< PositionalArgumentDefinition > positionalArgumentDefinitions
Q_NORETURN void showHelp(int exitCode, bool includeQtOptions)
QList< QCommandLineOption > commandLineOptionList
The command line options used for parsing.
QHash< int, QStringList > optionValuesHash
Option values found (only for options with a value)
QString errorText
Error text set when parse() returns false.
The QCoreApplication class provides an event loop for Qt applications without UI.
static QCoreApplication * instance()
QString applicationVersion
the version of this application
static QStringList arguments()
QString applicationName
the name of this application
const_iterator constFind(const Key &key) const noexcept
Definition: qhash.h:1224
const_iterator constEnd() const noexcept
Definition: qhash.h:1162
bool contains(const Key &key) const noexcept
Definition: qhash.h:944
T value(const Key &key) const noexcept
Definition: qhash.h:997
friend class const_iterator
Definition: qhash.h:1125
const_iterator cend() const noexcept
Definition: qhash.h:1161
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Definition: qhash.h:904
iterator insert(const Key &key, const T &value)
Definition: qhash.h:1228
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
Definition: qstring.h:84
qsizetype size() const noexcept
Definition: qlist.h:414
bool isEmpty() const noexcept
Definition: qlist.h:418
iterator end()
Definition: qlist.h:624
const_reference at(qsizetype i) const noexcept
Definition: qlist.h:457
iterator begin()
Definition: qlist.h:623
void append(parameter_type t)
Definition: qlist.h:469
QVariant property(const char *name) const
Definition: qobject.cpp:4118
The QString class provides a Unicode character string.
Definition: qstring.h:388
QString leftJustified(qsizetype width, QChar fill=QLatin1Char(' '), bool trunc=false) const
Definition: qstring.cpp:6518
void chop(qsizetype n)
Definition: qstring.cpp:5955
const ushort * utf16() const
Definition: qstring.cpp:6491
void clear()
Definition: qstring.h:1240
qsizetype size() const
Definition: qstring.h:413
QString mid(qsizetype position, qsizetype n=-1) const
Definition: qstring.cpp:4994
const QChar at(qsizetype i) const
Definition: qstring.h:1212
bool isEmpty() const
Definition: qstring.h:1216
qsizetype length() const
Definition: qstring.h:415
The QStringList class provides a list of strings.
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QStrin...
Definition: qstringview.h:122
QString toString() const
Definition: qvariant.cpp:1416
QString text
[meta data]
QList< QVariant > arguments
QStyleOptionButton opt
#define true
Definition: ftrandom.c:51
#define EXIT_FAILURE
Definition: jerror.c:35
typename C::const_iterator const_iterator
#define QString()
Definition: parse-defines.h:51
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld endif[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld SRC pixld MASK if DST_R else pixld DST_R endif if
Q_DECLARE_TYPEINFO(QCommandLineParserPrivate::PositionalArgumentDefinition, Q_RELOCATABLE_TYPE)
QHash< QString, int > NameHash_t
@ UsageMessage
@ ErrorMessage
QT_BEGIN_NAMESPACE void Q_CORE_EXPORT qt_call_post_routines()
#define Q_NORETURN
QList< QString > QStringList
Definition: qcontainerfwd.h:64
#define qApp
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
@ text
#define qWarning
Definition: qlogging.h:179
GLenum type
Definition: qopengl.h:270
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: qopengl.h:270
GLenum GLsizei GLsizei GLint * values
[16]
GLint GLint GLint GLint GLint x
[0]
GLuint GLuint end
GLbitfield flags
GLenum GLuint GLintptr offset
GLuint name
const GLubyte * c
Definition: qopenglext.h:12701
GLuint GLuint * names
Definition: qopenglext.h:5654
GLenum GLsizei len
Definition: qopenglext.h:3292
GLuint64EXT * result
[6]
Definition: qopenglext.h:10932
GLuint GLenum option
Definition: qopenglext.h:5929
GLsizeiptr const void GLenum usage
Definition: qopenglext.h:543
#define Q_ASSERT(cond)
Definition: qrandom.cpp:84
SSL_CTX int(*) void arg)
#define QStringLiteral(str)
#define tr(X)
@ Q_RELOCATABLE_TYPE
Definition: qtypeinfo.h:156
Q_UNUSED(salary)
[21]
QString title
[35]
QApplication app(argc, argv)
[0]
QDBusArgument argument
QStringList::Iterator it
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:53