![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
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) |
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) |
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.
References QCommandLineParserPrivate(), builtinHelpOption, builtinVersionOption, and needsParsing.
Referenced by QCommandLineParserPrivate().
|
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 nameHash.
QStringList QCommandLineParserPrivate::aliases | ( | const QString & | name | ) | const |
void QCommandLineParserPrivate::checkParsed | ( | const char * | method | ) |
Definition at line 631 of file qcommandlineparser.cpp.
References needsParsing.
void QCommandLineParserPrivate::checkParsed | ( | const char * | method | ) |
QString QCommandLineParserPrivate::helpText | ( | bool | includeQtOptions | ) | const |
Definition at line 1141 of file qcommandlineparser.cpp.
QString QCommandLineParserPrivate::helpText | ( | bool | includeQtOptions | ) | const |
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 711 of file qcommandlineparser.cpp.
References nameHash, and needsParsing.
bool QCommandLineParserPrivate::parse | ( | const QStringList & | args | ) |
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 665 of file qcommandlineparser.cpp.
References nameHash.
bool QCommandLineParserPrivate::parseOptionValue | ( | const QString & | optionName, |
const QString & | argument, | ||
QStringList::const_iterator * | argumentIterator, | ||
QStringList::const_iterator | argsEnd ) |
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 642 of file qcommandlineparser.cpp.
References nameHash.
bool QCommandLineParserPrivate::registerFoundOption | ( | const QString & | optionName | ) |
Q_NORETURN void QCommandLineParserPrivate::showHelp | ( | int | exitCode, |
bool | includeQtOptions ) |
Definition at line 1061 of file qcommandlineparser.cpp.
Q_NORETURN void QCommandLineParserPrivate::showHelp | ( | int | exitCode, |
bool | includeQtOptions ) |
bool QCommandLineParserPrivate::builtinHelpOption |
Whether addHelpOption was called.
Definition at line 91 of file qcommandlineparser.cpp.
Referenced by QCommandLineParserPrivate().
bool QCommandLineParserPrivate::builtinVersionOption |
Whether addVersionOption was called.
Definition at line 88 of file qcommandlineparser.cpp.
Referenced by QCommandLineParserPrivate().
QList< QCommandLineOption > QCommandLineParserPrivate::commandLineOptionList |
The command line options used for parsing.
Definition at line 52 of file qcommandlineparser.cpp.
QString QCommandLineParserPrivate::description |
Application description.
Definition at line 70 of file qcommandlineparser.cpp.
QString QCommandLineParserPrivate::errorText |
Error text set when parse() returns false.
Definition at line 49 of file qcommandlineparser.cpp.
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 aliases(), parse(), parseOptionValue(), and registerFoundOption().
bool QCommandLineParserPrivate::needsParsing |
True if parse() needs to be called.
Definition at line 94 of file qcommandlineparser.cpp.
Referenced by QCommandLineParserPrivate(), checkParsed(), and parse().
QStringList QCommandLineParserPrivate::optionNames |
Names of options found on the command line.
Definition at line 61 of file qcommandlineparser.cpp.
QCommandLineParser::OptionsAfterPositionalArgumentsMode QCommandLineParserPrivate::optionsAfterPositionalArgumentsMode |
How to parse "arg -option".
Definition at line 85 of file qcommandlineparser.cpp.
QHash< qsizetype, QStringList > QCommandLineParserPrivate::optionValuesHash |
Option values found (only for options with a value)
Definition at line 58 of file qcommandlineparser.cpp.
QList< PositionalArgumentDefinition > QCommandLineParserPrivate::positionalArgumentDefinitions |
Definition at line 79 of file qcommandlineparser.cpp.
QStringList QCommandLineParserPrivate::positionalArgumentList |
Arguments which did not belong to any option.
Definition at line 64 of file qcommandlineparser.cpp.
QCommandLineParser::SingleDashWordOptionMode QCommandLineParserPrivate::singleDashWordOptionMode |
The parsing mode for "-abc".
Definition at line 82 of file qcommandlineparser.cpp.
QStringList QCommandLineParserPrivate::unknownOptionNames |
Names of options which were unknown.
Definition at line 67 of file qcommandlineparser.cpp.