Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
fxcrt::MaybeOwned< T, D > Class Template Reference

#include <maybe_owned.h>

+ Collaboration diagram for fxcrt::MaybeOwned< T, D >:

Public Types

using OwnedType = std::unique_ptr<T, D>
 
using UnownedType = UnownedPtr<T>
 

Public Member Functions

 MaybeOwned ()=default
 
 MaybeOwned (T *ptr)
 
 MaybeOwned (const UnownedType &ptr)
 
 MaybeOwned (OwnedType ptr)
 
 MaybeOwned (const MaybeOwned &that)=delete
 
 MaybeOwned (MaybeOwned &&that) noexcept=default
 
MaybeOwnedoperator= (const MaybeOwned &that)=delete
 
MaybeOwnedoperator= (MaybeOwned &&that) noexcept=default
 
 ~MaybeOwned ()=default
 
void Reset (T *ptr=nullptr)
 
void Reset (OwnedType ptr)
 
bool IsOwned () const
 
void ResetIfUnowned ()
 
T * Get () const &
 
T * Get () &&
 
OwnedType Release ()
 
OwnedType ReleaseAndClear ()
 
MaybeOwnedoperator= (T *ptr)
 
MaybeOwnedoperator= (const UnownedType &ptr)
 
MaybeOwnedoperator= (OwnedType ptr)
 
bool operator== (const MaybeOwned &that) const
 
bool operator== (const OwnedType &ptr) const
 
bool operator== (T *ptr) const
 
bool operator!= (const MaybeOwned &that) const
 
bool operator!= (const OwnedType ptr) const
 
bool operator!= (T *ptr) const
 
 operator bool () const
 
T & operator* () const
 
T * operator-> () const
 

Detailed Description

template<typename T, typename D = std::default_delete<T>>
class fxcrt::MaybeOwned< T, D >

Definition at line 21 of file maybe_owned.h.

Member Typedef Documentation

◆ OwnedType

template<typename T , typename D = std::default_delete<T>>
using fxcrt::MaybeOwned< T, D >::OwnedType = std::unique_ptr<T, D>

Definition at line 23 of file maybe_owned.h.

◆ UnownedType

template<typename T , typename D = std::default_delete<T>>
using fxcrt::MaybeOwned< T, D >::UnownedType = UnownedPtr<T>

Definition at line 24 of file maybe_owned.h.

Constructor & Destructor Documentation

◆ MaybeOwned() [1/6]

template<typename T , typename D = std::default_delete<T>>
fxcrt::MaybeOwned< T, D >::MaybeOwned ( )
default

◆ MaybeOwned() [2/6]

template<typename T , typename D = std::default_delete<T>>
fxcrt::MaybeOwned< T, D >::MaybeOwned ( T * ptr)
inlineexplicit

Definition at line 27 of file maybe_owned.h.

◆ MaybeOwned() [3/6]

template<typename T , typename D = std::default_delete<T>>
fxcrt::MaybeOwned< T, D >::MaybeOwned ( const UnownedType & ptr)
inlineexplicit

Definition at line 28 of file maybe_owned.h.

◆ MaybeOwned() [4/6]

template<typename T , typename D = std::default_delete<T>>
fxcrt::MaybeOwned< T, D >::MaybeOwned ( OwnedType ptr)
inlineexplicit

Definition at line 29 of file maybe_owned.h.

◆ MaybeOwned() [5/6]

template<typename T , typename D = std::default_delete<T>>
fxcrt::MaybeOwned< T, D >::MaybeOwned ( const MaybeOwned< T, D > & that)
delete

◆ MaybeOwned() [6/6]

template<typename T , typename D = std::default_delete<T>>
fxcrt::MaybeOwned< T, D >::MaybeOwned ( MaybeOwned< T, D > && that)
defaultnoexcept

◆ ~MaybeOwned()

template<typename T , typename D = std::default_delete<T>>
fxcrt::MaybeOwned< T, D >::~MaybeOwned ( )
default

Member Function Documentation

◆ Get() [1/2]

template<typename T , typename D = std::default_delete<T>>
T * fxcrt::MaybeOwned< T, D >::Get ( ) &&
inline

Definition at line 53 of file maybe_owned.h.

◆ Get() [2/2]

template<typename T , typename D = std::default_delete<T>>
T * fxcrt::MaybeOwned< T, D >::Get ( ) const &
inline

Definition at line 50 of file maybe_owned.h.

◆ IsOwned()

template<typename T , typename D = std::default_delete<T>>
bool fxcrt::MaybeOwned< T, D >::IsOwned ( ) const
inline

Definition at line 42 of file maybe_owned.h.

Referenced by fxcrt::MaybeOwned< T, D >::ResetIfUnowned().

+ Here is the caller graph for this function:

◆ operator bool()

template<typename T , typename D = std::default_delete<T>>
fxcrt::MaybeOwned< T, D >::operator bool ( ) const
inlineexplicit

Definition at line 94 of file maybe_owned.h.

◆ operator!=() [1/3]

template<typename T , typename D = std::default_delete<T>>
bool fxcrt::MaybeOwned< T, D >::operator!= ( const MaybeOwned< T, D > & that) const
inline

Definition at line 90 of file maybe_owned.h.

◆ operator!=() [2/3]

template<typename T , typename D = std::default_delete<T>>
bool fxcrt::MaybeOwned< T, D >::operator!= ( const OwnedType ptr) const
inline

Definition at line 91 of file maybe_owned.h.

◆ operator!=() [3/3]

template<typename T , typename D = std::default_delete<T>>
bool fxcrt::MaybeOwned< T, D >::operator!= ( T * ptr) const
inline

Definition at line 92 of file maybe_owned.h.

◆ operator*()

template<typename T , typename D = std::default_delete<T>>
T & fxcrt::MaybeOwned< T, D >::operator* ( ) const
inline

Definition at line 95 of file maybe_owned.h.

◆ operator->()

template<typename T , typename D = std::default_delete<T>>
T * fxcrt::MaybeOwned< T, D >::operator-> ( ) const
inline

Definition at line 96 of file maybe_owned.h.

◆ operator=() [1/5]

template<typename T , typename D = std::default_delete<T>>
MaybeOwned & fxcrt::MaybeOwned< T, D >::operator= ( const MaybeOwned< T, D > & that)
delete

◆ operator=() [2/5]

template<typename T , typename D = std::default_delete<T>>
MaybeOwned & fxcrt::MaybeOwned< T, D >::operator= ( const UnownedType & ptr)
inline

Definition at line 77 of file maybe_owned.h.

◆ operator=() [3/5]

template<typename T , typename D = std::default_delete<T>>
MaybeOwned & fxcrt::MaybeOwned< T, D >::operator= ( MaybeOwned< T, D > && that)
defaultnoexcept

◆ operator=() [4/5]

template<typename T , typename D = std::default_delete<T>>
MaybeOwned & fxcrt::MaybeOwned< T, D >::operator= ( OwnedType ptr)
inline

Definition at line 81 of file maybe_owned.h.

◆ operator=() [5/5]

template<typename T , typename D = std::default_delete<T>>
MaybeOwned & fxcrt::MaybeOwned< T, D >::operator= ( T * ptr)
inline

Definition at line 73 of file maybe_owned.h.

◆ operator==() [1/3]

template<typename T , typename D = std::default_delete<T>>
bool fxcrt::MaybeOwned< T, D >::operator== ( const MaybeOwned< T, D > & that) const
inline

Definition at line 86 of file maybe_owned.h.

◆ operator==() [2/3]

template<typename T , typename D = std::default_delete<T>>
bool fxcrt::MaybeOwned< T, D >::operator== ( const OwnedType & ptr) const
inline

Definition at line 87 of file maybe_owned.h.

◆ operator==() [3/3]

template<typename T , typename D = std::default_delete<T>>
bool fxcrt::MaybeOwned< T, D >::operator== ( T * ptr) const
inline

Definition at line 88 of file maybe_owned.h.

◆ Release()

template<typename T , typename D = std::default_delete<T>>
OwnedType fxcrt::MaybeOwned< T, D >::Release ( )
inline

Definition at line 60 of file maybe_owned.h.

◆ ReleaseAndClear()

template<typename T , typename D = std::default_delete<T>>
OwnedType fxcrt::MaybeOwned< T, D >::ReleaseAndClear ( )
inline

Definition at line 67 of file maybe_owned.h.

◆ Reset() [1/2]

template<typename T , typename D = std::default_delete<T>>
void fxcrt::MaybeOwned< T, D >::Reset ( OwnedType ptr)
inline

Definition at line 40 of file maybe_owned.h.

◆ Reset() [2/2]

template<typename T , typename D = std::default_delete<T>>
void fxcrt::MaybeOwned< T, D >::Reset ( T * ptr = nullptr)
inline

Definition at line 39 of file maybe_owned.h.

◆ ResetIfUnowned()

template<typename T , typename D = std::default_delete<T>>
void fxcrt::MaybeOwned< T, D >::ResetIfUnowned ( )
inline

Definition at line 45 of file maybe_owned.h.

References fxcrt::MaybeOwned< T, D >::IsOwned().

+ Here is the call graph for this function:

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