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

Exception thrown when file identification is attempted without a loaded database. More...

#include <magic_exception.hpp>

Inheritance diagram for Recognition::MagicDatabaseNotLoaded:
Collaboration diagram for Recognition::MagicDatabaseNotLoaded:

Public Member Functions

 MagicDatabaseNotLoaded ()
 Construct MagicDatabaseNotLoaded exception.
Public Member Functions inherited from Recognition::MagicException
 MagicException (const std::string &function, const std::string &error_message)
 Construct MagicException with function name and error message.

Detailed Description

Exception thrown when file identification is attempted without a loaded database.

This exception is thrown when IdentifyFile() or IdentifyFiles() is called but no magic database has been loaded via LoadDatabaseFile().

Magic magic;
// Forgot to call LoadDatabaseFile()!
magic.IdentifyFile("file.txt"); // Throws MagicDatabaseNotLoaded
A modern C++23 wrapper for libmagic — the library that powers the Unix file command.
Definition magic.hpp:216
FileTypeT IdentifyFile(const std::filesystem::path &path) const
Identify the type of a single file.
Definition magic.cpp:2530
@ Mime
Definition magic.hpp:328
void Open(FlagsMaskT flags_mask)
Open Magic with specified flags.
Definition magic.cpp:2651
See also
Magic::LoadDatabaseFile()
Magic::IsDatabaseLoaded()
Since
10.0.0

Constructor & Destructor Documentation

◆ MagicDatabaseNotLoaded()

Recognition::MagicDatabaseNotLoaded::MagicDatabaseNotLoaded ( )
inline

Construct MagicDatabaseNotLoaded exception.

Since
10.0.0

The documentation for this class was generated from the following file: