QtGStreamer
0.10.2
|
#include <QGlib/RefPointer>
Public Member Functions | |
RefPointer (T *cppClass) | |
template<class X > | |
RefPointer (const RefPointer< X > &other) | |
RefPointer (const RefPointer< T > &other) | |
template<class X > | |
RefPointer< T > & | operator= (const RefPointer< X > &other) |
RefPointer< T > & | operator= (const RefPointer< T > &other) |
template<class X > | |
bool | operator== (const X &other) const |
template<class X > | |
bool | operator!= (const X &other) const |
void | clear () |
bool | isNull () const |
bool | operator! () const |
T * | operator-> () const |
operator typename T::CType * () const | |
template<class X > | |
RefPointer< X > | staticCast () const |
template<class X > | |
RefPointer< X > | dynamicCast () const |
Static Public Member Functions | |
static RefPointer< T > | wrap (typename T::CType *nativePtr, bool increaseRef=true) |
Related Functions | |
(Note that these are not member functions.) | |
template<class T , class X > | |
boost::enable_if_c < boost::is_pointer< X > ::value &&!boost::is_same< X, typename boost::add_pointer < typename T::CType >::type > ::value, bool >::type | operator== (const X &other, const RefPointer< T > &self) |
template<class T , class X > | |
boost::enable_if_c < boost::is_pointer< X > ::value &&!boost::is_same< X, typename boost::add_pointer < typename T::CType >::type > ::value, bool >::type | operator!= (const X &other, const RefPointer< T > &self) |
template<typename T > | |
uint | qHash (const RefPointer< T > &ptr) |
Smart pointer class for working with wrapper classes that support reference counting.
Nearly all GObject and GStreamer classes are designed to work with reference counting. This class provides a smart pointer for instances of those classes which takes care of increasing and decreasing the reference count automatically when a new pointer is constructed and destructed, respectively.
All wrapper classes that wrap reference-counted objects must be used with RefPointer. For convenience, this library provides typedefs for all the reference-counted wrappers, which are in the form:
So, for example, if you want to use an instance of a QGst::Element, you should declare a pointer to it like that:
|
inlineexplicit |
Definition at line 217 of file refpointer.h.
bool QGlib::RefPointer< T >::operator== | ( | const X & | other) | const |
This operator allows you to compare a RefPointer to either another RefPointer or to a pointer of a C object. For example:
Definition at line 271 of file refpointer.h.
bool QGlib::RefPointer< T >::operator!= | ( | const X & | other) | const |
Definition at line 278 of file refpointer.h.
void QGlib::RefPointer< T >::clear | ( | ) |
Sets this RefPointer to NULL and drops the reference to the object that it was previously pointing at.
Definition at line 316 of file refpointer.h.
|
inline |
Cast operator that implicitly casts the smart pointer to the pointer type of the underlying C instance. For example, RefPointer<QGst::Element> will cast to GstElement*. This is provided as a helper tool for working with native C methods if needed.
Definition at line 359 of file refpointer.h.
|
static |
Makes a RefPointer out of a pointer to a native C instance. If increaseRef is specified as false, the reference count is not increased on construction (but it is decreased on destruction!).
Definition at line 326 of file refpointer.h.
Statically casts this RefPointer to a RefPointer of another class.
Definition at line 366 of file refpointer.h.
Dynamically casts this RefPointer to a RefPointer of another class. This is equivalent to the built-in dynamic_cast, but it additionally allows you to cast objects to interfaces that they implement and vice-versa by using the Glib type system to determine if the cast is allowed or not. If the cast fails, it returns a null RefPointer.
For example, you can do:
because a "filesrc" element implements the GstUriHandler interface.
Definition at line 462 of file refpointer.h.
|
related |
Definition at line 294 of file refpointer.h.
|
related |
Definition at line 310 of file refpointer.h.
|
related |
Definition at line 492 of file refpointer.h.