Libmagicxx v9.0.2
A C++ wrapper library over the Magic Number Recognition Library.
Loading...
Searching...
No Matches
recognition::utility Namespace Reference

Classes

class  advance_tracker
 RAII helper that advances a shared progress_tracker by a given step count upon destruction. More...
 
class  mark_tracker_as_completed
 RAII helper that marks a shared progress_tracker as completed upon destruction. More...
 
class  percentage
 Represents a value in the range [0, 100]. More...
 
class  progress_tracker
 Thread-safe tracker for monitoring the progress of a job composed of multiple steps. More...
 

Concepts

concept  range_container
 Define requirements for a range container.
 
concept  string_converter
 Define requirements for a string converter.
 
concept  file_container
 The file_container concept specifies the requirements of a container which can be used as a file container by the magic class.
 

Typedefs

using shared_progress_tracker_t = std::shared_ptr<progress_tracker>
 Alias for a shared pointer to progress_tracker.
 

Functions

shared_progress_tracker_t make_shared_progress_tracker (std::uint64_t total_steps=1u) noexcept
 Create a shared pointer to a progress_tracker.
 
template<range_container ContainerType, typename StringConverterType >
requires string_converter< typename ContainerType::value_type, StringConverterType>
std::string to_string (const ContainerType &container, const std::string &value_separator, StringConverterType string_converter)
 Convert any container to string using the string_converter.
 
std::string to_string (const file_container auto &container, const std::string &separator=", ")
 Convert the file container to a string.
 

Typedef Documentation

◆ shared_progress_tracker_t

Alias for a shared pointer to progress_tracker.

Function Documentation

◆ make_shared_progress_tracker()

shared_progress_tracker_t recognition::utility::make_shared_progress_tracker ( std::uint64_t total_steps = 1u)
inlinenoexcept

Create a shared pointer to a progress_tracker.

Parameters
total_stepsTotal number of steps (must be >= 1). Defaults to 1.
Returns
A shared pointer to the newly created progress_tracker.

◆ to_string() [1/2]

template<range_container ContainerType, typename StringConverterType >
requires string_converter< typename ContainerType::value_type, StringConverterType>
std::string recognition::utility::to_string ( const ContainerType & container,
const std::string & value_separator,
StringConverterType string_converter )
inlinenodiscard

Convert any container to string using the string_converter.

Template Parameters
ContainerTypeThe type of the container.
StringConverterTypeThe type of the string converter callable.
Parameters
[in]container
[in]value_separatorThe separator between the values of the container.
[in]string_converterThe callable that converts values of the container to string.
Returns
The container as a string.

◆ to_string() [2/2]

std::string recognition::utility::to_string ( const file_container auto & container,
const std::string & separator = ", " )
inlinenodiscard

Convert the file container to a string.

Parameters
[in]containerThe container that holds the paths of the files.
[in]separatorThe separator between the paths of the files, default is ", ".
Returns
The container as a string.