summaryrefslogtreecommitdiff
path: root/glib/glibmm/object.h
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2005-01-20 18:24:28 +0000
committerMurray Cumming <murrayc@src.gnome.org>2005-01-20 18:24:28 +0000
commite89045516fe7022c468249c913520d0d0908973b (patch)
tree2d6f29bea14038c3959aff77bbc97712e3c439c4 /glib/glibmm/object.h
parentf4ff8255ba21cfdea5310eccea639ec13cd4eb48 (diff)
downloadglibmm-e89045516fe7022c468249c913520d0d0908973b.tar.gz
Custom boxed types, more #ifdef ABI-changing to add intermediate extern-C
2005-01-20 Murray Cumming <murrayc@murrayc.com> * glib/glibmm/value.h, value_custom.[h|cc]: Custom boxed types, more #ifdef ABI-changing to add intermediate extern-C callback function, for the IRIX MipsPro compiler. This might not actually work at runtime, but if it does not then lots of funtionality should still work. Conditionally moved the RefPtr Value specialization into object.h, as before.
Diffstat (limited to 'glib/glibmm/object.h')
-rw-r--r--glib/glibmm/object.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/glib/glibmm/object.h b/glib/glibmm/object.h
index ed49e283..e9bf00dc 100644
--- a/glib/glibmm/object.h
+++ b/glib/glibmm/object.h
@@ -227,6 +227,51 @@ struct TypeTraits< Glib::RefPtr<const T> >
} //namespace Container_Helpers
+
+template <class T, class PtrT> inline
+PtrT Value_Pointer<T,PtrT>::get_(Glib::Object*) const
+{
+ return dynamic_cast<T*>(get_object());
+}
+
+
+/** Partial specialization for RefPtr<> to Glib::Object.
+ * @ingroup glibmmValue
+ */
+template <class T>
+class Value< Glib::RefPtr<T> > : public ValueBase_Object
+{
+public:
+ typedef Glib::RefPtr<T> CppType;
+ typedef typename T::BaseObjectType* CType;
+
+ static GType value_type() { return T::get_base_type(); }
+
+ void set(const CppType& data) { set_object(data.operator->()); }
+ CppType get() const { return Glib::RefPtr<T>::cast_dynamic(get_object_copy()); }
+};
+
+//The SUN Forte Compiler has a problem with this:
+#ifdef GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS
+
+/** Partial specialization for RefPtr<> to const Glib::Object.
+ * @ingroup glibmmValue
+ */
+template <class T>
+class Value< Glib::RefPtr<const T> > : public ValueBase_Object
+{
+public:
+ typedef Glib::RefPtr<const T> CppType;
+ typedef typename T::BaseObjectType* CType;
+
+ static GType value_type() { return T::get_base_type(); }
+
+ void set(const CppType& data) { set_object(const_cast<T*>(data.operator->())); }
+ CppType get() const { return Glib::RefPtr<T>::cast_dynamic(get_object_copy()); }
+};
+#endif //GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS
+
+
#endif //DOXYGEN_SHOULD_SKIP_THIS
#endif //GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION