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

Database validation methods. More...

Collaboration diagram for Validity Checking:

Functions

bool Recognition::Magic::MagicPrivate::Check (const std::filesystem::path &database_file) const noexcept
 Check if a magic database file is valid.

Detailed Description

Database validation methods.

Methods for checking magic database file validity before use.

Function Documentation

◆ Check()

bool Recognition::Magic::MagicPrivate::Check ( const std::filesystem::path & database_file) const
inlinenodiscardnoexcept

Check if a magic database file is valid.

Validates the entries in a magic database file by calling magic_check() from libmagic. This verifies the database can be parsed correctly.

Parameters
[in]database_filePath to the database file to validate.
Returns
true if the database has valid entries, false if:
  • Instance is not open
  • database_file is empty
  • Database validation fails
Preconditions
  • Instance must be in Opened or Valid state
  • database_file must be non-empty
libmagic Call
Detail::magic_check(m_cookie.get(), database_file.string().c_str());
CookieT m_cookie
Definition magic.cpp:1920
See also
Magic::Check()
Compile()