[libgda-uimm] DataEntry: Wrap remaining vfuncs.
- From: José Alburquerque <jaalburqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda-uimm] DataEntry: Wrap remaining vfuncs.
- Date: Fri, 23 Apr 2010 18:03:05 +0000 (UTC)
commit 227eb91fd025c2eb263726d5942cf2ee26eeb4da
Author: José Alburquerque <jaalburqu svn gnome org>
Date: Thu Apr 22 19:32:59 2010 -0400
DataEntry: Wrap remaining vfuncs.
* libgda-ui/src/dataentry.ccg:
* libgda-ui/src/dataentry.hg: Wrap get_value_vfunc() and
get_value_orig_vfuncs() manually because of their Glib::ValueBase&
parameters.
ChangeLog | 9 +++
libgda-ui/src/dataentry.ccg | 127 +++++++++++++++++++++++++++++++++++++++++++
libgda-ui/src/dataentry.hg | 24 ++++++++-
3 files changed, 158 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6a76954..0135004 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-04-22 José Alburquerque <jaalburqu svn gnome org>
+
+ DataEntry: Wrap remaining vfuncs.
+
+ * libgda-ui/src/dataentry.ccg:
+ * libgda-ui/src/dataentry.hg: Wrap get_value_vfunc() and
+ get_value_orig_vfuncs() manually because of their Glib::ValueBase&
+ parameters.
+
2010-04-13 José Alburquerque <jaalburqu svn gnome org>
DataEntry: Wrap vfuncs.
diff --git a/libgda-ui/src/dataentry.ccg b/libgda-ui/src/dataentry.ccg
index 3e79b9f..80dbe0f 100644
--- a/libgda-ui/src/dataentry.ccg
+++ b/libgda-ui/src/dataentry.ccg
@@ -40,6 +40,133 @@ void DataEntry::get_original_value(Glib::ValueBase& value) const
value.init(gvalue);
}
+#ifdef GLIBMM_VFUNCS_ENABLED
+GValue* DataEntry_Class::get_value_vfunc_callback(GdauiDataEntry* self)
+{
+ Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
+ Glib::ObjectBase::_get_current_wrapper((GObject*)self));
+
+ // Non-gtkmmproc-generated custom classes implicitly call the default
+ // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
+ // generated classes can use this optimisation, which avoids the unnecessary
+ // parameter conversions if there is no possibility of the virtual function
+ // being overridden:
+ if(obj_base && obj_base->is_derived_())
+ {
+ CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+ if(obj) // This can be NULL during destruction.
+ {
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ try // Trap C++ exceptions which would normally be lost because this is a C callback.
+ {
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ // Call the virtual member method, which derived classes might override.
+ GValue* copy = 0;
+ Glib::ValueBase val;
+ obj->get_value_vfunc(val);
+ g_value_copy(val.gobj(), copy);
+ return copy;
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ }
+ }
+
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
+g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
+) );
+
+ // Call the original underlying C function:
+ if(base && base->get_value)
+ return (*base->get_value)(self);
+
+
+ typedef GValue* RType;
+ return RType();
+}
+void Gnome::GdaUI::DataEntry::get_value_vfunc(Glib::ValueBase& value) const
+{
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
+g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
+) );
+
+ if(base && base->get_value)
+ {
+ const GValue* g_val = (*base->get_value)(const_cast<GdauiDataEntry*>(gobj()));
+ value.init(g_val);
+ }
+}
+const GValue*
+DataEntry_Class::get_value_orig_vfunc_callback(GdauiDataEntry* self)
+{
+ Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
+ Glib::ObjectBase::_get_current_wrapper((GObject*)self));
+
+ // Non-gtkmmproc-generated custom classes implicitly call the default
+ // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
+ // generated classes can use this optimisation, which avoids the unnecessary
+ // parameter conversions if there is no possibility of the virtual function
+ // being overridden:
+ if(obj_base && obj_base->is_derived_())
+ {
+ CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+ if(obj) // This can be NULL during destruction.
+ {
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ try // Trap C++ exceptions which would normally be lost because this is a C callback.
+ {
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ // Call the virtual member method, which derived classes might override.
+ GValue* copy = 0;
+ Glib::ValueBase val;
+ obj->get_value_orig_vfunc(val);
+ g_value_copy(val.gobj(), copy);
+ return copy;
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ }
+ }
+
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
+g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
+) );
+
+ // Call the original underlying C function:
+ if(base && base->get_value_orig)
+ return (*base->get_value_orig)(self);
+
+
+ typedef GValue* RType;
+ return RType();
+}
+void Gnome::GdaUI::DataEntry::get_value_orig_vfunc(Glib::ValueBase& value) const
+{
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
+g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
+) );
+
+ if(base && base->get_value_orig)
+ {
+ const GValue* g_val =
+ (*base->get_value_orig)(const_cast<GdauiDataEntry*>(gobj()));
+ value.init(g_val);
+ }
+}
+#endif //GLIBMM_VFUNCS_ENABLED
+
} /* namespace GdaUI */
} /* namespace Gnome */
diff --git a/libgda-ui/src/dataentry.hg b/libgda-ui/src/dataentry.hg
index c503eca..abfab11 100644
--- a/libgda-ui/src/dataentry.hg
+++ b/libgda-ui/src/dataentry.hg
@@ -166,9 +166,18 @@ public:
_WRAP_VFUNC(void set_value_type(GType type), "set_value_type")
_WRAP_VFUNC(GType get_value_type() const, "get_value_type")
_WRAP_VFUNC(void set_value(const Glib::ValueBase& value), "set_value")
- //TODO: _WRAP_VFUNC(void get_value(Glib::ValueBase& value) const, "get_value")
+
+#ifdef GLIBMM_VFUNCS_ENABLED
+ void get_value_vfunc(Glib::ValueBase& value) const;
+#endif //GLIBMM_VFUNCS_ENABLED
+
_WRAP_VFUNC(void set_value_orig(const Glib::ValueBase& value), "set_value_orig")
- //TODO: _WRAP_VFUNC(void get_value_orig(Glib::ValueBase& value) const, "get_value_orig")
+
+
+#ifdef GLIBMM_VFUNCS_ENABLED
+ void get_value_orig_vfunc(Glib::ValueBase& value) const;
+#endif //GLIBMM_VFUNCS_ENABLED
+
_WRAP_VFUNC(void set_value_default(const Glib::ValueBase& value), "set_value_default")
_WRAP_VFUNC(void set_attributes(Gnome::Gda::ValueAttribute attrs, Gnome::Gda::ValueAttribute mask), "set_attributes")
_WRAP_VFUNC(Gnome::Gda::ValueAttribute get_attributes() const, "get_attributes")
@@ -179,6 +188,17 @@ public:
_WRAP_VFUNC(bool expand_in_layout() const, "expand-in-layout")
_WRAP_VFUNC(void set_editable(bool editable), "set_editable")
_WRAP_VFUNC(void grab_focus(), "grab-focus")
+
+protected:
+#m4begin
+ _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
+ klass->get_value = &get_value_vfunc_callback;
+ klass->get_value_orig = &get_value_orig_vfunc_callback;
+ _SECTION(SECTION_PH_VFUNCS)
+ static GValue* get_value_vfunc_callback(GdauiDataEntry* self);
+ static const GValue* get_value_orig_vfunc_callback(GdauiDataEntry* self);
+ _POP()
+#m4end
};
/***************************** DataEntry *****************************/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]