StormByte-Multimedia 3.3.2
C++26 multimedia processing module of the StormByte suite
Loading...
Searching...
No Matches
StormByte::Multimedia::CodecRef Class Reference

Trivial borrowed codec handle; never owns or deletes the codec. More...

#include <StormByte/multimedia/typedefs.hxx>

Public Member Functions

constexpr CodecRef () noexcept=default
 Constructs an empty handle.
constexpr CodecRef (const Codec &codec) noexcept
 Borrows a codec.
constexpr CodecRef (const CodecRef &other) noexcept=default
 Copies the borrowed pointer.
constexpr CodecRef (CodecRef &&other) noexcept=default
 Copies the borrowed pointer without clearing the source.
 ~CodecRef () noexcept=default
 Destroys the handle, not its codec.
constexpr CodecRef & operator= (const CodecRef &other) noexcept=default
 Copies the borrowed pointer.
constexpr CodecRef & operator= (CodecRef &&other) noexcept=default
 Copies the borrowed pointer without clearing the source.
constexpr operator bool () const noexcept
 Tests whether a codec is borrowed.
constexpr const Codec & get () const noexcept
 Gets the borrowed codec, preserving reference_wrapper syntax.
constexpr operator const Codec & () const noexcept
 Converts to the borrowed codec reference.

Detailed Description

Trivial borrowed codec handle; never owns or deletes the codec.

Note
The codec must outlive every handle. Registry handles are valid until registry teardown, with the provider loaded and a compatible compiler, standard-library ABI and provider layout. Empty handles cannot be dereferenced.

Constructor & Destructor Documentation

◆ CodecRef() [1/4]

StormByte::Multimedia::CodecRef::CodecRef ( )
constexprdefaultnoexcept

Constructs an empty handle.

◆ CodecRef() [2/4]

StormByte::Multimedia::CodecRef::CodecRef ( const Codec & codec)
inlineconstexprnoexcept

Borrows a codec.

Parameters
codecCodec that must outlive the handle.

◆ CodecRef() [3/4]

StormByte::Multimedia::CodecRef::CodecRef ( const CodecRef & other)
constexprdefaultnoexcept

Copies the borrowed pointer.

Parameters
otherSource handle.

◆ CodecRef() [4/4]

StormByte::Multimedia::CodecRef::CodecRef ( CodecRef && other)
constexprdefaultnoexcept

Copies the borrowed pointer without clearing the source.

Parameters
otherSource handle.

◆ ~CodecRef()

StormByte::Multimedia::CodecRef::~CodecRef ( )
defaultnoexcept

Destroys the handle, not its codec.

Member Function Documentation

◆ get()

const Codec & StormByte::Multimedia::CodecRef::get ( ) const
inlineconstexprnoexcept

Gets the borrowed codec, preserving reference_wrapper syntax.

Precondition
The handle is nonempty and its codec is alive.
Returns
Borrowed codec.

◆ operator bool()

StormByte::Multimedia::CodecRef::operator bool ( ) const
inlineexplicitconstexprnoexcept

Tests whether a codec is borrowed.

Returns
True for a nonempty handle.

◆ operator const Codec &()

StormByte::Multimedia::CodecRef::operator const Codec & ( ) const
inlineconstexprnoexcept

Converts to the borrowed codec reference.

Precondition
The handle is nonempty and its codec is alive.
Returns
Borrowed codec.

◆ operator=() [1/2]

CodecRef & StormByte::Multimedia::CodecRef::operator= ( CodecRef && other)
constexprdefaultnoexcept

Copies the borrowed pointer without clearing the source.

Parameters
otherSource handle.
Returns
This handle.

◆ operator=() [2/2]

CodecRef & StormByte::Multimedia::CodecRef::operator= ( const CodecRef & other)
constexprdefaultnoexcept

Copies the borrowed pointer.

Parameters
otherSource handle.
Returns
This handle.

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