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

Flag retrieval methods. More...

Collaboration diagram for Flag Management:

Functions

FlagsContainerT Recognition::Magic::GetFlags () const
 Get the current flags.
std::optional< FlagsContainerTRecognition::Magic::GetFlags (const std::nothrow_t &tag) const noexcept
 Get the current flags (noexcept version).

Detailed Description

Flag retrieval methods.

Methods for querying current configuration flags.

Function Documentation

◆ GetFlags() [1/2]

Magic::FlagsContainerT Recognition::Magic::GetFlags ( ) const
nodiscard

Get the current flags.

Retrieves the flags currently configured for this Magic instance.

Returns
Container of active Flags values.
Exceptions
MagicIsClosedIf the Magic instance is closed.
auto flags = magic.GetFlags();
std::println("Active flags: {}", ToString(flags));
friend std::string ToString(Flags)
Friend declaration for ToString(Flags) free function.
Definition magic.cpp:2355
See also
SetFlags()
ToString(const FlagsContainerT&)
Since
10.0.0
Examples
magic_examples.cpp.

◆ GetFlags() [2/2]

std::optional< Magic::FlagsContainerT > Recognition::Magic::GetFlags ( const std::nothrow_t & tag) const
nodiscardnoexcept

Get the current flags (noexcept version).

Parameters
[in]tagPass std::nothrow to select this overload.
Returns
Container of active Flags values, or std::nullopt if closed.
Since
10.0.0