More gracefully handle type mismatch errors when doing playlist things (just ignore...
[ardour.git] / libs / glibmm2 / glib / src / optionentry.hg
1 /* $Id: optionentry.hg,v 1.11 2005/07/31 13:11:05 murrayc Exp $ */
2
3 /* Copyright (C) 2004 The glibmm Development Team
4  *
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.
9  *
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.
14  *
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.
18  */
19
20 _DEFS(glibmm,glib)
21
22 #include <glibmm/ustring.h>
23
24 #ifndef DOXYGEN_SHOULD_SKIP_THIS
25 extern "C" { typedef struct _GOptionEntry GOptionEntry; }
26 #endif
27
28
29 namespace Glib
30 {
31
32 /** An OptionEntry defines a single option. To have an effect, it must be added to an OptionGroup with 
33  * OptionGroup::add_entry().
34  * 
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.
38  *
39  * If an option has a short name, it can be specified as -short_name in a commandline.
40  *
41  * The description for the option is shown in the --help  output.
42  *
43  * The arg_descripton is the placeholder to use for the extra argument parsed by the option in --help  output. 
44  */
45 class OptionEntry
46 {
47   _CLASS_GENERIC(OptionEntry, GOptionEntry)
48 public:
49
50   //Copied from goption.h, instead of generated, so that we can put it inside the class.
51   enum Flags
52   {
53     FLAG_HIDDEN = 1 << 0,
54     FLAG_IN_MAIN = 1 << 1,
55     FLAG_REVERSE = 1 << 2,
56     FLAG_NO_ARG = 1 << 3,
57     FLAG_FILENAME = 1 << 4,
58     FLAG_OPTIONAL_ARG = 1 << 5,
59     FLAG_NOALIAS = 1 << 6
60   } GOptionFlags;
61
62   OptionEntry();
63   OptionEntry(const OptionEntry& src);
64   virtual ~OptionEntry();
65   
66   OptionEntry& operator=(const OptionEntry& src);
67
68 #m4 _CONVERSION(`Glib::ustring',`const gchar*',`g_strdup(($3).c_str())')
69   
70   _MEMBER_GET(long_name, long_name, Glib::ustring, const char*)
71   _MEMBER_SET(long_name, long_name, Glib::ustring, const char*)
72   
73   _MEMBER_GET(short_name, short_name, gchar, gchar)
74   _MEMBER_SET(short_name, short_name, gchar, gchar)
75   
76   _MEMBER_GET(flags, flags, int, int)
77   _MEMBER_SET(flags, flags, int, int)
78   
79   //TODO: G_OPTION_ARG_CALLBACK,
80     
81   _MEMBER_GET(description, description, Glib::ustring, const char*)
82   _MEMBER_SET(description, description, Glib::ustring, const char*)
83   
84   _MEMBER_GET(arg_description, arg_description, Glib::ustring, const char*)
85   _MEMBER_SET(arg_description, arg_description, Glib::ustring, const char*)
86   
87   GOptionEntry*       gobj()       { return gobject_; }
88   const GOptionEntry* gobj() const { return gobject_; }
89   
90 protected:
91
92   GOptionEntry* gobject_;
93 };
94
95 } // namespace Glib
96