PMT Renovated main-branch
Partition Manager Tool is a fast, reliable, and feature-rich CLI application for Android devices that enables advanced partition operations such as backup, flashing, erasing, information retrieval, and more.
Loading...
Searching...
No Matches
Helper::Capsule< _Type > Class Template Reference

A "capsule" class that stores references. More...

#include <capsule.hpp>

Public Member Functions

 Capsule (_Type &value) noexcept
 A constructor that takes data as a reference.
 
void set (_Type &_value) noexcept
 Get a reference to another piece of data and save it. Often, you can make changes later as well.
 
_Type & get () noexcept
 Retrieve the stored data.
 
_Type & get () const noexcept
 Retrieve the stored data.
 
 operator _Type & () noexcept
 Get the reference held directly with the '&' operator.
 
 operator _Type & () const noexcept
 Get the reference held directly with the '&' operator.
 
 operator _Type * () noexcept
 Get the reference held directly with the '*' operator.
 
Capsuleoperator= (const Capsule &other) noexcept=default
 Take the reference held by another capsule.
 
Capsuleoperator= (const _Type &_value) noexcept
 Change the held reference.
 
bool operator== (const Capsule &other) const noexcept
 Check if the data held by the input capsule matches the data being held (==).
 
bool operator== (const _Type &_value) const noexcept
 Check if the input data matches the stored data (==).
 
bool operator!= (const Capsule &other) const noexcept
 Check if the data held by the input capsule matches the data being held (!=).
 
bool operator!= (const _Type &_value) const noexcept
 Check if the input data matches the stored data (!=).
 
 operator bool () const noexcept
 Check if the reference data being held is the default (bool()).
 
bool operator! () const noexcept
 Check if the reference data being held is the default (!()).
 
_Type & operator() () noexcept
 Get the held reference.
 
_Type & operator() () const noexcept
 Get the held reference.
 
void operator() (const _Type &_value) noexcept
 Change the held reference.
 

Public Attributes

_Type & value
 

Friends

Capsuleoperator>> (const _Type &_value, Capsule &_capsule) noexcept
 Change the held reference (with C++ style).
 

Detailed Description

template<typename _Type>
requires requires(_Type v) { v = v; v == v; }
class Helper::Capsule< _Type >

A "capsule" class that stores references.

Template Parameters
_TypeContained value type. Must support copy assignment and equality comparison operators.
Note
Uses C++20 requires clause to enforce type constraints at compile time.

Constructor & Destructor Documentation

◆ Capsule()

template<typename _Type >
Helper::Capsule< _Type >::Capsule ( _Type &  value)
inlineexplicitnoexcept

A constructor that takes data as a reference.

Note
It certainly doesn't have to be used. Take a look at the set() function.
See also
set()

Member Function Documentation

◆ get() [1/2]

template<typename _Type >
_Type & Helper::Capsule< _Type >::get ( ) const
inlinenoexcept

Retrieve the stored data.

Returns
Const reference of capsuled variable.

◆ get() [2/2]

template<typename _Type >
_Type & Helper::Capsule< _Type >::get ( )
inlinenoexcept

Retrieve the stored data.

Returns
Reference of capsuled variable.

◆ operator _Type &() [1/2]

template<typename _Type >
Helper::Capsule< _Type >::operator _Type & ( ) const
inlineexplicitnoexcept

Get the reference held directly with the '&' operator.

Returns
Const reference of capsuled variable.

◆ operator _Type &() [2/2]

template<typename _Type >
Helper::Capsule< _Type >::operator _Type & ( )
inlineexplicitnoexcept

Get the reference held directly with the '&' operator.

Returns
Reference of capsuled variable.

◆ operator _Type *()

template<typename _Type >
Helper::Capsule< _Type >::operator _Type * ( )
inlineexplicitnoexcept

Get the reference held directly with the '*' operator.

Returns
Reference of capsuled variable.

◆ operator bool()

template<typename _Type >
Helper::Capsule< _Type >::operator bool ( ) const
inlineexplicitnoexcept

Check if the reference data being held is the default (bool()).

Return values
trueHeldData != _Type{}
falseHeldData = _Type{}

◆ operator!()

template<typename _Type >
bool Helper::Capsule< _Type >::operator! ( ) const
inlinenoexcept

Check if the reference data being held is the default (!()).

Return values
trueHeldData = _Type{}
falseHeldData != _Type{}

◆ operator!=() [1/2]

template<typename _Type >
bool Helper::Capsule< _Type >::operator!= ( const _Type &  _value) const
inlinenoexcept

Check if the input data matches the stored data (!=).

Parameters
otherOther capsule class.
Return values
trueThe data held is the NOT same.
falseThe data held is the same.

◆ operator!=() [2/2]

template<typename _Type >
bool Helper::Capsule< _Type >::operator!= ( const Capsule< _Type > &  other) const
inlinenoexcept

Check if the data held by the input capsule matches the data being held (!=).

Parameters
otherOther capsule class.
Return values
trueThe data held is the NOT same.
falseThe data held is the same.

◆ operator()()

template<typename _Type >
void Helper::Capsule< _Type >::operator() ( const _Type &  _value)
inlinenoexcept

Change the held reference.

Parameters
_valueInput variable.

◆ operator=() [1/2]

template<typename _Type >
Capsule & Helper::Capsule< _Type >::operator= ( const _Type &  _value)
inlinenoexcept

Change the held reference.

Parameters
_valueInput variable.

◆ operator=() [2/2]

template<typename _Type >
Capsule & Helper::Capsule< _Type >::operator= ( const Capsule< _Type > &  other)
defaultnoexcept

Take the reference held by another capsule.

Parameters
otherOther capsule class.

◆ operator==() [1/2]

template<typename _Type >
bool Helper::Capsule< _Type >::operator== ( const _Type &  _value) const
inlinenoexcept

Check if the input data matches the stored data (==).

Parameters
otherOther capsule class.
Return values
trueThe data held is the same.
falseThe data held is the NOT same.

◆ operator==() [2/2]

template<typename _Type >
bool Helper::Capsule< _Type >::operator== ( const Capsule< _Type > &  other) const
inlinenoexcept

Check if the data held by the input capsule matches the data being held (==).

Parameters
otherOther capsule class.
Return values
trueThe data held is the same.
falseThe data held is the NOT same.

◆ set()

template<typename _Type >
void Helper::Capsule< _Type >::set ( _Type &  _value)
inlinenoexcept

Get a reference to another piece of data and save it. Often, you can make changes later as well.

Parameters
_valueInput variable.

Friends And Related Symbol Documentation

◆ operator>>

template<typename _Type >
Capsule & operator>> ( const _Type &  _value,
Capsule< _Type > &  _capsule 
)
friend

Change the held reference (with C++ style).

Parameters
_valueInput variable.

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