Flutter Engine
fml::ScopedBlock< B > Class Template Reference

#include <scoped_block.h>

Public Member Functions

 ScopedBlock (B block=nullptr, OwnershipPolicy policy=OwnershipPolicy::Assume)
 
 ScopedBlock (const ScopedBlock< B > &that)
 
 ~ScopedBlock ()
 
ScopedBlockoperator= (const ScopedBlock< B > &that)
 
void reset (B block=nullptr, OwnershipPolicy policy=OwnershipPolicy::Assume)
 
bool operator== (B that) const
 
bool operator!= (B that) const
 
 operator B () const
 
get () const
 
void swap (ScopedBlock &that)
 
release ()
 

Detailed Description

template<typename B>
class fml::ScopedBlock< B >

Definition at line 28 of file scoped_block.h.

Constructor & Destructor Documentation

◆ ScopedBlock() [1/2]

template<typename B>
fml::ScopedBlock< B >::ScopedBlock ( block = nullptr,
OwnershipPolicy  policy = OwnershipPolicy::Assume 
)
inlineexplicit

Definition at line 30 of file scoped_block.h.

32  : block_(block) {
33  if (block_ && policy == OwnershipPolicy::Retain)
34  block_ = Block_copy(block);
35  }

◆ ScopedBlock() [2/2]

template<typename B>
fml::ScopedBlock< B >::ScopedBlock ( const ScopedBlock< B > &  that)
inline

Definition at line 37 of file scoped_block.h.

37  : block_(that.block_) {
38  if (block_)
39  block_ = Block_copy(block_);
40  }

◆ ~ScopedBlock()

template<typename B>
fml::ScopedBlock< B >::~ScopedBlock ( )
inline

Definition at line 42 of file scoped_block.h.

42  {
43  if (block_)
44  Block_release(block_);
45  }

Member Function Documentation

◆ get()

template<typename B>
B fml::ScopedBlock< B >::get ( ) const
inline

Definition at line 67 of file scoped_block.h.

Referenced by fml::ScopedBlock< PlatformMessageResponseCallback >::operator=().

67 { return block_; }

◆ operator B()

template<typename B>
fml::ScopedBlock< B >::operator B ( ) const
inline

Definition at line 65 of file scoped_block.h.

65 { return block_; }

◆ operator!=()

template<typename B>
bool fml::ScopedBlock< B >::operator!= ( that) const
inline

Definition at line 63 of file scoped_block.h.

63 { return block_ != that; }

◆ operator=()

template<typename B>
ScopedBlock& fml::ScopedBlock< B >::operator= ( const ScopedBlock< B > &  that)
inline

Definition at line 47 of file scoped_block.h.

47  {
48  reset(that.get(), OwnershipPolicy::Retain);
49  return *this;
50  }
void reset(B block=nullptr, OwnershipPolicy policy=OwnershipPolicy::Assume)
Definition: scoped_block.h:52

◆ operator==()

template<typename B>
bool fml::ScopedBlock< B >::operator== ( that) const
inline

Definition at line 61 of file scoped_block.h.

61 { return block_ == that; }

◆ release()

template<typename B>
B fml::ScopedBlock< B >::release ( )
inline

Definition at line 75 of file scoped_block.h.

75  {
76  B temp = block_;
77  block_ = nullptr;
78  return temp;
79  }

◆ reset()

template<typename B>
void fml::ScopedBlock< B >::reset ( block = nullptr,
OwnershipPolicy  policy = OwnershipPolicy::Assume 
)
inline

Definition at line 52 of file scoped_block.h.

53  {
54  if (block && policy == OwnershipPolicy::Retain)
55  block = Block_copy(block);
56  if (block_)
57  Block_release(block_);
58  block_ = block;
59  }

◆ swap()

template<typename B>
void fml::ScopedBlock< B >::swap ( ScopedBlock< B > &  that)
inline

Definition at line 69 of file scoped_block.h.

69  {
70  B temp = that.block_;
71  that.block_ = block_;
72  block_ = temp;
73  }

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