1 /* $Id: optionentry.hg,v 1.11 2005/07/31 13:11:05 murrayc Exp $ */
3 /* Copyright (C) 2004 The glibmm Development Team
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <glibmm/ustring.h>
24 #ifndef DOXYGEN_SHOULD_SKIP_THIS
25 extern "C" { typedef struct _GOptionEntry GOptionEntry; }
32 /** An OptionEntry defines a single option. To have an effect, it must be added to an OptionGroup with
33 * OptionGroup::add_entry().
35 * The long name of an option can be used to specify it in a commandline as --long_name.
36 * Every option must have a long name. To resolve conflicts if multiple option groups contain the same long name, it is also
37 * possible to specify the option as --groupname-long_name.
39 * If an option has a short name, it can be specified as -short_name in a commandline.
41 * The description for the option is shown in the --help output.
43 * The arg_descripton is the placeholder to use for the extra argument parsed by the option in --help output.
47 _CLASS_GENERIC(OptionEntry, GOptionEntry)
50 //Copied from goption.h, instead of generated, so that we can put it inside the class.
54 FLAG_IN_MAIN = 1 << 1,
55 FLAG_REVERSE = 1 << 2,
57 FLAG_FILENAME = 1 << 4,
58 FLAG_OPTIONAL_ARG = 1 << 5,
63 OptionEntry(const OptionEntry& src);
64 virtual ~OptionEntry();
66 OptionEntry& operator=(const OptionEntry& src);
68 #m4 _CONVERSION(`Glib::ustring',`const gchar*',`g_strdup(($3).c_str())')
70 _MEMBER_GET(long_name, long_name, Glib::ustring, const char*)
71 _MEMBER_SET(long_name, long_name, Glib::ustring, const char*)
73 _MEMBER_GET(short_name, short_name, gchar, gchar)
74 _MEMBER_SET(short_name, short_name, gchar, gchar)
76 _MEMBER_GET(flags, flags, int, int)
77 _MEMBER_SET(flags, flags, int, int)
79 //TODO: G_OPTION_ARG_CALLBACK,
81 _MEMBER_GET(description, description, Glib::ustring, const char*)
82 _MEMBER_SET(description, description, Glib::ustring, const char*)
84 _MEMBER_GET(arg_description, arg_description, Glib::ustring, const char*)
85 _MEMBER_SET(arg_description, arg_description, Glib::ustring, const char*)
87 GOptionEntry* gobj() { return gobject_; }
88 const GOptionEntry* gobj() const { return gobject_; }
92 GOptionEntry* gobject_;