glibmm 2.78.1

Public Types | Public Member Functions | Protected Attributes | List of all members
Glib::OptionEntry Class Reference

An OptionEntry defines a single option. More...

`#include <glibmm/optionentry.h>`

## Public Types
enum class | Flags { NONE = 0x0 , HIDDEN = 1 << 0 , IN_MAIN = 1 << 1 , REVERSE = 1 << 2 , NO_ARG = 1 << 3 , FILENAME = 1 << 4 , OPTIONAL_ARG = 1 << 5 , NOALIAS = 1 << 6 }

## Public Member Functions
| OptionEntry ()
| OptionEntry (const OptionEntry &src)
| OptionEntry (OptionEntry &&other) noexcept
OptionEntry & | operator= (OptionEntry &&other) noexcept
virtual | ~OptionEntry ()
OptionEntry & | operator= (const OptionEntry &src)
Glib::ustring | get_long_name () const
void | set_long_name (const Glib::ustring & value)
gchar | get_short_name () const
void | set_short_name (const gchar & value)
Flags | get_flags () const
void | set_flags (const Flags & value)
| Set one or more OptionEntry::Flags.
Glib::ustring | get_description () const
void | set_description (const Glib::ustring & value)
Glib::ustring | get_arg_description () const
void | set_arg_description (const Glib::ustring & value)
GOptionEntry * | gobj ()
const GOptionEntry * | gobj () const

## Protected Attributes
GOptionEntry * | gobject_

## Detailed Description

An OptionEntry defines a single option.

To have an effect, it must be added to an OptionGroup with OptionGroup::add_entry().

The long name of an option can be used to specify it in a commandline as –long_name. Every option must have a long name. To resolve conflicts if multiple option groups contain the same long name, it is also possible to specify the option as –groupname-long_name.

If an option has a short name, it can be specified as -short_name in a commandline.

The description for the option is shown in the –help output.

The arg_descripton is the placeholder to use for the extra argument parsed by the option in –help output.

## Member Enumeration Documentation

## ◆ Flags

enum class Glib::OptionEntry::Flags
| strong

Enumerator
NONE | No flags. Since glibmm 2.42
HIDDEN | The option doesn't appear in `--help` output.
IN_MAIN | The option appears in the main section of the `--help` output, even if it is defined in a group.
REVERSE | For options of the G_OPTION_ARG_NONE kind, this flag indicates that the sense of the option is reversed. i.e. `false` will be stored into the argument rather than `true`.
NO_ARG | For options of the G_OPTION_ARG_CALLBACK kind, this flag indicates that the callback does not take any argument (like a G_OPTION_ARG_NONE option). Since glibmm 2.8
FILENAME | For options of the G_OPTION_ARG_CALLBACK kind, this flag indicates that the argument should be passed to the callback in the GLib filename encoding rather than UTF-8. Since glibmm 2.8
OPTIONAL_ARG | For options of the G_OPTION_ARG_CALLBACK kind, this flag indicates that the argument supply is optional. If no argument is given then data of OptionParseFunc will be set to `nullptr`. Since glibmm 2.8
NOALIAS | This flag turns off the automatic conflict resolution which prefixes long option names with `groupname-` if there is a conflict. This option should only be used in situations where aliasing is necessary to model some legacy commandline interface. It is not safe to use this option, unless all option groups are under your direct control. Since glibmm 2.8

## Constructor & Destructor Documentation

## ◆ OptionEntry() [1/3]

Glib::OptionEntry::OptionEntry | ( |  | ) |

## ◆ OptionEntry() [2/3]

Glib::OptionEntry::OptionEntry | ( | const OptionEntry & | src | ) |

## ◆ OptionEntry() [3/3]

Glib::OptionEntry::OptionEntry | ( | OptionEntry && | other | ) |
| noexcept

## ◆ ~OptionEntry()

virtual Glib::OptionEntry::~OptionEntry | ( |  | ) |
| virtual

## Member Function Documentation

## ◆ get_arg_description()

Glib::ustring Glib::OptionEntry::get_arg_description | ( |  | ) | const

## ◆ get_description()

Glib::ustring Glib::OptionEntry::get_description | ( |  | ) | const

## ◆ get_flags()

Flags Glib::OptionEntry::get_flags | ( |  | ) | const

## ◆ get_long_name()

Glib::ustring Glib::OptionEntry::get_long_name | ( |  | ) | const

## ◆ get_short_name()

gchar Glib::OptionEntry::get_short_name | ( |  | ) | const

## ◆ gobj() [1/2]

GOptionEntry * Glib::OptionEntry::gobj | ( |  | ) |
| inline

## ◆ gobj() [2/2]

const GOptionEntry * Glib::OptionEntry::gobj | ( |  | ) | const
| inline

## ◆ operator=() [1/2]

OptionEntry & Glib::OptionEntry::operator= | ( | const OptionEntry & | src | ) |

## ◆ operator=() [2/2]

OptionEntry & Glib::OptionEntry::operator= | ( | OptionEntry && | other | ) |
| noexcept

## ◆ set_arg_description()

void Glib::OptionEntry::set_arg_description | ( | const Glib::ustring & | value | ) |

## ◆ set_description()

void Glib::OptionEntry::set_description | ( | const Glib::ustring & | value | ) |

## ◆ set_flags()

void Glib::OptionEntry::set_flags | ( | const Flags & | value | ) |

Set one or more OptionEntry::Flags.

Do not set Flags::FILENAME. Character encoding is chosen when the OptionEntry is added to an OptionGroup.

## ◆ set_long_name()

void Glib::OptionEntry::set_long_name | ( | const Glib::ustring & | value | ) |

## ◆ set_short_name()

void Glib::OptionEntry::set_short_name | ( | const gchar & | value | ) |

## Member Data Documentation

## ◆ gobject_

GOptionEntry* Glib::OptionEntry::gobject_
| protected