#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
*
#include <list>
#include <glib-object.h>
-#include <glib/gmem.h>
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
#include <glibmm/wrap.h>
/**
* @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. */
};
{ 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
} // namespace Glib
-
#endif /* _GLIBMM_CONTAINERHANDLE_SHARED_H */
-