gnomemm r2089 - in gstreamermm/trunk: . gstreamer/src



Author: jaalburqu
Date: Thu Mar 12 03:19:55 2009
New Revision: 2089
URL: http://svn.gnome.org/viewvc/gnomemm?rev=2089&view=rev

Log:
2009-03-11  Josà Alburquerque  <jaalburqu svn gnome org>

	* gstreamer/src/preset.ccg:
	* gstreamer/src/preset.hg:
	* gstreamer/src/gst_vfuncs.defs: Added Preset vfuncs.  Added Preset to
	GstInterfaces Doxygen group.  Used _WRAP_METHOD_DOCS_ONLY instead  of
	handwriting method docs.

Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/gstreamer/src/gst_vfuncs.defs
   gstreamermm/trunk/gstreamer/src/preset.ccg
   gstreamermm/trunk/gstreamer/src/preset.hg

Modified: gstreamermm/trunk/gstreamer/src/gst_vfuncs.defs
==============================================================================
--- gstreamermm/trunk/gstreamer/src/gst_vfuncs.defs	(original)
+++ gstreamermm/trunk/gstreamer/src/gst_vfuncs.defs	Thu Mar 12 03:19:55 2009
@@ -249,6 +249,71 @@
   )
 )
 
+; GstPreset
+
+(define-vfunc get_preset_names
+  (of-object "GstPreset")
+  (return-type "gchar**")
+)
+
+(define-vfunc get_property_names
+  (of-object "GstPreset")
+  (return-type "gchar**")
+)
+
+(define-vfunc load_preset
+  (of-object "GstPreset")
+  (return-type "gboolean")
+  (parameters
+   '("const-gchar*" "name")
+  )
+)
+
+(define-vfunc save_preset
+  (of-object "GstPreset")
+  (return-type "gboolean")
+  (parameters
+   '("const-gchar*" "name")
+  )
+)
+
+(define-vfunc rename_preset
+  (of-object "GstPreset")
+  (return-type "gboolean")
+  (parameters
+   '("const-gchar*" "old_name")
+   '("const-gchar*" "new_name")
+  )
+)
+
+(define-vfunc delete_preset
+  (of-object "GstPreset")
+  (return-type "gboolean")
+  (parameters
+   '("const-gchar*" "name")
+  )
+)
+
+(define-vfunc set_meta
+  (of-object "GstPreset")
+  (return-type "gboolean")
+  (parameters
+   '("const-gchar*" "name")
+   '("const-gchar*" "tag")
+   '("const-gchar*" "value")
+  )
+)
+
+(define-vfunc get_meta
+  (of-object "GstPreset")
+  (return-type "gboolean")
+  (parameters
+   '("const-gchar*" "name")
+   '("const-gchar*" "tag")
+   '("gchar**" "value")
+  )
+)
+
 ; GstBaseSrc
 
 (define-vfunc get_caps

Modified: gstreamermm/trunk/gstreamer/src/preset.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/preset.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/preset.ccg	Thu Mar 12 03:19:55 2009
@@ -17,19 +17,210 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
- namespace Gst
- {
+namespace Gst
+{
 
- bool Preset::get_meta(const Glib::ustring& name, const Glib::ustring& tag,
-   Glib::ustring& value) const
- {
-   gchar** meta;
-
-   gboolean result = gst_preset_get_meta(const_cast<GstPreset*>(gobj()),
-     name.c_str(), tag.c_str(), meta);
-   value = *meta;
-   g_free(*meta);
-   return result;
- }
+bool Preset::get_meta(const Glib::ustring& name, const Glib::ustring& tag,
+  Glib::ustring& value) const
+{
+  gchar** meta;
 
- }
+  gboolean result = gst_preset_get_meta(const_cast<GstPreset*>(gobj()),
+    name.c_str(), tag.c_str(), meta);
+  value = *meta;
+  g_free(*meta);
+  return result;
+}
+
+#ifdef GLIBMM_VFUNCS_ENABLED
+gchar** Preset_Class::get_preset_names_vfunc_callback(GstPreset* 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.
+        return const_cast<gchar**>((obj->get_preset_names_vfunc()).data());
+      #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_preset_names)
+    return (*base->get_preset_names)(self);
+
+
+  typedef gchar** RType;
+  return RType();
+}
+
+gchar** Preset_Class::get_property_names_vfunc_callback(GstPreset* 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.
+        return const_cast<gchar**>((obj->get_property_names_vfunc()).data());
+      #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_property_names)
+    return (*base->get_property_names)(self);
+
+
+  typedef gchar** RType;
+  return RType();
+}
+
+gboolean Preset_Class::get_meta_vfunc_callback(GstPreset* self, const gchar* name, const gchar* tag, gchar** value)
+{
+  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
+        Glib::ustring gstmm_value;
+        // Call the virtual member method, which derived classes might override.
+        const gboolean result = static_cast<int>(obj->get_meta_vfunc(Glib::convert_const_gchar_ptr_to_ustring(name)
+, Glib::convert_const_gchar_ptr_to_ustring(tag)
+, gstmm_value
+));
+        *value = g_strdup(gstmm_value.c_str());
+        return result;
+      #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_meta)
+    return (*base->get_meta)(self, name, tag, value);
+
+
+  typedef gboolean RType;
+  return RType();
+}
+
+Glib::StringArrayHandle Gst::Preset::get_preset_names_vfunc() 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_preset_names)
+    return Glib::StringArrayHandle((*base->get_preset_names)(const_cast<GstPreset*>(gobj())), Glib::OWNERSHIP_DEEP);
+
+  typedef Glib::StringArrayHandle RType;
+  return Glib::StringArrayHandle(0, Glib::OWNERSHIP_NONE);
+}
+
+Glib::StringArrayHandle Gst::Preset::get_property_names_vfunc() 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_property_names)
+    return Glib::StringArrayHandle((*base->get_property_names)(const_cast<GstPreset*>(gobj())), Glib::OWNERSHIP_DEEP);
+
+  typedef Glib::StringArrayHandle RType;
+  return Glib::StringArrayHandle(0, Glib::OWNERSHIP_NONE);
+}
+
+bool Gst::Preset::get_meta_vfunc(const Glib::ustring& name, const Glib::ustring& tag, Glib::ustring& value) 
+{
+  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_meta)
+  {
+    gchar* gst_value;
+    const bool result = (*base->get_meta)(gobj(),((name).c_str()),((tag).c_str()), &gst_value);
+    value = gst_value;
+    g_free(gst_value);
+    return result;
+  }
+
+  typedef bool RType;
+  return RType();
+}
+#endif //GLIBMM_VFUNCS_ENABLED
+
+}

Modified: gstreamermm/trunk/gstreamer/src/preset.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/preset.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/preset.hg	Thu Mar 12 03:19:55 2009
@@ -38,6 +38,7 @@
  * native preset format of those wrapped plugins. One method that is useful to
  * be overridden is property_names_vfunc(). With that, one can control which
  * properties are saved and in which order.
+ * @ingroup GstInterfaces
  */
 class Preset : public Glib::Interface
 {
@@ -53,18 +54,37 @@
   _WRAP_METHOD(bool delete_preset(const Glib::ustring& name), gst_preset_delete_preset)
   _WRAP_METHOD(bool set_meta(const Glib::ustring& name, const Glib::ustring& tag, const Glib::ustring& value), gst_preset_set_meta)
 
-  /** Gets the @a value for an existing meta data tag. Meta data tag names can
-   * be something like e.g. "comment".
-   *
-   * @param name Preset name.  
-   * @param tag Meta data item name.  
-   * @param value Glib::ustring in which to store the value.
-   * @return true for success, false if e.g. there is no preset with that name
-   * or the is no value for the given tag.
-   */
+  _WRAP_METHOD_DOCS_ONLY(gst_preset_get_meta)
   bool get_meta(const Glib::ustring& name, const Glib::ustring& tag, Glib::ustring& value) const;
 
-  //TODO: Wrap vfuncs.
+#m4 _CONVERSION(`Glib::StringArrayHandle', `gchar**', `const_cast<gchar**>(($3).data())')
+
+#ifdef GLIBMM_VFUNCS_ENABLED
+  virtual Glib::StringArrayHandle get_preset_names_vfunc() const;
+  virtual Glib::StringArrayHandle get_property_names_vfunc() const;
+  virtual bool get_meta_vfunc(const Glib::ustring& name,
+    const Glib::ustring& tag, Glib::ustring& value);
+#endif //GLIBMM_VFUNCS_ENABLED
+
+  _WRAP_VFUNC(bool load_preset(const Glib::ustring& name), "load_preset")
+  _WRAP_VFUNC(bool save_preset(const Glib::ustring& name) const, "save_preset")
+  _WRAP_VFUNC(bool rename_preset(const Glib::ustring& old_name, const Glib::ustring& new_name), "rename_preset")
+  _WRAP_VFUNC(bool delete_preset(const Glib::ustring& name), "delete_preset")
+  _WRAP_VFUNC(bool set_meta(const Glib::ustring& name, const Glib::ustring& tag, const Glib::ustring& value), "set_meta")
+
+protected:
+#m4begin
+  _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
+  klass->get_preset_names = &get_preset_names_vfunc_callback;
+  klass->get_property_names = &get_property_names_vfunc_callback;
+  klass->get_meta = &get_meta_vfunc_callback;
+  _SECTION(SECTION_PH_VFUNCS)
+  static gchar** get_preset_names_vfunc_callback(GstPreset* self);
+  static gchar** get_property_names_vfunc_callback(GstPreset* self);
+  static gboolean get_meta_vfunc_callback(GstPreset* self, const gchar* name,
+    const gchar* tag, gchar** value);
+  _POP()
+#m4end
 };
 
 } // namespace Gst



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]