Merged revisions 6293,6296-6306,6308 via svnmerge from
[ardour.git] / libs / glibmm2 / glib / glibmm / containerhandle_shared.h
index 9f31a30dc33c431d3650b8c6191b289361c29bb1..04258b7ad42888b2e62fae61d386801b0d40f57d 100644 (file)
@@ -2,7 +2,7 @@
 #ifndef _GLIBMM_CONTAINERHANDLE_SHARED_H
 #define _GLIBMM_CONTAINERHANDLE_SHARED_H
 
-/* $Id: containerhandle_shared.h 322 2006-09-19 20:36:43Z murrayc $ */
+/* $Id: containerhandle_shared.h 749 2008-12-10 14:23:33Z jjongsma $ */
 
 /* Copyright (C) 2002 The gtkmm Development Team
  *
@@ -29,7 +29,6 @@
 #include <list>
 
 #include <glib-object.h>
-#include <glib/gmem.h>
 #include <glibmm/refptr.h>
 #include <glibmm/ustring.h>
 #include <glibmm/wrap.h>
@@ -54,11 +53,16 @@ namespace Glib
 /**
  * @ingroup ContHandles
  */
+//! Ownership of the container
+/*! Defines how and if the container will release the list and 
+ * its elemens when it is destroyed 
+ */
 enum OwnershipType
 {
-  OWNERSHIP_NONE = 0,
-  OWNERSHIP_SHALLOW, //Release the list, but not its elements, when the container is deleted
-  OWNERSHIP_DEEP //Release the list, and its elements, when the container is deleted.
+  OWNERSHIP_NONE = 0, /*!< Do not release anything */
+  OWNERSHIP_SHALLOW, /*!< Release the list, but not its elements, when the container is deleted */
+  OWNERSHIP_DEEP /*!< Release the list, and its elements, when the container is deleted. */
 };
 
 
@@ -314,40 +318,22 @@ struct TypeTraits<std::string>
     { g_free(const_cast<CTypeNonConst>(str)); }
 };
 
-/** Specialization for bool
+/** Specialization for bool.
  * @ingroup ContHelpers
  */
 template <>
 struct TypeTraits<bool>
 {
-  typedef bool          CppType;
-  typedef gboolean*     CType;
-  typedef gboolean*     CTypeNonConst;
-
-  static CType to_c_type (CppType val) { return (int*)GINT_TO_POINTER(val); }
-  static CType to_c_type (CType ptr)   { return ptr;                        }  
-
-  static CppType to_cpp_type(CType ptr)
-  { 
-    if(ptr)
-    {
-         //We use this for gboolean too, because it is actually an int.
-         return GPOINTER_TO_INT(ptr);
-       }
-       else
-         return CppType();
-  }
-
-  static void release_c_type(CType /* ptr */)
-  {
-
-  }
+  typedef bool     CppType;
+  typedef gboolean CType;
+  typedef gboolean CTypeNonConst;
+
+  static CType   to_c_type      (CppType item) { return static_cast<CType>(item); }
+  static CType   to_c_type      (CType   item) { return item; }
+  static CppType to_cpp_type    (CType   item) { return (item != 0); }
+  static void    release_c_type (CType) {}
 };
 
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
 #ifndef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS
 
 /* The STL containers in Sun's libCstd don't support templated sequence
@@ -368,6 +354,4 @@ void fill_container(Cont& container, In pbegin, In pend)
 
 } // namespace Glib
 
-
 #endif /* _GLIBMM_CONTAINERHANDLE_SHARED_H */
-