Go to the documentation of this file.
39 #ifndef CGU_GOBJ_HANDLE_H
40 #define CGU_GOBJ_HANDLE_H
46 #include <glib-object.h>
153 if (obj_p) g_object_unref(obj_p);
157 if (obj_p) g_object_ref(obj_p);
175 if (ptr && g_object_is_floating(ptr)) {
176 g_object_ref_sink(ptr);
201 if (ptr && g_object_is_floating(ptr)) {
202 g_object_ref_sink(ptr);
249 if (obj_p != gobj.obj_p) {
292 T*
get()
const {
return obj_p;}
312 operator T*()
const {
return obj_p;}
423 virtual const char*
what()
const throw() {
return "GobjWeakHandleError\n";}
438 if (ptr) g_object_add_weak_pointer((GObject*)ptr,
450 if (obj_p) g_object_remove_weak_pointer((GObject*)obj_p,
453 if (ptr) g_object_add_weak_pointer((GObject*)ptr,
465 if (obj_p) g_object_add_weak_pointer((GObject*)obj_p,
477 if (obj_p) g_object_add_weak_pointer((GObject*)obj_p,
513 operator bool()
const {
return obj_p;}
515 #ifndef DOXYGEN_PARSING
523 bool expired()
const {
return obj_p;}
587 #if defined(CGU_USE_SMART_PTR_COMPARISON) || defined(DOXYGEN_PARSING)
601 return (h1.
get() == h2.
get());
633 return std::less<T*>()(h1.
get(), h2.
get());
636 #endif // CGU_USE_SMART_PTR_COMPARISON
643 #if defined(CGU_USE_SMART_PTR_COMPARISON) && !defined(DOXYGEN_PARSING)
648 struct hash<
Cgu::GobjHandle<T>> {
649 typedef std::size_t result_type;
651 result_type operator()(
const argument_type& h)
const {
659 #endif // CGU_USE_SMART_PTR_COMPARISON
T & operator*() const
Definition: gobj_handle.h:556
Definition: application.h:44
This is a handle for managing the reference count of GObjects.
Definition: gobj_handle.h:148
bool operator!=(const GobjHandle< T > &h1, const GobjHandle< T > &h2)
Definition: gobj_handle.h:613
T * operator->() const
Definition: gobj_handle.h:305
GobjHandle(GobjHandle &&gobj)
Definition: gobj_handle.h:220
T * get() const
Definition: gobj_handle.h:545
Definition: gobj_handle.h:422
void reset(T *ptr=0)
Definition: gobj_handle.h:194
bool operator<(const GobjHandle< T > &h1, const GobjHandle< T > &h2)
Definition: gobj_handle.h:632
T & operator*() const
Definition: gobj_handle.h:298
GobjWeakHandle(const GobjHandle< T > &gobj)
Definition: gobj_handle.h:475
void reset(T *ptr=0)
Definition: gobj_handle.h:448
GobjWeakHandle & operator=(const GobjHandle< T > &gobj)
Definition: gobj_handle.h:502
~GobjWeakHandle()
Definition: gobj_handle.h:583
GobjWeakHandle(const GobjWeakHandle &gobj)
Definition: gobj_handle.h:463
GobjHandle(const GobjHandle &gobj)
Definition: gobj_handle.h:211
T * get() const
Definition: gobj_handle.h:292
A specialization of std::hash for Cgu::Callback::FunctorArg, Cgu::Callback::SafeFunctorArg,...
GobjHandle & operator=(GobjHandle &&gobj)
Definition: gobj_handle.h:272
This is a handle for managing weak references to GObjects.
Definition: gobj_handle.h:426
bool operator==(const GobjHandle< T > &h1, const GobjHandle< T > &h2)
Definition: gobj_handle.h:600
bool valid() const
Definition: gobj_handle.h:534
GobjWeakHandle(T *ptr=0)
Definition: gobj_handle.h:436
T * operator->() const
Definition: gobj_handle.h:567
GobjHandle & operator=(const GobjHandle &gobj)
Definition: gobj_handle.h:244
GobjHandle(T *ptr=0)
Definition: gobj_handle.h:170
GobjWeakHandle & operator=(const GobjWeakHandle &gobj)
Definition: gobj_handle.h:489
virtual const char * what() const
Definition: gobj_handle.h:423
~GobjHandle()
Definition: gobj_handle.h:319