Re: option group questions



On Mon, 9 Jul 2007 08:22:12 +0100
Joachim Banzhaf <joachimbanzhaf compuserve de> wrote:

> > If you require the user to supply an option, then getopt makes that
> > your responsibility. I'd imagine Glib::option does the same.
> 
> Ok, that should be easy. Initialize the option with an invalid value and check 
> after parsing will do that. Just hoped I could tell Glibmm with some flag to 
> do this for me.

Or you can maintain a separate flag and set it when the option is
parsed. That also allows you to check for options being given twice
when that's not sensible. With getopt you need to do quite a lot of
work yourself, so there's already a place where this can be done.
Looking at the Glib documents you _could_ do the same using the
"callback" option type, but presumably you would rather take advantage
of the simplified handling. That probably leaves you back with your
approach, but I thought I'd throw this alternative into the pot for
completeness.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]