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

#include <scoped_typeref.h>

Inheritance diagram for fml::ScopedTypeRef< T, Traits >:
fml::scoped_nsprotocol< NSMutableDictionary< NSNumber *, SemanticsObject * > * > fml::scoped_nsprotocol< FlutterBasicMessageChannel * > fml::scoped_nsprotocol< UIView * > fml::scoped_nsprotocol< FlutterMethodChannel * > fml::scoped_nsprotocol< UIViewController< FlutterViewResponder > * > fml::scoped_nsprotocol< FlutterClippingMaskViewPool * > fml::scoped_nsprotocol< id< MTLTexture > > fml::scoped_nsprotocol< FlutterDarwinContextMetalImpeller * > fml::scoped_nsprotocol< FlutterDarwinContextMetalSkia * > fml::scoped_nsprotocol< FlutterDarwinExternalTextureMetal * > fml::scoped_nsprotocol< CAMetalLayer * > fml::scoped_nsprotocol< CALayer * > fml::scoped_nsprotocol< NSObject< FlutterTaskQueueDispatch > * > fml::scoped_nsprotocol< FlutterTextInputPlugin * >

Public Types

typedef T element_type
 

Public Member Functions

 ScopedTypeRef (__unsafe_unretained T object=Traits::InvalidValue(), fml::scoped_policy::OwnershipPolicy policy=fml::scoped_policy::kAssume)
 
 ScopedTypeRef (const ScopedTypeRef< T, Traits > &that)
 
template<typename R , typename RTraits >
 ScopedTypeRef (const ScopedTypeRef< R, RTraits > &that_as_subclass)
 
 ScopedTypeRef (ScopedTypeRef< T, Traits > &&that)
 
 ~ScopedTypeRef ()
 
ScopedTypeRefoperator= (const ScopedTypeRef< T, Traits > &that)
 
TInitializeInto ()
 
void reset (__unsafe_unretained T object=Traits::InvalidValue(), fml::scoped_policy::OwnershipPolicy policy=fml::scoped_policy::kAssume)
 
bool operator== (__unsafe_unretained T that) const
 
bool operator!= (__unsafe_unretained T that) const
 
 operator T () const __attribute((ns_returns_not_retained))
 
T get () const __attribute((ns_returns_not_retained))
 
void swap (ScopedTypeRef &that)
 

Protected Member Functions

T release () __attribute((ns_returns_not_retained))
 

Detailed Description

template<typename T, typename Traits = ScopedTypeRefTraits<T>>
class fml::ScopedTypeRef< T, Traits >

Definition at line 51 of file scoped_typeref.h.

Member Typedef Documentation

◆ element_type

template<typename T , typename Traits = ScopedTypeRefTraits<T>>
typedef T fml::ScopedTypeRef< T, Traits >::element_type

Definition at line 53 of file scoped_typeref.h.

Constructor & Destructor Documentation

◆ ScopedTypeRef() [1/4]

template<typename T , typename Traits = ScopedTypeRefTraits<T>>
fml::ScopedTypeRef< T, Traits >::ScopedTypeRef ( __unsafe_unretained T  object = Traits::InvalidValue(),
fml::scoped_policy::OwnershipPolicy  policy = fml::scoped_policy::kAssume 
)
inlineexplicit

Definition at line 55 of file scoped_typeref.h.

58 : object_(object) {
59 if (object_ && policy == fml::scoped_policy::kRetain) {
60 object_ = Traits::Retain(object_);
61 }
62 }

◆ ScopedTypeRef() [2/4]

template<typename T , typename Traits = ScopedTypeRefTraits<T>>
fml::ScopedTypeRef< T, Traits >::ScopedTypeRef ( const ScopedTypeRef< T, Traits > &  that)
inline

Definition at line 65 of file scoped_typeref.h.

65 : object_(that.object_) {
66 if (object_) {
67 object_ = Traits::Retain(object_);
68 }
69 }

◆ ScopedTypeRef() [3/4]

template<typename T , typename Traits = ScopedTypeRefTraits<T>>
template<typename R , typename RTraits >
fml::ScopedTypeRef< T, Traits >::ScopedTypeRef ( const ScopedTypeRef< R, RTraits > &  that_as_subclass)
inlineexplicit

Definition at line 73 of file scoped_typeref.h.

74 : object_(that_as_subclass.get()) {
75 if (object_) {
76 object_ = Traits::Retain(object_);
77 }
78 }

◆ ScopedTypeRef() [4/4]

template<typename T , typename Traits = ScopedTypeRefTraits<T>>
fml::ScopedTypeRef< T, Traits >::ScopedTypeRef ( ScopedTypeRef< T, Traits > &&  that)
inline

Definition at line 81 of file scoped_typeref.h.

81 : object_(that.object_) {
82 that.object_ = Traits::InvalidValue();
83 }

◆ ~ScopedTypeRef()

template<typename T , typename Traits = ScopedTypeRefTraits<T>>
fml::ScopedTypeRef< T, Traits >::~ScopedTypeRef ( )
inline

Definition at line 85 of file scoped_typeref.h.

85 {
86 if (object_) {
87 Traits::Release(object_);
88 }
89 }

Member Function Documentation

◆ get()

template<typename T , typename Traits = ScopedTypeRefTraits<T>>
T fml::ScopedTypeRef< T, Traits >::get ( ) const
inline

Definition at line 123 of file scoped_typeref.h.

123{ return object_; }

◆ InitializeInto()

template<typename T , typename Traits = ScopedTypeRefTraits<T>>
T * fml::ScopedTypeRef< T, Traits >::InitializeInto ( )
inline

Definition at line 99 of file scoped_typeref.h.

99 {
100 FML_DCHECK(!object_);
101 return &object_;
102 }
#define FML_DCHECK(condition)
Definition logging.h:103

◆ operator T()

template<typename T , typename Traits = ScopedTypeRefTraits<T>>
fml::ScopedTypeRef< T, Traits >::operator T ( ) const
inline

Definition at line 121 of file scoped_typeref.h.

121{ return object_; }

◆ operator!=()

template<typename T , typename Traits = ScopedTypeRefTraits<T>>
bool fml::ScopedTypeRef< T, Traits >::operator!= ( __unsafe_unretained T  that) const
inline

Definition at line 118 of file scoped_typeref.h.

118{ return object_ != that; }

◆ operator=()

template<typename T , typename Traits = ScopedTypeRefTraits<T>>
ScopedTypeRef & fml::ScopedTypeRef< T, Traits >::operator= ( const ScopedTypeRef< T, Traits > &  that)
inline

Definition at line 91 of file scoped_typeref.h.

91 {
93 return *this;
94 }
m reset()

◆ operator==()

template<typename T , typename Traits = ScopedTypeRefTraits<T>>
bool fml::ScopedTypeRef< T, Traits >::operator== ( __unsafe_unretained T  that) const
inline

Definition at line 116 of file scoped_typeref.h.

116{ return object_ == that; }

◆ release()

template<typename T , typename Traits = ScopedTypeRefTraits<T>>
T fml::ScopedTypeRef< T, Traits >::release ( )
inlineprotected

Definition at line 135 of file scoped_typeref.h.

135 {
136 __unsafe_unretained T temp = object_;
137 object_ = Traits::InvalidValue();
138 return temp;
139 }
#define T

◆ reset()

template<typename T , typename Traits = ScopedTypeRefTraits<T>>
void fml::ScopedTypeRef< T, Traits >::reset ( __unsafe_unretained T  object = Traits::InvalidValue(),
fml::scoped_policy::OwnershipPolicy  policy = fml::scoped_policy::kAssume 
)
inline

Definition at line 104 of file scoped_typeref.h.

106 {
107 if (object && policy == fml::scoped_policy::kRetain) {
108 object = Traits::Retain(object);
109 }
110 if (object_) {
111 Traits::Release(object_);
112 }
113 object_ = object;
114 }

◆ swap()

template<typename T , typename Traits = ScopedTypeRefTraits<T>>
void fml::ScopedTypeRef< T, Traits >::swap ( ScopedTypeRef< T, Traits > &  that)
inline

Definition at line 125 of file scoped_typeref.h.

125 {
126 __unsafe_unretained T temp = that.object_;
127 that.object_ = object_;
128 object_ = temp;
129 }

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