arduino-audio-tools
Loading...
Searching...
No Matches
MimeResolver Class Reference

Lookup MIME types by file extension. More...

#include <MimeResolver.h>

Public Member Functions

void addMimeEntry (const char *ext, const char *mime)
 Add custom mime entry (overrides default entries).
const char * fromExtension (const char *extension)
const char * fromFilename (const char *filename)

Protected Attributes

Vector< MimeEntry > custom_mime_table

Detailed Description

Lookup MIME types by file extension.

Small, header-only helper that maps file name extensions (for example "mp3" or ".wav") to standardized MIME type strings (for example "audio/mpeg" or "audio/vnd.wave"). The resolver performs a case-insensitive match and accepts extensions with or without a leading '.'.

Behavior:

  • The lookup table is a fixed, const array (mime_table) declared above the class. Modify that table to add or change mappings.
  • Lookup returns a pointer to a constant string from the table. The returned pointer is valid for the lifetime of the program. If no mapping is found, the methods return nullptr.
  • Thread-safety: read-only operations are safe for concurrent use.
Author
Phil Schatzmann

Member Function Documentation

◆ addMimeEntry()

void addMimeEntry ( const char * ext,
const char * mime )
inline

Add custom mime entry (overrides default entries).

◆ fromExtension()

const char * fromExtension ( const char * extension)
inline

Return MIME for an extension (case-insensitive). Returns nullptr if unknown.

◆ fromFilename()

const char * fromFilename ( const char * filename)
inline

Return MIME for a filename (looks up extension). Returns nullptr if unknown.

Member Data Documentation

◆ custom_mime_table

Vector<MimeEntry> custom_mime_table
protected

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