gnomemm r1440 - in gstreamermm/trunk: . gstreamer/src tests



Author: jaalburqu
Date: Thu Apr  3 23:20:37 2008
New Revision: 1440
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1440&view=rev

Log:
2008-04-03  Josà Alburquerque  <jaalburqu svn gnome org>

	* gstreamer/src/childproxy.ccg:
	* gstreamer/src/childproxy.hg: Modified method names to not conflict
	with Gst::Object inherited methods (in particular set_property)

	* gstreamer/src/element.hg: Overloaded ElementInterfaced<..> methods
	gobj() (both const and non-const versions) and gobj_copy() to avoid
	ambiguity (in particular using ElementInterfaced<...>::gobj() would be
	ambiguous otherwise)

	* tests/test-interface.cc: Added lines to test ElementInterfaced<...>
	gobject methods' ambiguity

Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/gstreamer/src/childproxy.ccg
   gstreamermm/trunk/gstreamer/src/childproxy.hg
   gstreamermm/trunk/gstreamer/src/element.hg
   gstreamermm/trunk/tests/test-interface.cc

Modified: gstreamermm/trunk/gstreamer/src/childproxy.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/childproxy.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/childproxy.ccg	Thu Apr  3 23:20:37 2008
@@ -22,22 +22,22 @@
 namespace Gst
 {
 
-void ChildProxy::get_property(const Glib::ustring& name, Glib::ValueBase& value)
+void ChildProxy::get_proxy_property(const Glib::ustring& name, Glib::ValueBase& value)
 {
   gst_child_proxy_get_property(GST_OBJECT(gobj()), name.c_str(), value.gobj());
 }
 
-void ChildProxy::get_valist(const Glib::ustring& first_prop_name, va_list& var_args)
+void ChildProxy::get_proxy_valist(const Glib::ustring& first_prop_name, va_list& var_args)
 {
   gst_child_proxy_get_valist(GST_OBJECT(gobj()), first_prop_name.c_str(), var_args);
 }
 
-void ChildProxy::set_property(const Glib::ustring& name, const Glib::ValueBase& value)
+void ChildProxy::set_proxy_property(const Glib::ustring& name, const Glib::ValueBase& value)
 {
   gst_child_proxy_set_property(GST_OBJECT(gobj()), name.c_str(), value.gobj());
 }
 
-void ChildProxy::set_valist(const Glib::ustring& first_prop_name, const va_list& var_args)
+void ChildProxy::set_proxy_valist(const Glib::ustring& first_prop_name, const va_list& var_args)
 {
   gst_child_proxy_set_valist(GST_OBJECT(gobj()), first_prop_name.c_str(), const_cast<va_list&>(var_args));
 }

Modified: gstreamermm/trunk/gstreamer/src/childproxy.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/childproxy.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/childproxy.hg	Thu Apr  3 23:20:37 2008
@@ -52,10 +52,10 @@
 
   //TODO: should gst_child_proxy_lookup() be wrapped?
 
-  void get_property(const Glib::ustring& name, Glib::ValueBase& value);
-  void get_valist(const Glib::ustring& first_prop_name, va_list& var_args);
-  void set_property(const Glib::ustring& name, const Glib::ValueBase& value);
-  void set_valist(const Glib::ustring& first_prop_name, const va_list& var_args);
+  void get_proxy_property(const Glib::ustring& name, Glib::ValueBase& value);
+  void get_proxy_valist(const Glib::ustring& first_prop_name, va_list& var_args);
+  void set_proxy_property(const Glib::ustring& name, const Glib::ValueBase& value);
+  void set_proxy_valist(const Glib::ustring& first_prop_name, const va_list& var_args);
   void child_added(const Glib::RefPtr<Gst::Object>& child);
   void child_removed(const Glib::RefPtr<Gst::Object>& child);
 

Modified: gstreamermm/trunk/gstreamer/src/element.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/element.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/element.hg	Thu Apr  3 23:20:37 2008
@@ -200,6 +200,12 @@
   public T_Interface
 {
 public:
+  // Make calls involving underlying gobject unambiguous (specifically, gobj()
+  // is ambiguous when called from an ElementInterfaced<..> class
+  GstElement* gobj();
+  const GstElement* gobj() const;
+  GstElement* gobj_copy();
+
   ~ElementInterfaced();
 
 protected:
@@ -229,6 +235,24 @@
 }
 
 template <class T_Interface>
+GstElement* ElementInterfaced<T_Interface>::gobj()
+{
+  return Element::gobj();
+}
+
+template <class T_Interface>
+const GstElement* ElementInterfaced<T_Interface>::gobj() const
+{
+  return Element::gobj();
+}
+
+template <class T_Interface>
+GstElement* ElementInterfaced<T_Interface>::gobj_copy()
+{
+  return Element::gobj_copy();
+}
+
+template <class T_Interface>
 ElementInterfaced<T_Interface>::~ElementInterfaced()
 {
   // Set the gobject_ to NULL so that when this is deleted, the gobject doesn't

Modified: gstreamermm/trunk/tests/test-interface.cc
==============================================================================
--- gstreamermm/trunk/tests/test-interface.cc	(original)
+++ gstreamermm/trunk/tests/test-interface.cc	Thu Apr  3 23:20:37 2008
@@ -43,6 +43,18 @@
 
     handler->set_uri("file:///tmp/media.file");
 
+    // Test ambiguity of ElementInterfaced<>::gobj() methods
+    GstElement* gstElement = handler->gobj();
+    const GstElement* constGstElement = handler->gobj();
+    GstElement* gstElementCopy = handler->gobj_copy();
+
+    if (!gstElement || !constGstElement || !gstElementCopy)
+    {
+      std::cout << "Underlying gobject methods of cast object didn't work." <<
+        std::endl;
+    }
+
+    // Use interface methods
     std::cout << handler->get_name() << " uri = '" << handler->get_uri() <<
       "'." << std::endl;
   }
@@ -55,6 +67,7 @@
     std::cout << "element '" << element->get_name() <<
       "' implements XOverlay interface." << std::endl;
 
+    // Use interface methods
     xoverlay->handle_events(false);
   }
 }



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