Holds a map of mime types, keyed to the corresponding file extension. More...
#include <MimeTypes.hpp>
Public Member Functions | |
MimeTypes (std::unordered_map< std::string, std::string > &&data_) noexcept | |
Construct a custom mime types instance by moving the supplied data. More... | |
const std::unordered_map< std::string, std::string > & | getData () const |
Get the internal data in order to construct a custom mime types instance. More... | |
std::string_view | lookup (const std::string &path) const |
Lookup a mime type from the supplied path. More... | |
Static Public Attributes | |
static std::shared_ptr< MimeTypes > | defaultMimeTypes |
The default set of mime types available. More... | |
Holds a map of mime types, keyed to the corresponding file extension.
Instances of this class are internally const.
If a custom set of mime types is required, the data of the default mime types instance can be copied in order to create a custom mime types instance.
Once constructed, the mime types instance should be shared via a shared_ptr container.
|
inlinenoexcept |
Construct a custom mime types instance by moving the supplied data.
|
inline |
Get the internal data in order to construct a custom mime types instance.
std::string_view lookup | ( | const std::string & | path | ) | const |
Lookup a mime type from the supplied path.
If no registered file extension is found, an empty string view is returned.
|
static |
The default set of mime types available.