glibmm: Glib::OptionGroup Class Reference
An OptionGroup defines the options in a single group. More...
#include <glibmm/optiongroup.h>
Public Types |
|
typedef sigc::slot < Glib::ustring , const Glib::ustring & > | SlotTranslate |
For example
Glib::ustring
on_translate(const Glib::ustring& original);.
More...
|
|
typedef sigc::slot < bool, const Glib::ustring &, const Glib::ustring &, bool > | SlotOptionArgString |
For example bool on_option_arg_string(const
Glib::ustring
& option_name, const
Glib::ustring
& value, bool has_value);.
More...
|
|
typedef sigc::slot < bool, const Glib::ustring &, const std::string &, bool > | SlotOptionArgFilename |
For example bool on_option_arg_filename(const
Glib::ustring
& option_name, const
std::string
& value, bool has_value);.
More...
|
|
using | vecustrings = std::vector < Glib::ustring > |
using | vecstrings = std::vector < std::string > |
Public Member Functions |
|
OptionGroup (const Glib::ustring & name, const Glib::ustring & description, const Glib::ustring & help_description= Glib::ustring ()) | |
OptionGroup (GOptionGroup* castitem) | |
This always takes ownership of the underlying GOptionGroup, so it is only useful with C functions that return newly-allocated GOptionGroups.
More...
|
|
OptionGroup ( OptionGroup && other) noexcept | |
OptionGroup & | operator= ( OptionGroup && other) noexcept |
virtual | ~OptionGroup () |
virtual bool | on_pre_parse ( OptionContext & context, OptionGroup & group) |
virtual bool | on_post_parse ( OptionContext & context, OptionGroup & group) |
virtual void | on_error ( OptionContext & context, OptionGroup & group) |
void | add_entry (const OptionEntry & entry) |
void | add_entry (const OptionEntry & entry, bool& arg ) |
Add a boolean option
entry
.
More...
|
|
void | add_entry (const OptionEntry & entry, int& arg ) |
Add an integer option
entry
.
More...
|
|
void | add_entry (const OptionEntry & entry, double& arg ) |
Add a double option
entry
.
More...
|
|
void | add_entry (const OptionEntry & entry, Glib::ustring & arg ) |
Add a UTF-8 string option
entry
.
More...
|
|
void | add_entry_filename (const OptionEntry & entry, std::string & arg ) |
Add a filename string option
entry
.
More...
|
|
void | add_entry (const OptionEntry & entry, vecustrings & arg ) |
Add an option
entry
that provides a list of UTF-8 strings.
More...
|
|
void | add_entry_filename (const OptionEntry & entry, vecstrings & arg ) |
void | add_entry (const OptionEntry & entry, const SlotOptionArgString & slot) |
Add a string option
entry
, but let a callback slot parse the extra argument instead of just setting a variable to its value.
More...
|
|
void | add_entry_filename (const OptionEntry & entry, const SlotOptionArgFilename & slot) |
Add a filename option
entry
, but let a callback slot parse the extra argument instead of just setting a variable to its value.
More...
|
|
void | set_translate_func (const SlotTranslate & slot) |
Sets the function which is used to translate user-visible strings, for –help output.
More...
|
|
void | set_translation_domain (const Glib::ustring & domain) |
A convenience function to use gettext() for translating user-visible strings.
More...
|
|
GOptionGroup* | gobj () |
const GOptionGroup* | gobj () const |
GOptionGroup* | gobj_give_ownership () |
Detailed Description
An OptionGroup defines the options in a single group.
Libraries which need to parse commandline options are expected to provide a function that allows their OptionGroups to be added to the application's OptionContext .
Member Typedef Documentation
typedef sigc::slot <bool, const Glib::ustring &, const std::string &, bool> Glib::OptionGroup::SlotOptionArgFilename |
For example bool on_option_arg_filename(const Glib::ustring & option_name, const std::string & value, bool has_value);.
typedef sigc::slot <bool, const Glib::ustring &, const Glib::ustring &, bool> Glib::OptionGroup::SlotOptionArgString |
For example bool on_option_arg_string(const Glib::ustring & option_name, const Glib::ustring & value, bool has_value);.
typedef sigc::slot < Glib::ustring , const Glib::ustring &> Glib::OptionGroup::SlotTranslate |
For example Glib::ustring on_translate(const Glib::ustring& original);.
using Glib::OptionGroup::vecstrings = std::vector < std::string > |
using Glib::OptionGroup::vecustrings = std::vector < Glib::ustring > |
Constructor & Destructor Documentation
Glib::OptionGroup::OptionGroup | ( | const Glib::ustring & | name , |
const Glib::ustring & | description , | ||
const Glib::ustring & |
help_description
=
Glib::ustring
()
|
||
) |
|
explicit |
This always takes ownership of the underlying GOptionGroup, so it is only useful with C functions that return newly-allocated GOptionGroups.
|
noexcept |
|
virtual |
Member Function Documentation
void Glib::OptionGroup::add_entry | ( | const OptionEntry & | entry | ) |
void Glib::OptionGroup::add_entry | ( | const OptionEntry & | entry , |
bool & | arg | ||
) |
Add a boolean option entry .
The
- parameter will be set to the option's extra argument after OptionContext::parse() has returned.
void Glib::OptionGroup::add_entry | ( | const OptionEntry & | entry , |
int & | arg | ||
) |
Add an integer option entry .
The
- parameter will be set to the option's extra argument after OptionContext::parse() has returned.
void Glib::OptionGroup::add_entry | ( | const OptionEntry & | entry , |
double & | arg | ||
) |
Add a double option entry .
The
- parameter will be set to the option's extra argument after OptionContext::parse() has returned.
void Glib::OptionGroup::add_entry | ( | const OptionEntry & | entry , |
Glib::ustring & | arg | ||
) |
Add a UTF-8 string option entry .
The
- parameter will be set to the option's extra argument after OptionContext::parse() has returned.
As indicated by the Glib::ustring type, the string will be UTF-8 encoded.
void Glib::OptionGroup::add_entry | ( | const OptionEntry & | entry , |
vecustrings & | arg | ||
) |
Add an option entry that provides a list of UTF-8 strings.
The
- parameter will be set to the option's extra argument after OptionContext::parse() has returned.
As indicated by the Glib::ustring type, the strings will be UTF-8 encoded.
void Glib::OptionGroup::add_entry | ( | const OptionEntry & | entry , |
const SlotOptionArgString & | slot | ||
) |
Add a string option entry , but let a callback slot parse the extra argument instead of just setting a variable to its value.
void Glib::OptionGroup::add_entry_filename | ( | const OptionEntry & | entry , |
std::string & | arg | ||
) |
Add a filename string option entry .
The
- parameter will be set to the option's extra argument after OptionContext::parse() has returned.
The string will be in glib's filename encoding.
void Glib::OptionGroup::add_entry_filename | ( | const OptionEntry & | entry , |
vecstrings & | arg | ||
) |
void Glib::OptionGroup::add_entry_filename | ( | const OptionEntry & | entry , |
const SlotOptionArgFilename & | slot | ||
) |
Add a filename option entry , but let a callback slot parse the extra argument instead of just setting a variable to its value.
|
inline |
|
inline |
GOptionGroup* Glib::OptionGroup::gobj_give_ownership | ( | ) |
|
virtual |
|
virtual |
|
virtual |
|
noexcept |
void Glib::OptionGroup::set_translate_func | ( | const SlotTranslate & | slot | ) |
Sets the function which is used to translate user-visible strings, for –help output.
Different groups can use a different SlotTranslate. If a translate function is not set, strings are not translated.
If you are using gettext(), you only need to set the translation domain, see set_translation_domain() .
- Parameters
-
slot the slot to be used for translation.
void Glib::OptionGroup::set_translation_domain | ( | const Glib::ustring & | domain | ) |
A convenience function to use gettext() for translating user-visible strings.
- Parameters
-
domain The domain to use.