[glibmm] Add OptionGroup::add_entry(.., double&)
- From: Jonathon Jongsma <jjongsma src gnome org>
- To: svn-commits-list gnome org
- Subject: [glibmm] Add OptionGroup::add_entry(.., double&)
- Date: Wed, 1 Jul 2009 03:19:23 +0000 (UTC)
commit f2802cf768a4e10247f5ad94a67b020a954ebd70
Author: Jonathon Jongsma <jonathon quotidian org>
Date: Tue Jun 30 22:17:41 2009 -0500
Add OptionGroup::add_entry(.., double&)
ChangeLog | 5 +++++
glib/src/optiongroup.ccg | 32 +++++++++++++++++++++++++++++++-
glib/src/optiongroup.hg | 1 +
3 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0672ff3..cfa11c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-30 Jonathon Jongsma <jonathon quotidian org>
+
+ * glib/src/optiongroup.ccg:
+ * glib/src/optiongroup.hg: add OptionGroup::add_entry(.., double&)
+
2009-06-29 Jonathon Jongsma <jonathon quotidian org>
* tools/m4/convert_gio.m4: add some namespaced conversions so that I
diff --git a/glib/src/optiongroup.ccg b/glib/src/optiongroup.ccg
index 1fc845c..c27595a 100644
--- a/glib/src/optiongroup.ccg
+++ b/glib/src/optiongroup.ccg
@@ -132,6 +132,11 @@ void OptionGroup::add_entry(const OptionEntry& entry, int& arg)
add_entry_with_wrapper(entry, G_OPTION_ARG_INT, &arg);
}
+void OptionGroup::add_entry(const OptionEntry& entry, double& arg)
+{
+ add_entry_with_wrapper(entry, G_OPTION_ARG_DOUBLE, &arg);
+}
+
void OptionGroup::add_entry(const OptionEntry& entry, Glib::ustring& arg)
{
add_entry_with_wrapper(entry, G_OPTION_ARG_STRING, &arg);
@@ -240,6 +245,14 @@ void OptionGroup::CppOptionEntry::allocate_c_arg()
break;
}
+ case G_OPTION_ARG_DOUBLE:
+ {
+ double* typed_arg = new double;
+ *typed_arg = 0.0;
+ carg_ = typed_arg;
+
+ break;
+ }
case G_OPTION_ARG_STRING_ARRAY:
case G_OPTION_ARG_FILENAME_ARRAY:
{
@@ -273,6 +286,11 @@ void OptionGroup::CppOptionEntry::set_c_arg_default(void* cpp_arg)
*static_cast<int*>(carg_) = *static_cast<int*>(cpp_arg);
break;
}
+ case G_OPTION_ARG_DOUBLE:
+ {
+ *static_cast<double*>(carg_) = *static_cast<double*>(cpp_arg);
+ break;
+ }
case G_OPTION_ARG_NONE:
{
*static_cast<gboolean*>(carg_) = *static_cast<bool*>(cpp_arg);
@@ -369,6 +387,13 @@ void OptionGroup::CppOptionEntry::release_c_arg()
break;
}
+ case G_OPTION_ARG_DOUBLE:
+ {
+ double* typed_arg = static_cast<double*>(carg_);
+ delete typed_arg;
+
+ break;
+ }
case G_OPTION_ARG_STRING_ARRAY:
case G_OPTION_ARG_FILENAME_ARRAY:
{
@@ -431,7 +456,12 @@ void OptionGroup::CppOptionEntry::convert_c_to_cpp()
*((int*)cpparg_) = *(static_cast<int*>(carg_));
break;
}
- case G_OPTION_ARG_STRING_ARRAY:
+ case G_OPTION_ARG_DOUBLE:
+ {
+ *((double*)cpparg_) = *(static_cast<double*>(carg_));
+ break;
+ }
+ case G_OPTION_ARG_STRING_ARRAY:
{
char*** typed_arg = static_cast<char***>(carg_);
vecustrings* typed_cpp_arg = static_cast<vecustrings*>(cpparg_);
diff --git a/glib/src/optiongroup.hg b/glib/src/optiongroup.hg
index 8c01337..0bc826e 100644
--- a/glib/src/optiongroup.hg
+++ b/glib/src/optiongroup.hg
@@ -71,6 +71,7 @@ public:
void add_entry(const OptionEntry& entry, bool& arg);
void add_entry(const OptionEntry& entry, int& arg);
+ void add_entry(const OptionEntry& entry, double& arg);
void add_entry(const OptionEntry& entry, Glib::ustring& arg);
void add_entry_filename(const OptionEntry& entry, std::string& arg);
void add_entry(const OptionEntry& entry, vecustrings& arg);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]