2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GLIBMM_OPTIONGROUP_H
4 #define _GLIBMM_OPTIONGROUP_H
7 /* $Id: optiongroup.hg,v 1.10.4.1 2006/03/30 12:19:58 murrayc Exp $ */
9 /* Copyright (C) 2004 The glibmm Development Team
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #include <glibmm/ustring.h>
30 #include <glib/goption.h> //TODO: Try to hide this.
33 #ifndef DOXYGEN_SHOULD_SKIP_THIS
34 extern "C" { typedef struct _GOptionGroup GOptionGroup; }
35 #endif //DOXYGEN_SHOULD_SKIP_THIS
41 #ifndef DOXYGEN_SHOULD_SKIP_THIS
44 #endif //DOXYGEN_SHOULD_SKIP_THIS
46 /** An OptionGroup defines the options in a single group.
47 * Libraries which need to parse commandline options are expected to provide a function that allows their OptionGroups to
48 * be added to the application's OptionContext.
53 #ifndef DOXYGEN_SHOULD_SKIP_THIS
54 typedef OptionGroup CppObjectType;
55 typedef GOptionGroup BaseObjectType;
56 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
61 OptionGroup(const Glib::ustring& name, const Glib::ustring& description, const Glib::ustring& help_description = Glib::ustring());
63 /** This always takes ownership of the underlying GOptionGroup,
64 * so it is only useful with C functions that return newly-allocated GOptionGroups.
66 explicit OptionGroup(GOptionGroup* castitem);
68 virtual ~OptionGroup();
71 virtual bool on_pre_parse(OptionContext& context, OptionGroup& group);
72 virtual bool on_post_parse(OptionContext& context, OptionGroup& group);
73 virtual void on_error(OptionContext& context, OptionGroup& group);
76 void add_entry(const OptionEntry& entry);
79 typedef std::vector<Glib::ustring> vecustrings;
80 typedef std::vector<std::string> vecstrings;
82 void add_entry(const OptionEntry& entry, bool& arg);
83 void add_entry(const OptionEntry& entry, int& arg);
84 void add_entry(const OptionEntry& entry, Glib::ustring& arg);
85 void add_entry_filename(const OptionEntry& entry, std::string& arg);
86 void add_entry(const OptionEntry& entry, vecustrings& arg);
87 void add_entry_filename(const OptionEntry& entry, vecstrings& arg);
90 void g_option_group_set_translate_func (GOptionGroup *group,
93 GDestroyNotify destroy_notify);
96 /** A convenience function to use gettext() for translating
97 * user-visible strings.
100 * @param domain The domain to use.
102 void set_translation_domain(const Glib::ustring& domain);
104 GOptionGroup* gobj() { return gobject_; }
105 const GOptionGroup* gobj() const { return gobject_; }
106 GOptionGroup* gobj_give_ownership();
110 #ifndef DOXYGEN_SHOULD_SKIP_THIS
111 /** This is not public API. It is an implementation detail.
118 void allocate_c_arg();
119 void set_c_arg_default(void* cpp_arg);
120 void convert_c_to_cpp();
121 void release_c_arg();
123 GOptionArg carg_type_;
129 void add_entry_with_wrapper(const OptionEntry& entry, GOptionArg arg_type, void* cpp_arg);
131 //Map of entry names to CppOptionEntry:
132 typedef std::map<Glib::ustring, CppOptionEntry> type_map_entries;
133 type_map_entries map_entries_;
135 GOptionGroup* gobject_;
136 bool has_ownership_; //Whether the gobject_ belongs to this C++ instance.
137 #endif //DOXYGEN_SHOULD_SKIP_THIS
145 #endif /* _GLIBMM_OPTIONGROUP_H */