Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
fml::CFRef< T > Class Template Reference

#include <cf_utils.h>

Public Member Functions

 CFRef ()
 
 CFRef (T instance)
 
 CFRef (const CFRef &other)
 
 CFRef (CFRef &&other)
 
CFRefoperator= (CFRef &&other)
 
 ~CFRef ()
 
void Reset (T instance=nullptr)
 
T Release ()
 
 operator T () const
 
 operator bool () const
 

Detailed Description

template<class T>
class fml::CFRef< T >

Definition at line 15 of file cf_utils.h.

Constructor & Destructor Documentation

◆ CFRef() [1/4]

template<class T >
fml::CFRef< T >::CFRef ( )
inline

Definition at line 17 of file cf_utils.h.

17: instance_(nullptr) {}

◆ CFRef() [2/4]

template<class T >
fml::CFRef< T >::CFRef ( T  instance)
inline

Definition at line 20 of file cf_utils.h.

20: instance_(instance) {}
VkInstance instance
Definition main.cc:48

◆ CFRef() [3/4]

template<class T >
fml::CFRef< T >::CFRef ( const CFRef< T > &  other)
inline

Definition at line 22 of file cf_utils.h.

22 : instance_(other.instance_) {
23 if (instance_) {
24 CFRetain(instance_);
25 }
26 }

◆ CFRef() [4/4]

template<class T >
fml::CFRef< T >::CFRef ( CFRef< T > &&  other)
inline

Definition at line 28 of file cf_utils.h.

28 : instance_(other.instance_) {
29 other.instance_ = nullptr;
30 }

◆ ~CFRef()

template<class T >
fml::CFRef< T >::~CFRef ( )
inline

Definition at line 37 of file cf_utils.h.

37 {
38 if (instance_ != nullptr) {
39 CFRelease(instance_);
40 }
41 instance_ = nullptr;
42 }

Member Function Documentation

◆ operator bool()

template<class T >
fml::CFRef< T >::operator bool ( ) const
inlineexplicit

Definition at line 61 of file cf_utils.h.

61{ return instance_ != nullptr; }

◆ operator T()

template<class T >
fml::CFRef< T >::operator T ( ) const
inline

Definition at line 59 of file cf_utils.h.

59{ return instance_; }

◆ operator=()

template<class T >
CFRef & fml::CFRef< T >::operator= ( CFRef< T > &&  other)
inline

Definition at line 32 of file cf_utils.h.

32 {
33 Reset(other.Release());
34 return *this;
35 }
void Reset(T instance=nullptr)
Definition cf_utils.h:44

◆ Release()

template<class T >
T fml::CFRef< T >::Release ( )
inline

Definition at line 52 of file cf_utils.h.

52 {
53 auto instance = instance_;
54 instance_ = nullptr;
55 return instance;
56 }

◆ Reset()

template<class T >
void fml::CFRef< T >::Reset ( T  instance = nullptr)
inline

Definition at line 44 of file cf_utils.h.

44 {
45 if (instance_ != nullptr) {
46 CFRelease(instance_);
47 }
48
49 instance_ = instance;
50 }

The documentation for this class was generated from the following file: