Libmagicxx v10.0.3
A modern C++23 wrapper for libmagic — the library that powers the Unix file command.
Loading...
Searching...
No Matches
Special Member Functions

Move, copy, and destruction operations. More...

Collaboration diagram for Special Member Functions:

Functions

 Recognition::Magic::Magic (Magic &&other) noexcept
 Move constructor.
 Recognition::Magic::Magic (const Magic &)=delete
 Deleted copy constructor.
MagicRecognition::Magic::operator= (Magic &&other) noexcept
 Move assignment operator.
MagicRecognition::Magic::operator= (const Magic &)=delete
 Deleted copy assignment operator.
 Recognition::Magic::~Magic ()
 Destructor.

Detailed Description

Move, copy, and destruction operations.

Special member functions controlling Magic lifetime and resource ownership.

Function Documentation

◆ Magic() [1/2]

Recognition::Magic::Magic ( const Magic & )
delete

Deleted copy constructor.

Magic instances cannot be copied because they own unique libmagic resources. Use move semantics instead.

◆ Magic() [2/2]

Recognition::Magic::Magic ( Magic && other)
noexcept

Move constructor.

Transfers ownership of the Magic instance from other to this object. After the move, other is left in a closed state and must be reopened before use.

Parameters
[in,out]otherThe Magic instance to move from. Left closed after move.
Magic magic2{std::move(magic1)}; // magic1 is now closed
// magic2 is valid, magic1 is not
A modern C++23 wrapper for libmagic — the library that powers the Unix file command.
Definition magic.hpp:216
Magic() noexcept
Default constructor. Creates an unopened Magic instance.
Definition magic.cpp:2421
@ Mime
Definition magic.hpp:328
Since
10.0.0

◆ operator=() [1/2]

Magic & Recognition::Magic::operator= ( const Magic & )
delete

Deleted copy assignment operator.

Magic instances cannot be copied because they own unique libmagic resources. Use move semantics instead.

◆ operator=() [2/2]

Magic & Recognition::Magic::operator= ( Magic && other)
noexcept

Move assignment operator.

Transfers ownership of the Magic instance from other to this object. Any existing resources in this object are released first. After the move, other is left in a closed state.

Parameters
[in,out]otherThe Magic instance to move from. Left closed after move.
Returns
Reference to this object.
Since
10.0.0

◆ ~Magic()

Recognition::Magic::~Magic ( )
default

Destructor.

Automatically releases all libmagic resources. Equivalent to calling Close().

Since
10.0.0