API reference - Class QCommandLineParser

Notation used in Ruby API documentation

Module: QtCore

Description: Binding of QCommandLineParser

Sub-classes: SingleDashWordOptionMode, QFlags_SingleDashWordOptionMode

Public constructors

new QCommandLineParsernewConstructor QCommandLineParser::QCommandLineParser()

Public methods

void_createEnsures the C++ object is created
void_destroyExplicitly destroys the object
[const]bool_destroyed?Returns a value indicating whether the object was already destroyed
[const]bool_is_const_object?Returns a value indicating whether the reference is a const reference
void_manageMarks the object as managed by the script side.
void_unmanageMarks the object as no longer owned by the script side.
QCommandLineOptionaddHelpOptionMethod QCommandLineOption QCommandLineParser::addHelpOption()
booladdOption(const QCommandLineOption commandLineOption)Method bool QCommandLineParser::addOption(const QCommandLineOption &commandLineOption)
booladdOptions(QCommandLineOption[] options)Method bool QCommandLineParser::addOptions(const QList<QCommandLineOption> &options)
voidaddPositionalArgument(string name,
string description,
string syntax = QString())
Method void QCommandLineParser::addPositionalArgument(const QString &name, const QString &description, const QString &syntax)
QCommandLineOptionaddVersionOptionMethod QCommandLineOption QCommandLineParser::addVersionOption()
[const]stringapplicationDescriptionMethod QString QCommandLineParser::applicationDescription()
voidapplicationDescription=(string description)Method void QCommandLineParser::setApplicationDescription(const QString &description)
voidclearPositionalArgumentsMethod void QCommandLineParser::clearPositionalArguments()
[const]stringerrorTextMethod QString QCommandLineParser::errorText()
[const]stringhelpTextMethod QString QCommandLineParser::helpText()
[const]boolisSet?(string name)Method bool QCommandLineParser::isSet(const QString &name)
[const]boolisSet?(const QCommandLineOption option)Method bool QCommandLineParser::isSet(const QCommandLineOption &option)
[const]string[]optionNamesMethod QStringList QCommandLineParser::optionNames()
boolparse(string[] arguments)Method bool QCommandLineParser::parse(const QStringList &arguments)
[const]string[]positionalArgumentsMethod QStringList QCommandLineParser::positionalArguments()
voidprocess(string[] arguments)Method void QCommandLineParser::process(const QStringList &arguments)
voidprocess(const QCoreApplication app)Method void QCommandLineParser::process(const QCoreApplication &app)
voidsetApplicationDescription(string description)Method void QCommandLineParser::setApplicationDescription(const QString &description)
voidsetSingleDashWordOptionMode(const QCommandLineParser_SingleDashWordOptionMode parsingMode)Method void QCommandLineParser::setSingleDashWordOptionMode(QCommandLineParser::SingleDashWordOptionMode parsingMode)
voidshowHelp(int exitCode = 0)Method void QCommandLineParser::showHelp(int exitCode)
voidshowVersionMethod void QCommandLineParser::showVersion()
[const]string[]unknownOptionNamesMethod QStringList QCommandLineParser::unknownOptionNames()
[const]stringvalue(string name)Method QString QCommandLineParser::value(const QString &name)
[const]stringvalue(const QCommandLineOption option)Method QString QCommandLineParser::value(const QCommandLineOption &option)
[const]string[]values(string name)Method QStringList QCommandLineParser::values(const QString &name)
[const]string[]values(const QCommandLineOption option)Method QStringList QCommandLineParser::values(const QCommandLineOption &option)

Public static methods and constants

[static,const]QCommandLineParser_SingleDashWordOptionModeParseAsCompactedShortOptionsEnum constant QCommandLineParser::ParseAsCompactedShortOptions
[static,const]QCommandLineParser_SingleDashWordOptionModeParseAsLongOptionsEnum constant QCommandLineParser::ParseAsLongOptions
stringtr(string sourceText,
string disambiguation = 0,
int n = -1)
Static method QString QCommandLineParser::tr(const char *sourceText, const char *disambiguation, int n)
stringtrUtf8(string sourceText,
string disambiguation = 0,
int n = -1)
Static method QString QCommandLineParser::trUtf8(const char *sourceText, const char *disambiguation, int n)

Deprecated methods (protected, public, static, non-static and constructors)

voidcreateUse of this method is deprecated. Use _create instead
voiddestroyUse of this method is deprecated. Use _destroy instead
[const]booldestroyed?Use of this method is deprecated. Use _destroyed? instead
[const]boolis_const_object?Use of this method is deprecated. Use _is_const_object? instead

Detailed description

ParseAsCompactedShortOptions

Signature: [static,const] QCommandLineParser_SingleDashWordOptionMode ParseAsCompactedShortOptions

Description: Enum constant QCommandLineParser::ParseAsCompactedShortOptions

Python specific notes:
The object exposes a readable attribute 'ParseAsCompactedShortOptions'. This is the getter.

ParseAsLongOptions

Signature: [static,const] QCommandLineParser_SingleDashWordOptionMode ParseAsLongOptions

Description: Enum constant QCommandLineParser::ParseAsLongOptions

Python specific notes:
The object exposes a readable attribute 'ParseAsLongOptions'. This is the getter.

_create

Signature: void _create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

_destroy

Signature: void _destroy

Description: Explicitly destroys the object

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

_destroyed?

Signature: [const] bool _destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

_is_const_object?

Signature: [const] bool _is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

_manage

Signature: void _manage

Description: Marks the object as managed by the script side.

After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required.

Usually it's not required to call this method. It has been introduced in version 0.24.

_unmanage

Signature: void _unmanage

Description: Marks the object as no longer owned by the script side.

Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur.

Usually it's not required to call this method. It has been introduced in version 0.24.

addHelpOption

Signature: QCommandLineOption addHelpOption

Description: Method QCommandLineOption QCommandLineParser::addHelpOption()

addOption

Signature: bool addOption (const QCommandLineOption commandLineOption)

Description: Method bool QCommandLineParser::addOption(const QCommandLineOption &commandLineOption)

addOptions

Signature: bool addOptions (QCommandLineOption[] options)

Description: Method bool QCommandLineParser::addOptions(const QList<QCommandLineOption> &options)

addPositionalArgument

Signature: void addPositionalArgument (string name, string description, string syntax = QString())

Description: Method void QCommandLineParser::addPositionalArgument(const QString &name, const QString &description, const QString &syntax)

addVersionOption

Signature: QCommandLineOption addVersionOption

Description: Method QCommandLineOption QCommandLineParser::addVersionOption()

applicationDescription

Signature: [const] string applicationDescription

Description: Method QString QCommandLineParser::applicationDescription()

Python specific notes:
The object exposes a readable attribute 'applicationDescription'. This is the getter.

applicationDescription=

Signature: void applicationDescription= (string description)

Description: Method void QCommandLineParser::setApplicationDescription(const QString &description)

Python specific notes:
The object exposes a writable attribute 'applicationDescription'. This is the setter.

clearPositionalArguments

Signature: void clearPositionalArguments

Description: Method void QCommandLineParser::clearPositionalArguments()

create

Signature: void create

Description: Ensures the C++ object is created

Use of this method is deprecated. Use _create instead

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

destroy

Signature: void destroy

Description: Explicitly destroys the object

Use of this method is deprecated. Use _destroy instead

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

destroyed?

Signature: [const] bool destroyed?

Description: Returns a value indicating whether the object was already destroyed

Use of this method is deprecated. Use _destroyed? instead

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

errorText

Signature: [const] string errorText

Description: Method QString QCommandLineParser::errorText()

helpText

Signature: [const] string helpText

Description: Method QString QCommandLineParser::helpText()

isSet?

(1) Signature: [const] bool isSet? (string name)

Description: Method bool QCommandLineParser::isSet(const QString &name)

(2) Signature: [const] bool isSet? (const QCommandLineOption option)

Description: Method bool QCommandLineParser::isSet(const QCommandLineOption &option)

is_const_object?

Signature: [const] bool is_const_object?

Description: Returns a value indicating whether the reference is a const reference

Use of this method is deprecated. Use _is_const_object? instead

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

new

Signature: [static] new QCommandLineParser new

Description: Constructor QCommandLineParser::QCommandLineParser()

This method creates an object of class QCommandLineParser.

Python specific notes:
This method is the default initializer of the object.

optionNames

Signature: [const] string[] optionNames

Description: Method QStringList QCommandLineParser::optionNames()

parse

Signature: bool parse (string[] arguments)

Description: Method bool QCommandLineParser::parse(const QStringList &arguments)

positionalArguments

Signature: [const] string[] positionalArguments

Description: Method QStringList QCommandLineParser::positionalArguments()

process

(1) Signature: void process (string[] arguments)

Description: Method void QCommandLineParser::process(const QStringList &arguments)

(2) Signature: void process (const QCoreApplication app)

Description: Method void QCommandLineParser::process(const QCoreApplication &app)

setApplicationDescription

Signature: void setApplicationDescription (string description)

Description: Method void QCommandLineParser::setApplicationDescription(const QString &description)

Python specific notes:
The object exposes a writable attribute 'applicationDescription'. This is the setter.

setSingleDashWordOptionMode

Signature: void setSingleDashWordOptionMode (const QCommandLineParser_SingleDashWordOptionMode parsingMode)

Description: Method void QCommandLineParser::setSingleDashWordOptionMode(QCommandLineParser::SingleDashWordOptionMode parsingMode)

showHelp

Signature: void showHelp (int exitCode = 0)

Description: Method void QCommandLineParser::showHelp(int exitCode)

showVersion

Signature: void showVersion

Description: Method void QCommandLineParser::showVersion()

tr

Signature: [static] string tr (string sourceText, string disambiguation = 0, int n = -1)

Description: Static method QString QCommandLineParser::tr(const char *sourceText, const char *disambiguation, int n)

This method is static and can be called without an instance.

trUtf8

Signature: [static] string trUtf8 (string sourceText, string disambiguation = 0, int n = -1)

Description: Static method QString QCommandLineParser::trUtf8(const char *sourceText, const char *disambiguation, int n)

This method is static and can be called without an instance.

unknownOptionNames

Signature: [const] string[] unknownOptionNames

Description: Method QStringList QCommandLineParser::unknownOptionNames()

value

(1) Signature: [const] string value (string name)

Description: Method QString QCommandLineParser::value(const QString &name)

(2) Signature: [const] string value (const QCommandLineOption option)

Description: Method QString QCommandLineParser::value(const QCommandLineOption &option)

values

(1) Signature: [const] string[] values (string name)

Description: Method QStringList QCommandLineParser::values(const QString &name)

(2) Signature: [const] string[] values (const QCommandLineOption option)

Description: Method QStringList QCommandLineParser::values(const QCommandLineOption &option)