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

Parameter retrieval methods. More...

Collaboration diagram for Parameter Management:

Functions

std::size_t Recognition::Magic::MagicPrivate::GetParameter (Parameters parameter) const
 Get a single parameter value (throwing version).
std::optional< std::size_t > Recognition::Magic::MagicPrivate::GetParameter (Parameters parameter, const std::nothrow_t &tag) const noexcept
 Get a single parameter value (noexcept version).
ParameterValueMapT Recognition::Magic::MagicPrivate::GetParameters () const
 Get all parameter values (throwing version).
std::optional< ParameterValueMapTRecognition::Magic::MagicPrivate::GetParameters (const std::nothrow_t &tag) const noexcept
 Get all parameter values (noexcept version).

Detailed Description

Parameter retrieval methods.

Methods for querying libmagic parameter values.

Function Documentation

◆ GetParameter() [1/2]

std::size_t Recognition::Magic::MagicPrivate::GetParameter ( Parameters parameter) const
inlinenodiscard

Get a single parameter value (throwing version).

Retrieves the current value of the specified libmagic parameter by calling magic_getparam().

Parameters
[in]parameterThe parameter to query.
Returns
Current value of the parameter.
Exceptions
MagicIsClosedIf instance is not open.
libmagic Call
Detail::magic_getparam(m_cookie.get(), param_constant, &value);
CookieT m_cookie
Definition magic.cpp:1920
See also
Magic::GetParameter()
SetParameter()
LIBMAGIC_PARAMETERS

◆ GetParameter() [2/2]

std::optional< std::size_t > Recognition::Magic::MagicPrivate::GetParameter ( Parameters parameter,
const std::nothrow_t & tag ) const
inlinenodiscardnoexcept

Get a single parameter value (noexcept version).

Non-throwing variant that returns std::nullopt if the instance is not open.

Parameters
[in]parameterThe parameter to query.
[in]tagPass std::nothrow to select this overload.
Returns
Current value of the parameter, or std::nullopt if closed.
See also
Magic::GetParameter(Parameters, const std::nothrow_t&)
SetParameter()

◆ GetParameters() [1/2]

ParameterValueMapT Recognition::Magic::MagicPrivate::GetParameters ( ) const
inlinenodiscard

Get all parameter values (throwing version).

Retrieves a map of all parameters and their current values by iterating over all Parameters enum values and calling GetParameter() for each.

Returns
Map from Parameters enum values to their current values.
Exceptions
MagicIsClosedIf instance is not open.
Implementation
for (i = 0; i < LIBMAGIC_PARAMETER_COUNT; ++i) {
parameter_value_map[Parameters(i)] = GetParameter(Parameters(i));
}
static constexpr auto LIBMAGIC_PARAMETER_COUNT
Definition magic.cpp:1960
std::size_t GetParameter(Parameters parameter) const
Get a single parameter value (throwing version).
Definition magic.cpp:720
Parameters
Parameters for tuning Magic behavior limits.
Definition magic.hpp:381
See also
Magic::GetParameters()
SetParameters()
LIBMAGIC_PARAMETER_COUNT

◆ GetParameters() [2/2]

std::optional< ParameterValueMapT > Recognition::Magic::MagicPrivate::GetParameters ( const std::nothrow_t & tag) const
inlinenodiscardnoexcept

Get all parameter values (noexcept version).

Non-throwing variant that returns std::nullopt if the instance is not open.

Parameters
[in]tagPass std::nothrow to select this overload.
Returns
Map from Parameters to values, or std::nullopt if closed.
See also
Magic::GetParameters(const std::nothrow_t&)
SetParameters()