summaryrefslogtreecommitdiff
path: root/glib/src/optiongroup.ccg
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2004-10-10 21:03:41 +0000
committerMurray Cumming <murrayc@src.gnome.org>2004-10-10 21:03:41 +0000
commita4941d46afc8c9f2c37f9af5f610166c1cb97618 (patch)
tree4ea89978a4f0f8917c286c830703025b89420c53 /glib/src/optiongroup.ccg
parent5a4a63885cd2a084baef7efbacfff2f0e4eda3ad (diff)
downloadglibmm-a4941d46afc8c9f2c37f9af5f610166c1cb97618.tar.gz
Rethought the structure now that I see how the parts work together.
2004-10-01 Murray Cumming <murrayc@murrayc.com> * glib/src/option*.[hg|ccg], examples/options/main.cc: Rethought the structure now that I see how the parts work together. Rearranged the example to show how the parsing can fill values in member variables of a derived OptionGroup class. However, 1. it crashes now, 2. we need extra code to map the GOption C types to suitable C++ types, probably by doing pre and post parsing to create temporary C types for the C++ types.
Diffstat (limited to 'glib/src/optiongroup.ccg')
-rw-r--r--glib/src/optiongroup.ccg12
1 files changed, 11 insertions, 1 deletions
diff --git a/glib/src/optiongroup.ccg b/glib/src/optiongroup.ccg
index 4d000a82..321f3deb 100644
--- a/glib/src/optiongroup.ccg
+++ b/glib/src/optiongroup.ccg
@@ -47,8 +47,11 @@ gboolean g_callback_post_parse(GOptionContext* context, GOptionGroup* group, gpo
OptionGroup cppGroup(group); //Maybe this should be option_group.
OptionGroup* option_group = static_cast<OptionGroup*>(data);
- if(option_group)
+ if(option_group)\
+ {
+ //TODO: Convert C types to the appropriate C++ types.
return option_group->on_post_parse(cppContext, cppGroup);
+ }
else
return false;
}
@@ -78,6 +81,7 @@ OptionGroup::OptionGroup(GOptionGroup* castitem, bool take_copy)
{
if(take_copy)
{
+ g_warning("TODO");
}
else
gobject_ = castitem;
@@ -89,6 +93,12 @@ OptionGroup::~OptionGroup()
gobject_ = 0;
}
+void OptionGroup::add_entry(const OptionEntry& entry)
+{
+ //It does not copy the entry, so it needs to live as long as the group.
+ //TODO: Store temporary copies in the C++ instance?
+ g_option_group_add_entries(gobj(), entry.gobj()); //This can take an array, so think of this as an array of 1.
+}
bool OptionGroup::on_pre_parse(OptionContext& /* context */, OptionGroup& /* group */)
{