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

Main header file for the libmagicxx library. More...

#include <bitset>
#include <expected>
#include <map>
#include <memory>
#include <optional>
#include <string_view>
#include <vector>
#include "magic_exception.hpp"
#include "progress_tracker.hpp"
#include "utility.hpp"
Include dependency graph for magic.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Recognition::Magic
 A modern C++23 wrapper for libmagic — the library that powers the Unix file command. More...

Namespaces

namespace  Recognition
 Root namespace for the libmagicxx library.

Functions

std::string Recognition::ToString (const Magic::FileTypeEntryT &file_type_entry, const std::string &type_separator=" -> ")
 Convert a file type entry to a string.
std::string Recognition::ToString (const Magic::FileTypeMapT &file_type_map, const std::string &type_separator=" -> ", const std::string &file_separator="\n")
 Convert a file type map to a string.
std::string Recognition::ToString (const Magic::ExpectedFileTypeT &expected_file_type)
 Convert an expected file type result to a string.
std::string Recognition::ToString (const Magic::ExpectedFileTypeEntryT &expected_file_type_entry, const std::string &type_separator=" -> ")
 Convert an expected file type entry to a string.
std::string Recognition::ToString (const Magic::ExpectedFileTypeMapT &expected_file_type_map, const std::string &type_separator=" -> ", const std::string &file_separator="\n")
 Convert an expected file type map to a string.
std::string Recognition::ToString (Magic::Flags flag)
 Convert a Magic flag to its string name.
std::string Recognition::ToString (const Magic::FlagsContainerT &flags, const std::string &separator=", ")
 Convert a container of flags to a string.
std::string Recognition::ToString (Magic::Parameters parameter)
 Convert a Magic parameter to its string name.
std::string Recognition::ToString (const Magic::ParameterValueT &parameter_value, const std::string &value_separator=": ")
 Convert a parameter-value pair to a string.
std::string Recognition::ToString (const Magic::ParameterValueMapT &parameters, const std::string &value_separator=": ", const std::string &parameter_separator=", ")
 Convert a parameter-value map to a string.

Detailed Description

Main header file for the libmagicxx library.

This file contains the Magic class, a modern C++23 wrapper for libmagic — the library that powers the Unix file command. It provides type-safe, RAII-based file type identification based on content rather than file extensions.

Author
Oğuz Toraman
See also
https://github.com/oguztoraman/libmagicxx
https://github.com/file/file (underlying libmagic)