#include <cf_utils.h>
Public Member Functions | |
| CFRef () | |
| Creates a new null CFRef. | |
| CFRef (T instance) | |
| CFRef (const CFRef &other) | |
| CFRef (CFRef &&other) | |
| CFRef & | operator= (CFRef &&other) |
Takes over ownership of the CoreFoundation object owned by other. | |
| ~CFRef () | |
| Releases the underlying CoreFoundation object, if non-null. | |
| void | Reset (T instance=CFRefTraits< T >::kNullValue) |
| void | Retain (T instance=CFRefTraits< T >::kNullValue) |
| T | Release () |
| T | Get () const |
| operator T () const | |
| operator bool () const | |
| Returns true if the underlying CoreFoundation object is non-null. | |
RAII-based smart pointer wrapper for CoreFoundation objects.
CFRef takes over ownership of the object it wraps and ensures that retain and release are called as appropriate on creation, assignment, and disposal.
Definition at line 27 of file cf_utils.h.
|
inline |
Creates a new null CFRef.
Definition at line 30 of file cf_utils.h.
|
inlineexplicit |
Takes over ownership of instance, which is expected to be already retained.
Definition at line 34 of file cf_utils.h.
|
inline |
Copy ctor: Creates a retained copy of the CoreFoundation object owned by other.
Definition at line 38 of file cf_utils.h.
References fml::CFRefTraits< T >::Retain().
|
inline |
Move ctor: Takes over ownership of the CoreFoundation object owned by other. The object owned by other is set to null.
Definition at line 46 of file cf_utils.h.
|
inline |
Releases the underlying CoreFoundation object, if non-null.
Definition at line 57 of file cf_utils.h.
References fml::CFRefTraits< T >::Release().
|
inline |
Returns the underlying CoreFoundation object. Ownership of the returned object follows The Get Rule.
Definition at line 101 of file cf_utils.h.
Referenced by fml::testing::TEST(), and fml::testing::TEST().
|
inlineexplicit |
Returns true if the underlying CoreFoundation object is non-null.
Definition at line 112 of file cf_utils.h.
|
inline |
Returns the underlying CoreFoundation object. Ownership of the returned object follows The Get Rule.
Definition at line 109 of file cf_utils.h.
|
inline |
Takes over ownership of the CoreFoundation object owned by other.
Definition at line 51 of file cf_utils.h.
References fml::CFRef< T >::Reset().
|
inline |
Returns and transfers ownership of the underlying CoreFoundation object to the caller. The caller is responsible for calling CFRelease when done with the object.
Definition at line 90 of file cf_utils.h.
References instance.
|
inline |
Takes over ownership of instance, null by default. The object is expected to be already retained if non-null.
Releases the previous object, if non-null.
Definition at line 68 of file cf_utils.h.
References instance, and fml::CFRefTraits< T >::Release().
Referenced by impeller::testing::MetalScreenshot::MetalScreenshot(), fml::CFRef< T >::operator=(), fml::CFRef< T >::Retain(), fml::testing::TEST(), and fml::testing::TEST().
|
inline |
Retains a shared copy of instance. The previous object is released if non-null. Has no effect if instance is the currently-held object.
Definition at line 77 of file cf_utils.h.
References instance, fml::CFRef< T >::Reset(), and fml::CFRefTraits< T >::Retain().
Referenced by fml::testing::TEST(), and fml::testing::TEST().