| Flutter Impeller |

Public Member Functions | List of all members
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)
ScopedObject & | operator= (const ScopedObject &other)
ScopedObject & | operator= (ScopedObject &&other)
Object * | Get () const
Object::InteropCSibling * | GetC () const
Object & | operator* () const
Object * | operator-> () const
| operator bool () const
Object::InteropCSibling * | Leak ()

## 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 |
| ) |  |
| inline explicit

Definition at line 74 of file object.h.

74 : object_(ptr) {}

## ◆ ScopedObject() [4/6]

template<typename Object >

impeller::interop::ScopedObject< Object >::ScopedObject | ( | Object * | ptr | ) |
| inline explicit

Definition at line 76 of file object.h.

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

## ◆ ~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< impeller::interop::Context >::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 }

## ◆ 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
| inline explicit

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 }

## ◆ 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 }

## ◆ 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 }

## ◆ 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:

- impeller/toolkit/interop/object.h

impeller::interop::ScopedObject::Get
Object * Get() const
Definition: object.h:107
impeller::interop::ObjectBase::Retain
void Retain()
Definition: object.h:29
impeller::interop::Object::InteropCSibling
CSibling InteropCSibling
Definition: object.h:59
impeller::interop::ScopedObject::ScopedObject
ScopedObject()=default