Flutter Engine
 
Loading...
Searching...
No Matches
impeller::interop::ScopedObject< Object > Class Template Referencefinal

#include <object.h>

Public Member Functions

 ScopedObject ()=default
 
 ScopedObject (std::nullptr_t)
 
 ScopedObject (Object *ptr, AdoptTag)
 
 ScopedObject (Object *ptr)
 
 ~ScopedObject ()
 
 ScopedObject (const ScopedObject &other)
 
 ScopedObject (ScopedObject &&other)
 
ScopedObjectoperator= (const ScopedObject &other)
 
ScopedObjectoperator= (ScopedObject &&other)
 
ObjectGet () const
 
Object::InteropCSiblingGetC () const
 
Objectoperator* () const
 
Objectoperator-> () const
 
 operator bool () const
 
Object::InteropCSiblingLeak ()
 

Detailed Description

template<typename Object>
class impeller::interop::ScopedObject< Object >

Definition at line 67 of file object.h.

Constructor & Destructor Documentation

◆ ScopedObject() [1/6]

template<typename Object >
impeller::interop::ScopedObject< Object >::ScopedObject ( )
default

◆ ScopedObject() [2/6]

template<typename Object >
impeller::interop::ScopedObject< Object >::ScopedObject ( std::nullptr_t  )
inline

Definition at line 71 of file object.h.

72 {}

◆ ScopedObject() [3/6]

template<typename Object >
impeller::interop::ScopedObject< Object >::ScopedObject ( Object ptr,
AdoptTag   
)
inlineexplicit

Definition at line 74 of file object.h.

74: object_(ptr) {}

◆ ScopedObject() [4/6]

template<typename Object >
impeller::interop::ScopedObject< Object >::ScopedObject ( Object ptr)
inlineexplicit

Definition at line 76 of file object.h.

76 : object_(ptr) {
77 if (object_) {
78 object_->Retain();
79 }
80 }

References impeller::interop::ObjectBase::Retain().

◆ ~ScopedObject()

template<typename Object >
impeller::interop::ScopedObject< Object >::~ScopedObject ( )
inline

Definition at line 82 of file object.h.

82{ Release(); }

◆ ScopedObject() [5/6]

template<typename Object >
impeller::interop::ScopedObject< Object >::ScopedObject ( const ScopedObject< Object > &  other)
inline

Definition at line 84 of file object.h.

84: ScopedObject(other.Get()) {}

◆ ScopedObject() [6/6]

template<typename Object >
impeller::interop::ScopedObject< Object >::ScopedObject ( ScopedObject< Object > &&  other)
inline

Definition at line 86 of file object.h.

86{ std::swap(object_, other.object_); }

Member Function Documentation

◆ Get()

template<typename Object >
Object * impeller::interop::ScopedObject< Object >::Get ( ) const
inline

Definition at line 107 of file object.h.

107{ return object_; }

Referenced by impeller::interop::ScopedObject< Object >::GetC().

◆ GetC()

template<typename Object >
Object::InteropCSibling * impeller::interop::ScopedObject< Object >::GetC ( ) const
inline

Definition at line 109 of file object.h.

109 {
110 return reinterpret_cast<typename Object::InteropCSibling*>(Get());
111 }

References impeller::interop::ScopedObject< Object >::Get().

◆ Leak()

template<typename Object >
Object::InteropCSibling * impeller::interop::ScopedObject< Object >::Leak ( )
inline

Definition at line 126 of file object.h.

126 {
127 auto to_leak = object_;
128 object_ = nullptr;
129 return reinterpret_cast<typename Object::InteropCSibling*>(to_leak);
130 }

◆ operator bool()

template<typename Object >
impeller::interop::ScopedObject< Object >::operator bool ( ) const
inlineexplicit

Definition at line 123 of file object.h.

123{ return !!object_; }

◆ operator*()

template<typename Object >
Object & impeller::interop::ScopedObject< Object >::operator* ( ) const
inline

Definition at line 113 of file object.h.

113 {
114 FML_DCHECK(object_);
115 return *object_;
116 }
#define FML_DCHECK(condition)
Definition logging.h:122

References FML_DCHECK.

◆ operator->()

template<typename Object >
Object * impeller::interop::ScopedObject< Object >::operator-> ( ) const
inline

Definition at line 118 of file object.h.

118 {
119 FML_DCHECK(object_);
120 return object_;
121 }

References FML_DCHECK.

◆ operator=() [1/2]

template<typename Object >
ScopedObject & impeller::interop::ScopedObject< Object >::operator= ( const ScopedObject< Object > &  other)
inline

Definition at line 88 of file object.h.

88 {
89 // Self assignment.
90 if (object_ == other.object_) {
91 return *this;
92 }
93 if (other.object_) {
94 other.object_->Retain();
95 }
96 Release();
97 FML_DCHECK(object_ == nullptr);
98 object_ = other.object_;
99 return *this;
100 }

References FML_DCHECK, and impeller::interop::ObjectBase::Retain().

◆ operator=() [2/2]

template<typename Object >
ScopedObject & impeller::interop::ScopedObject< Object >::operator= ( ScopedObject< Object > &&  other)
inline

Definition at line 102 of file object.h.

102 {
103 std::swap(object_, other.object_);
104 return *this;
105 }

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