Public Member Functions | Static Public Attributes | List of all members
MimeTypes Class Reference

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< MimeTypesdefaultMimeTypes
 The default set of mime types available. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ MimeTypes()

MimeTypes ( std::unordered_map< std::string, std::string > &&  data_)
inlinenoexcept

Construct a custom mime types instance by moving the supplied data.

Member Function Documentation

◆ getData()

const std::unordered_map<std::string, std::string>& getData ( ) const
inline

Get the internal data in order to construct a custom mime types instance.

◆ lookup()

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.

Member Data Documentation

◆ defaultMimeTypes

std::shared_ptr<MimeTypes> defaultMimeTypes
static

The default set of mime types available.


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