![]() |
Qt 6.x
The Qt SDK
|
Collaboration diagram for QCommandLineParserPrivate:Classes | |
| struct | PositionalArgumentDefinition |
| Documentation for positional arguments. More... | |
Public Member Functions | |
| QCommandLineParserPrivate () | |
| bool | parse (const QStringList &args) |
| void | checkParsed (const char *method) |
| QStringList | aliases (const QString &name) const |
| QString | helpText (bool includeQtOptions) const |
| bool | registerFoundOption (const QString &optionName) |
| bool | parseOptionValue (const QString &optionName, const QString &argument, QStringList::const_iterator *argumentIterator, QStringList::const_iterator argsEnd) |
| Parse the value for a given option, if it was defined to expect one. | |
| Q_NORETURN void | showHelp (int exitCode, bool includeQtOptions) |
Public Attributes | |
| QString | errorText |
| Error text set when parse() returns false. | |
| QList< QCommandLineOption > | commandLineOptionList |
| The command line options used for parsing. | |
| NameHash_t | nameHash |
| Hash mapping option names to their offsets in commandLineOptionList and optionArgumentList. | |
| QHash< qsizetype, QStringList > | optionValuesHash |
| Option values found (only for options with a value) | |
| QStringList | optionNames |
| Names of options found on the command line. | |
| QStringList | positionalArgumentList |
| Arguments which did not belong to any option. | |
| QStringList | unknownOptionNames |
| Names of options which were unknown. | |
| QString | description |
| Application description. | |
| QList< PositionalArgumentDefinition > | positionalArgumentDefinitions |
| QCommandLineParser::SingleDashWordOptionMode | singleDashWordOptionMode |
| The parsing mode for "-abc". | |
| QCommandLineParser::OptionsAfterPositionalArgumentsMode | optionsAfterPositionalArgumentsMode |
| How to parse "arg -option". | |
| bool | builtinVersionOption |
| Whether addVersionOption was called. | |
| bool | builtinHelpOption |
| Whether addHelpOption was called. | |
| bool | needsParsing |
| True if parse() needs to be called. | |
Definition at line 27 of file qcommandlineparser.cpp.
|
inline |
Definition at line 30 of file qcommandlineparser.cpp.
| QStringList QCommandLineParserPrivate::aliases | ( | const QString & | name | ) | const |
Definition at line 98 of file qcommandlineparser.cpp.
References QList< T >::at(), QHash< Key, T >::cend(), commandLineOptionList, QHash< QString, qsizetype >::const_iterator, QHash< Key, T >::constFind(), it, nameHash, QCommandLineOption::names(), qUtf16Printable, and qWarning.
Referenced by QCommandLineParser::isSet().
Here is the call graph for this function:
Here is the caller graph for this function:| void QCommandLineParserPrivate::checkParsed | ( | const char * | method | ) |
Definition at line 597 of file qcommandlineparser.cpp.
References method, needsParsing, and qWarning.
Referenced by QCommandLineParser::isSet(), QCommandLineParser::optionNames(), QCommandLineParser::positionalArguments(), QCommandLineParser::unknownOptionNames(), QCommandLineParser::value(), and QCommandLineParser::values().
Here is the caller graph for this function:| QString QCommandLineParserPrivate::helpText | ( | bool | includeQtOptions | ) | const |
Definition at line 1098 of file qcommandlineparser.cpp.
References QString::arg(), arg, QCoreApplication::arguments(), QString::chop(), commandLineOptionList, description, QCommandLineOption::HiddenFromHelp, QString::isEmpty(), QList< T >::isEmpty(), optionNames, positionalArgumentDefinitions, qApp, qMax(), qMin(), QStringLiteral, QString::size(), QList< T >::size(), text, and wrapText().
Referenced by QCommandLineParser::helpText(), and showHelp().
Here is the call graph for this function:
Here is the caller graph for this function:| bool QCommandLineParserPrivate::parse | ( | const QStringList & | args | ) |
Parse the list of arguments args, and fills in optionNames, optionValuesHash, unknownOptionNames, positionalArguments, and errorText.
Any results from a previous parse operation are removed.
The parser will not look for further options once it encounters the option {–}; this does not include when {–} follows an option that requires a value.
Definition at line 672 of file qcommandlineparser.cpp.
References arg, args, argument, QList< T >::at(), QList< T >::begin(), QString::clear(), QHash< Key, T >::clear(), commandLineOptionList, QHash< QString, qsizetype >::const_iterator, QHash< Key, T >::constEnd(), QHash< Key, T >::constFind(), QList< T >::end(), error, errorText, QString::isEmpty(), QList< T >::isEmpty(), nameHash, needsParsing, optionNames, optionsAfterPositionalArgumentsMode, optionValuesHash, QCommandLineParser::ParseAsCompactedShortOptions, QCommandLineParser::ParseAsLongOptions, QCommandLineParser::ParseAsPositionalArguments, parseOptionValue(), pos, positionalArgumentList, Q_ASSERT, QStringLiteral, qWarning, registerFoundOption(), QCommandLineOption::ShortOptionStyle, singleDashWordOptionMode, unknownOptionNames, and QCommandLineOption::valueName().
Referenced by QCommandLineParser::parse(), and QCommandLineParser::process().
Here is the call graph for this function:
Here is the caller graph for this function:| bool QCommandLineParserPrivate::parseOptionValue | ( | const QString & | optionName, |
| const QString & | argument, | ||
| QStringList::const_iterator * | argumentIterator, | ||
| QStringList::const_iterator | argsEnd | ||
| ) |
Parse the value for a given option, if it was defined to expect one.
The value is taken from the next argument, or after the equal sign in argument.
| optionName | the short option name |
| argument | the argument from the command line currently parsed. Only used for -k=value parsing. |
| argumentIterator | iterator to the currently parsed argument. Incremented if the next argument contains the value. |
| argsEnd | args.end(), to check if ++argumentIterator goes out of bounds Returns true on success. |
Definition at line 631 of file qcommandlineparser.cpp.
References QString::arg(), argument, QList< T >::at(), commandLineOptionList, QHash< QString, qsizetype >::const_iterator, QHash< Key, T >::constEnd(), QHash< Key, T >::constFind(), errorText, QString::isEmpty(), nameHash, optionValuesHash, and QCommandLineOption::valueName().
Referenced by parse().
Here is the call graph for this function:
Here is the caller graph for this function:| bool QCommandLineParserPrivate::registerFoundOption | ( | const QString & | optionName | ) |
Looks up the option optionName (found on the command line) and register it as found. Returns true on success.
Definition at line 608 of file qcommandlineparser.cpp.
References QHash< Key, T >::contains(), nameHash, optionNames, and unknownOptionNames.
Referenced by parse().
Here is the call graph for this function:
Here is the caller graph for this function:| Q_NORETURN void QCommandLineParserPrivate::showHelp | ( | int | exitCode, |
| bool | includeQtOptions | ||
| ) |
Definition at line 1018 of file qcommandlineparser.cpp.
References helpText(), qt_call_post_routines(), showParserMessage(), and UsageMessage.
Referenced by QCommandLineParser::process(), and QCommandLineParser::showHelp().
Here is the call graph for this function:
Here is the caller graph for this function:| bool QCommandLineParserPrivate::builtinHelpOption |
Whether addHelpOption was called.
Definition at line 91 of file qcommandlineparser.cpp.
Referenced by QCommandLineParser::addHelpOption(), and QCommandLineParser::process().
| bool QCommandLineParserPrivate::builtinVersionOption |
Whether addVersionOption was called.
Definition at line 88 of file qcommandlineparser.cpp.
Referenced by QCommandLineParser::addVersionOption(), and QCommandLineParser::process().
| QList<QCommandLineOption> QCommandLineParserPrivate::commandLineOptionList |
The command line options used for parsing.
Definition at line 52 of file qcommandlineparser.cpp.
Referenced by QCommandLineParser::addOption(), aliases(), helpText(), parse(), parseOptionValue(), and QCommandLineParser::values().
| QString QCommandLineParserPrivate::description |
Application description.
Definition at line 70 of file qcommandlineparser.cpp.
Referenced by QCommandLineParser::applicationDescription(), helpText(), and QCommandLineParser::setApplicationDescription().
| QString QCommandLineParserPrivate::errorText |
Error text set when parse() returns false.
Definition at line 49 of file qcommandlineparser.cpp.
Referenced by QCommandLineParser::errorText(), parse(), and parseOptionValue().
| NameHash_t QCommandLineParserPrivate::nameHash |
Hash mapping option names to their offsets in commandLineOptionList and optionArgumentList.
Definition at line 55 of file qcommandlineparser.cpp.
Referenced by QCommandLineParser::addOption(), aliases(), parse(), parseOptionValue(), registerFoundOption(), and QCommandLineParser::values().
| bool QCommandLineParserPrivate::needsParsing |
True if parse() needs to be called.
Definition at line 94 of file qcommandlineparser.cpp.
Referenced by checkParsed(), and parse().
| QStringList QCommandLineParserPrivate::optionNames |
Names of options found on the command line.
Definition at line 61 of file qcommandlineparser.cpp.
Referenced by helpText(), QCommandLineParser::isSet(), QCommandLineParser::optionNames(), parse(), and registerFoundOption().
| QCommandLineParser::OptionsAfterPositionalArgumentsMode QCommandLineParserPrivate::optionsAfterPositionalArgumentsMode |
How to parse "arg -option".
Definition at line 85 of file qcommandlineparser.cpp.
Referenced by parse(), and QCommandLineParser::setOptionsAfterPositionalArgumentsMode().
| QHash<qsizetype, QStringList> QCommandLineParserPrivate::optionValuesHash |
Option values found (only for options with a value)
Definition at line 58 of file qcommandlineparser.cpp.
Referenced by parse(), parseOptionValue(), and QCommandLineParser::values().
| QList<PositionalArgumentDefinition> QCommandLineParserPrivate::positionalArgumentDefinitions |
Definition at line 79 of file qcommandlineparser.cpp.
Referenced by QCommandLineParser::addPositionalArgument(), QCommandLineParser::clearPositionalArguments(), and helpText().
| QStringList QCommandLineParserPrivate::positionalArgumentList |
Arguments which did not belong to any option.
Definition at line 64 of file qcommandlineparser.cpp.
Referenced by parse(), and QCommandLineParser::positionalArguments().
| QCommandLineParser::SingleDashWordOptionMode QCommandLineParserPrivate::singleDashWordOptionMode |
The parsing mode for "-abc".
Definition at line 82 of file qcommandlineparser.cpp.
Referenced by parse(), and QCommandLineParser::setSingleDashWordOptionMode().
| QStringList QCommandLineParserPrivate::unknownOptionNames |
Names of options which were unknown.
Definition at line 67 of file qcommandlineparser.cpp.
Referenced by QCommandLineParser::errorText(), parse(), registerFoundOption(), and QCommandLineParser::unknownOptionNames().