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

Parameter modification methods. More...

Collaboration diagram for Parameter Modification:

Functions

void Recognition::Magic::MagicPrivate::SetParameter (Parameters parameter, std::size_t value)
 Set a single parameter value (throwing version).
bool Recognition::Magic::MagicPrivate::SetParameter (Parameters parameter, std::size_t value, const std::nothrow_t &tag) noexcept
 Set a single parameter value (noexcept version).
void Recognition::Magic::MagicPrivate::SetParameters (const ParameterValueMapT &parameters)
 Set multiple parameter values (throwing version).
bool Recognition::Magic::MagicPrivate::SetParameters (const ParameterValueMapT &parameters, const std::nothrow_t &tag) noexcept
 Set multiple parameter values (noexcept version).

Detailed Description

Parameter modification methods.

Methods for changing libmagic parameter values.

Function Documentation

◆ SetParameter() [1/2]

void Recognition::Magic::MagicPrivate::SetParameter ( Parameters parameter,
std::size_t value )
inline

Set a single parameter value (throwing version).

Changes the value of a libmagic parameter by calling magic_setparam(). Parameters control various internal limits and behaviors.

Parameters
[in]parameterThe parameter to set.
[in]valueThe new value for the parameter.
Exceptions
MagicIsClosedIf instance is not open.
MagicSetParameterErrorIf magic_setparam() fails.
libmagic Call
Detail::magic_setparam(m_cookie.get(), param_constant, &value);
CookieT m_cookie
Definition magic.cpp:1920
See also
Magic::SetParameter()
GetParameter()
LIBMAGIC_PARAMETERS

◆ SetParameter() [2/2]

bool Recognition::Magic::MagicPrivate::SetParameter ( Parameters parameter,
std::size_t value,
const std::nothrow_t & tag )
inlinenodiscardnoexcept

Set a single parameter value (noexcept version).

Non-throwing variant that returns success/failure status.

Parameters
[in]parameterThe parameter to set.
[in]valueThe new value for the parameter.
[in]tagPass std::nothrow to select this overload.
Returns
true on success, false if closed or setparam fails.
See also
Magic::SetParameter(Parameters, std::size_t, const std::nothrow_t&)
GetParameter()

◆ SetParameters() [1/2]

void Recognition::Magic::MagicPrivate::SetParameters ( const ParameterValueMapT & parameters)
inline

Set multiple parameter values (throwing version).

Sets all parameters specified in the map by iterating and calling SetParameter() for each entry.

Parameters
[in]parametersMap from Parameters enum to new values.
Exceptions
MagicIsClosedIf instance is not open.
MagicSetParameterErrorIf any magic_setparam() fails.
Note
If an exception is thrown mid-iteration, some parameters may already have been set.
See also
Magic::SetParameters(const ParameterValueMapT&)
GetParameters()

◆ SetParameters() [2/2]

bool Recognition::Magic::MagicPrivate::SetParameters ( const ParameterValueMapT & parameters,
const std::nothrow_t & tag )
inlinenodiscardnoexcept

Set multiple parameter values (noexcept version).

Non-throwing variant that returns false on first failure. Uses std::ranges::find_if_not to stop on first error.

Parameters
[in]parametersMap from Parameters enum to new values.
[in]tagPass std::nothrow to select this overload.
Returns
true if all parameters set successfully, false if any failed (partial updates may have occurred).
See also
Magic::SetParameters(const ParameterValueMapT&, const std::nothrow_t&)
GetParameters()