[gstreamermm] Make single argument constructors explicit.



commit c03d2b9e759f85ecc7a9f27aef76fc413532b90e
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Wed Dec 9 18:20:03 2009 -0500

    	Make single argument constructors explicit.
    
    	* gstreamer/src/format.hg:
    	* gstreamer/src/index.hg:
    	* gstreamer/src/pad.hg:
    	* gstreamer/src/query.hg:
    	* gstreamer/src/task.hg:
    	* tools/extra_defs_gen/generate_plugin_gmmproc_file.cc: Use 'explicit'
    	for single argument constructors so that they are used explicitly and
    	not by an implicit conversion.
    	* gstreamer/src/element.hg: Also update the ElementInterfaced<> docs.

 ChangeLog                                          |   14 ++++++++++++++
 gstreamer/src/element.hg                           |   20 +++++++++++++++-----
 gstreamer/src/format.hg                            |    2 +-
 gstreamer/src/index.hg                             |    2 +-
 gstreamer/src/pad.hg                               |    2 +-
 gstreamer/src/query.hg                             |    2 +-
 gstreamer/src/task.hg                              |    2 +-
 .../extra_defs_gen/generate_plugin_gmmproc_file.cc |    2 +-
 8 files changed, 35 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 087c167..03f0387 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2009-12-09  José Alburquerque  <jaalburqu svn gnome org>
+
+	Make single argument constructors explicit.
+
+	* gstreamer/src/format.hg:
+	* gstreamer/src/index.hg:
+	* gstreamer/src/pad.hg:
+	* gstreamer/src/query.hg:
+	* gstreamer/src/task.hg:
+	* tools/extra_defs_gen/generate_plugin_gmmproc_file.cc: Use 'explicit'
+	for single argument constructors so that they are used explicitly and
+	not by an implicit conversion.
+	* gstreamer/src/element.hg: Also update the ElementInterfaced<> docs.
+
 2009-12-07  José Alburquerque  <jaalburqu svn gnome org>
 
 	VideoSink: Wrap center_rect() method.
diff --git a/gstreamer/src/element.hg b/gstreamer/src/element.hg
index 45822bf..d10332d 100644
--- a/gstreamer/src/element.hg
+++ b/gstreamer/src/element.hg
@@ -472,20 +472,30 @@ class ElementInterfaced
   public T_Interface
 {
 public:
-  // Make calls involving underlying gobject unambiguous (specifically, gobj()
-  // is ambiguous when called from an ElementInterfaced<..> class
+  // The gobj() methods make calls involving access to the underlying gobject
+  // unambiguous (specifically, gobj() is ambiguous when called from an
+  // ElementInterfaced<..> class).
+
+  /// Gets the underlying gobject.
   GstElement* gobj();
+
+  /// Gets the underlying gobject.
   const GstElement* gobj() const;
+
+  /// Gets a copy of the underlying gobject.  The copy should be freed.
   GstElement* gobj_copy();
 
   ~ElementInterfaced();
 
 protected:
+  /// Cast constructor.
+  explicit ElementInterfaced(GstElement* castitem);
+
+  /// Copy constructor.
   ElementInterfaced(const ElementInterfaced&);
-  ElementInterfaced& operator=(const ElementInterfaced&);
 
-protected:
-  ElementInterfaced(GstElement* castitem);
+  /// Assignment operator.
+  ElementInterfaced& operator=(const ElementInterfaced&);
 
 private:
   friend class Gst::Interface;
diff --git a/gstreamer/src/format.hg b/gstreamer/src/format.hg
index 8409a37..f5e298d 100644
--- a/gstreamer/src/format.hg
+++ b/gstreamer/src/format.hg
@@ -45,7 +45,7 @@ public:
    * The @a castitem is left unaffected; its contents are simply copied.
    * @param castitem The GstFormatDefinition to copy contents from.
    */
-  FormatDefinition(const GstFormatDefinition* castitem);
+  explicit FormatDefinition(const GstFormatDefinition* castitem);
 
   /// The unique id of this format.
   Gst::Format         value;
diff --git a/gstreamer/src/index.hg b/gstreamer/src/index.hg
index b706a8f..bac1dae 100644
--- a/gstreamer/src/index.hg
+++ b/gstreamer/src/index.hg
@@ -56,7 +56,7 @@ public:
    * The @a castitem is left unaffected; its contents are simply copied.
    * @param castitem The GstIndexAssociation to copy contents from.
    */
-   IndexAssociation(const GstIndexAssociation* castitem);
+   explicit IndexAssociation(const GstIndexAssociation* castitem);
 
   /// The format of the association.
   Gst::Format format;
diff --git a/gstreamer/src/pad.hg b/gstreamer/src/pad.hg
index f739f41..6efc35f 100644
--- a/gstreamer/src/pad.hg
+++ b/gstreamer/src/pad.hg
@@ -81,7 +81,7 @@ class Pad : public Object
 
 protected:
   _WRAP_CTOR(Pad(const Glib::ustring& name, PadDirection direction), gst_pad_new)
-  Pad(PadDirection dir);
+  explicit Pad(PadDirection dir);
   Pad(const Glib::RefPtr<const Gst::PadTemplate>& templ, const Glib::ustring& name);
   Pad(const Glib::RefPtr<const Gst::PadTemplate>& templ);
 
diff --git a/gstreamer/src/query.hg b/gstreamer/src/query.hg
index 3c4848c..c4f2cc2 100644
--- a/gstreamer/src/query.hg
+++ b/gstreamer/src/query.hg
@@ -50,7 +50,7 @@ public:
    * type.  The @a castitem is left unaffected; its contents are simply copied.
    * @param castitem The GstQueryTypeDefinition to copy contents from.
    */
-  QueryTypeDefinition(const GstQueryTypeDefinition* castitem);
+  explicit QueryTypeDefinition(const GstQueryTypeDefinition* castitem);
 
   /// The unique id of the Query type.
   QueryType             value;
diff --git a/gstreamer/src/task.hg b/gstreamer/src/task.hg
index f9a72af..c654a5d 100644
--- a/gstreamer/src/task.hg
+++ b/gstreamer/src/task.hg
@@ -86,7 +86,7 @@ public:
     typedef sigc::slot<void, const Glib::RefPtr<Gst::Task>&, Glib::Thread*> SlotLeave;
 
 protected:
-  Task(const SlotTask& task_slot);
+  explicit Task(const SlotTask& task_slot);
 
 public:
   /** Create a new Gst::Task that will repeatedly call the provided slot as a
diff --git a/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc b/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
index 0264234..e0192a3 100644
--- a/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
+++ b/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
@@ -551,7 +551,7 @@ static void generate_hg_file(const std::string& includeMacroCalls,
 
   std::cout << "protected:" << std::endl;
   std::cout << "  " << cppTypeName << "();" << std::endl;
-  std::cout << "  " << cppTypeName << "(const Glib::ustring& name);" << std::endl << std::endl;
+  std::cout << "  explicit " << cppTypeName << "(const Glib::ustring& name);" << std::endl << std::endl;
 
   std::cout << "public:" << std::endl;
   std::cout << "/** Creates a new " << pluginName << " plugin with a unique name." << std::endl;



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