[][src]Struct qt_core::QCommandLineOption

#[repr(C)]
pub struct QCommandLineOption { /* fields omitted */ }

The QCommandLineOption class defines a possible command-line option.

C++ class: QCommandLineOption.

C++ documentation:

The QCommandLineOption class defines a possible command-line option.

This class is used to describe an option on the command line. It allows different ways of defining the same option with multiple aliases possible. It is also used to describe how the option is used - it may be a flag (e.g. -v) or take a value (e.g. -o file).

Examples:

QCommandLineOption verboseOption("verbose", "Verbose mode. Prints out more information."); QCommandLineOption outputOption(QStringList() << "o" << "output", "Write generated data into <file>.", "file");

Methods

impl QCommandLineOption[src]

pub unsafe fn copy_from(
    &mut self,
    other: impl CastInto<Ref<QCommandLineOption>>
) -> MutRef<QCommandLineOption>
[src]

Makes a copy of the other object and assigns it to this QCommandLineOption object.

Calls C++ function: QCommandLineOption& QCommandLineOption::operator=(const QCommandLineOption& other).

C++ documentation:

Makes a copy of the other object and assigns it to this QCommandLineOption object.

pub unsafe fn default_values(&self) -> CppBox<QStringList>[src]

Returns the default values set for this option.

Calls C++ function: QStringList QCommandLineOption::defaultValues() const.

C++ documentation:

Returns the default values set for this option.

See also setDefaultValues().

pub unsafe fn description(&self) -> CppBox<QString>[src]

Returns the description set for this option.

Calls C++ function: QString QCommandLineOption::description() const.

C++ documentation:

Returns the description set for this option.

See also setDescription().

pub unsafe fn flags(&self) -> QFlags<Flag>[src]

Returns a set of flags that affect this command-line option.

Calls C++ function: QFlags<QCommandLineOption::Flag> QCommandLineOption::flags() const.

C++ documentation:

Returns a set of flags that affect this command-line option.

This function was introduced in Qt 5.8.

See also setFlags() and QCommandLineOption::Flags.

pub unsafe fn is_hidden(&self) -> bool[src]

Returns true if this option is omitted from the help output, false if the option is listed.

Calls C++ function: bool QCommandLineOption::isHidden() const.

C++ documentation:

Returns true if this option is omitted from the help output, false if the option is listed.

This function was introduced in Qt 5.6.

See also setHidden() and QCommandLineOption::HiddenFromHelp.

pub unsafe fn names(&self) -> CppBox<QStringList>[src]

Returns the names set for this option.

Calls C++ function: QStringList QCommandLineOption::names() const.

C++ documentation:

Returns the names set for this option.

pub unsafe fn from_q_string(
    name: impl CastInto<Ref<QString>>
) -> CppBox<QCommandLineOption>
[src]

Constructs a command line option object with the name name.

Calls C++ function: [constructor] void QCommandLineOption::QCommandLineOption(const QString& name).

C++ documentation:

Constructs a command line option object with the name name.

The name can be either short or long. If the name is one character in length, it is considered a short name. Option names must not be empty, must not start with a dash or a slash character, must not contain a = and cannot be repeated.

See also setDescription(), setValueName(), and setDefaultValues().

pub unsafe fn from_q_string_list(
    names: impl CastInto<Ref<QStringList>>
) -> CppBox<QCommandLineOption>
[src]

Constructs a command line option object with the names names.

Calls C++ function: [constructor] void QCommandLineOption::QCommandLineOption(const QStringList& names).

C++ documentation:

Constructs a command line option object with the names names.

This overload allows to set multiple names for the option, for instance o and output.

The names can be either short or long. Any name in the list that is one character in length is a short name. Option names must not be empty, must not start with a dash or a slash character, must not contain a = and cannot be repeated.

See also setDescription(), setValueName(), and setDefaultValues().

pub unsafe fn from_4_q_string(
    name: impl CastInto<Ref<QString>>,
    description: impl CastInto<Ref<QString>>,
    value_name: impl CastInto<Ref<QString>>,
    default_value: impl CastInto<Ref<QString>>
) -> CppBox<QCommandLineOption>
[src]

Constructs a command line option object with the given arguments.

Calls C++ function: [constructor] void QCommandLineOption::QCommandLineOption(const QString& name, const QString& description, const QString& valueName = …, const QString& defaultValue = …).

C++ documentation:

Constructs a command line option object with the given arguments.

The name of the option is set to name. The name can be either short or long. If the name is one character in length, it is considered a short name. Option names must not be empty, must not start with a dash or a slash character, must not contain a = and cannot be repeated.

The description is set to description. It is customary to add a "." at the end of the description.

In addition, the valueName needs to be set if the option expects a value. The default value for the option is set to defaultValue.

In Qt versions before 5.4, this constructor was explicit. In Qt 5.4 and later, it no longer is and can be used for C++11-style uniform initialization:

QCommandLineParser parser; parser.addOption({"verbose", "Verbose mode. Prints out more information."});

See also setDescription(), setValueName(), and setDefaultValues().

pub unsafe fn from_q_string_list3_q_string(
    names: impl CastInto<Ref<QStringList>>,
    description: impl CastInto<Ref<QString>>,
    value_name: impl CastInto<Ref<QString>>,
    default_value: impl CastInto<Ref<QString>>
) -> CppBox<QCommandLineOption>
[src]

Constructs a command line option object with the given arguments.

Calls C++ function: [constructor] void QCommandLineOption::QCommandLineOption(const QStringList& names, const QString& description, const QString& valueName = …, const QString& defaultValue = …).

C++ documentation:

Constructs a command line option object with the given arguments.

This overload allows to set multiple names for the option, for instance o and output.

The names of the option are set to names. The names can be either short or long. Any name in the list that is one character in length is a short name. Option names must not be empty, must not start with a dash or a slash character, must not contain a = and cannot be repeated.

The description is set to description. It is customary to add a "." at the end of the description.

In addition, the valueName needs to be set if the option expects a value. The default value for the option is set to defaultValue.

In Qt versions before 5.4, this constructor was explicit. In Qt 5.4 and later, it no longer is and can be used for C++11-style uniform initialization:

QCommandLineParser parser; parser.addOption({{"o", "output"}, "Write generated data into <file>.", "file"});

See also setDescription(), setValueName(), and setDefaultValues().

pub unsafe fn from_3_q_string(
    name: impl CastInto<Ref<QString>>,
    description: impl CastInto<Ref<QString>>,
    value_name: impl CastInto<Ref<QString>>
) -> CppBox<QCommandLineOption>
[src]

Constructs a command line option object with the given arguments.

Calls C++ function: [constructor] void QCommandLineOption::QCommandLineOption(const QString& name, const QString& description, const QString& valueName = …).

C++ documentation:

Constructs a command line option object with the given arguments.

The name of the option is set to name. The name can be either short or long. If the name is one character in length, it is considered a short name. Option names must not be empty, must not start with a dash or a slash character, must not contain a = and cannot be repeated.

The description is set to description. It is customary to add a "." at the end of the description.

In addition, the valueName needs to be set if the option expects a value. The default value for the option is set to defaultValue.

In Qt versions before 5.4, this constructor was explicit. In Qt 5.4 and later, it no longer is and can be used for C++11-style uniform initialization:

QCommandLineParser parser; parser.addOption({"verbose", "Verbose mode. Prints out more information."});

See also setDescription(), setValueName(), and setDefaultValues().

pub unsafe fn from_2_q_string(
    name: impl CastInto<Ref<QString>>,
    description: impl CastInto<Ref<QString>>
) -> CppBox<QCommandLineOption>
[src]

Constructs a command line option object with the given arguments.

Calls C++ function: [constructor] void QCommandLineOption::QCommandLineOption(const QString& name, const QString& description).

C++ documentation:

Constructs a command line option object with the given arguments.

The name of the option is set to name. The name can be either short or long. If the name is one character in length, it is considered a short name. Option names must not be empty, must not start with a dash or a slash character, must not contain a = and cannot be repeated.

The description is set to description. It is customary to add a "." at the end of the description.

In addition, the valueName needs to be set if the option expects a value. The default value for the option is set to defaultValue.

In Qt versions before 5.4, this constructor was explicit. In Qt 5.4 and later, it no longer is and can be used for C++11-style uniform initialization:

QCommandLineParser parser; parser.addOption({"verbose", "Verbose mode. Prints out more information."});

See also setDescription(), setValueName(), and setDefaultValues().

pub unsafe fn from_q_string_list2_q_string(
    names: impl CastInto<Ref<QStringList>>,
    description: impl CastInto<Ref<QString>>,
    value_name: impl CastInto<Ref<QString>>
) -> CppBox<QCommandLineOption>
[src]

Constructs a command line option object with the given arguments.

Calls C++ function: [constructor] void QCommandLineOption::QCommandLineOption(const QStringList& names, const QString& description, const QString& valueName = …).

C++ documentation:

Constructs a command line option object with the given arguments.

This overload allows to set multiple names for the option, for instance o and output.

The names of the option are set to names. The names can be either short or long. Any name in the list that is one character in length is a short name. Option names must not be empty, must not start with a dash or a slash character, must not contain a = and cannot be repeated.

The description is set to description. It is customary to add a "." at the end of the description.

In addition, the valueName needs to be set if the option expects a value. The default value for the option is set to defaultValue.

In Qt versions before 5.4, this constructor was explicit. In Qt 5.4 and later, it no longer is and can be used for C++11-style uniform initialization:

QCommandLineParser parser; parser.addOption({{"o", "output"}, "Write generated data into <file>.", "file"});

See also setDescription(), setValueName(), and setDefaultValues().

pub unsafe fn from_q_string_list_q_string(
    names: impl CastInto<Ref<QStringList>>,
    description: impl CastInto<Ref<QString>>
) -> CppBox<QCommandLineOption>
[src]

Constructs a command line option object with the given arguments.

Calls C++ function: [constructor] void QCommandLineOption::QCommandLineOption(const QStringList& names, const QString& description).

C++ documentation:

Constructs a command line option object with the given arguments.

This overload allows to set multiple names for the option, for instance o and output.

The names of the option are set to names. The names can be either short or long. Any name in the list that is one character in length is a short name. Option names must not be empty, must not start with a dash or a slash character, must not contain a = and cannot be repeated.

The description is set to description. It is customary to add a "." at the end of the description.

In addition, the valueName needs to be set if the option expects a value. The default value for the option is set to defaultValue.

In Qt versions before 5.4, this constructor was explicit. In Qt 5.4 and later, it no longer is and can be used for C++11-style uniform initialization:

QCommandLineParser parser; parser.addOption({{"o", "output"}, "Write generated data into <file>.", "file"});

See also setDescription(), setValueName(), and setDefaultValues().

pub unsafe fn new_copy(
    other: impl CastInto<Ref<QCommandLineOption>>
) -> CppBox<QCommandLineOption>
[src]

Constructs a QCommandLineOption object that is a copy of the QCommandLineOption object other.

Calls C++ function: [constructor] void QCommandLineOption::QCommandLineOption(const QCommandLineOption& other).

C++ documentation:

Constructs a QCommandLineOption object that is a copy of the QCommandLineOption object other.

See also operator=().

pub unsafe fn set_default_value(
    &mut self,
    default_value: impl CastInto<Ref<QString>>
)
[src]

Sets the default value used for this option to defaultValue.

Calls C++ function: void QCommandLineOption::setDefaultValue(const QString& defaultValue).

C++ documentation:

Sets the default value used for this option to defaultValue.

The default value is used if the user of the application does not specify the option on the command line.

If defaultValue is empty, the option has no default values.

See also defaultValues() and setDefaultValues().

pub unsafe fn set_default_values(
    &mut self,
    default_values: impl CastInto<Ref<QStringList>>
)
[src]

Sets the list of default values used for this option to defaultValues.

Calls C++ function: void QCommandLineOption::setDefaultValues(const QStringList& defaultValues).

C++ documentation:

Sets the list of default values used for this option to defaultValues.

The default values are used if the user of the application does not specify the option on the command line.

See also defaultValues() and setDefaultValue().

pub unsafe fn set_description(
    &mut self,
    description: impl CastInto<Ref<QString>>
)
[src]

Sets the description used for this option to description.

Calls C++ function: void QCommandLineOption::setDescription(const QString& description).

C++ documentation:

Sets the description used for this option to description.

It is customary to add a "." at the end of the description.

The description is used by QCommandLineParser::showHelp().

See also description().

pub unsafe fn set_flags(&mut self, aflags: QFlags<Flag>)[src]

Set the set of flags that affect this command-line option to flags.

Calls C++ function: void QCommandLineOption::setFlags(QFlags<QCommandLineOption::Flag> aflags).

C++ documentation:

Set the set of flags that affect this command-line option to flags.

This function was introduced in Qt 5.8.

See also flags() and QCommandLineOption::Flags.

pub unsafe fn set_hidden(&mut self, hidden: bool)[src]

Sets whether to hide this option in the user-visible help output.

Calls C++ function: void QCommandLineOption::setHidden(bool hidden).

C++ documentation:

Sets whether to hide this option in the user-visible help output.

All options are visible by default. Setting hide to true for a particular option makes it internal, i.e. not listed in the help output.

This function was introduced in Qt 5.6.

See also isHidden.

pub unsafe fn set_value_name(&mut self, name: impl CastInto<Ref<QString>>)[src]

Sets the name of the expected value, for the documentation, to valueName.

Calls C++ function: void QCommandLineOption::setValueName(const QString& name).

C++ documentation:

Sets the name of the expected value, for the documentation, to valueName.

Options without a value assigned have a boolean-like behavior: either the user specifies --option or they don't.

Options with a value assigned need to set a name for the expected value, for the documentation of the option in the help output. An option with names o and output, and a value name of file will appear as -o, --output <file>.

Call QCommandLineParser::value() if you expect the option to be present only once, and QCommandLineParser::values() if you expect that option to be present multiple times.

See also valueName().

pub unsafe fn swap(&mut self, other: impl CastInto<MutRef<QCommandLineOption>>)[src]

Swaps option other with this option. This operation is very fast and never fails.

Calls C++ function: void QCommandLineOption::swap(QCommandLineOption& other).

C++ documentation:

Swaps option other with this option. This operation is very fast and never fails.

pub unsafe fn value_name(&self) -> CppBox<QString>[src]

Returns the name of the expected value.

Calls C++ function: QString QCommandLineOption::valueName() const.

C++ documentation:

Returns the name of the expected value.

If empty, the option doesn't take a value.

See also setValueName().

Trait Implementations

impl CppDeletable for QCommandLineOption[src]

unsafe fn delete(&mut self)[src]

Destroys the command line option object.

Calls C++ function: [destructor] void QCommandLineOption::~QCommandLineOption().

C++ documentation:

Destroys the command line option object.

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]