lintel 0.2.0
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
lintel::ContentType Class Reference

#include <ContentType.h>

Classes

struct  Mapping
 

Public Types

enum  Value {
  UNDEFINED , TextCss , TextCsv , TextPlain ,
  TextVtt , TextHtml , ImageApng , ImageAvif ,
  ImageBmp , ImageGif , ImagePng , ImageSvgXml ,
  ImageWebp , ImageXIcon , ImageTiff , ImageJpeg ,
  VideoMp4 , VideoMpeg , VideoWebm , AudioMp3 ,
  AudioMpeg , AudioWebm , AudioWave , FontOtf ,
  FontTtf , FontWoff , FontWoff2 , ApplicationX7vCompressed ,
  ApplicationAtomXml , ApplicationPdf , ApplicationJavascript , ApplicationJson ,
  ApplicationRssXml , ApplicationXTar , ApplicationXhtmlXml , ApplicationXsltXml ,
  ApplicationXml , ApplicationGzip , ApplicationZip , ApplicationWasm
}
 

Public Member Functions

constexpr ContentType (Value value)
 
 ContentType (const std::string &contentType)
 
constexpr operator Value () const
 
 operator bool ()=delete
 
constexpr Value getValue () const
 
std::string getName () const
 

Static Public Attributes

static constexpr std::array< Mapping, 39 > kNameToValue
 
static constexpr std::array< Mapping, 39 > kValueToName
 

Detailed Description

Represents an HTTP Content-Type with string-to-enum mapping

Member Enumeration Documentation

◆ Value

Enumerator
UNDEFINED 
TextCss 
TextCsv 
TextPlain 
TextVtt 
TextHtml 
ImageApng 
ImageAvif 
ImageBmp 
ImageGif 
ImagePng 
ImageSvgXml 
ImageWebp 
ImageXIcon 
ImageTiff 
ImageJpeg 
VideoMp4 
VideoMpeg 
VideoWebm 
AudioMp3 
AudioMpeg 
AudioWebm 
AudioWave 
FontOtf 
FontTtf 
FontWoff 
FontWoff2 
ApplicationX7vCompressed 
ApplicationAtomXml 
ApplicationPdf 
ApplicationJavascript 
ApplicationJson 
ApplicationRssXml 
ApplicationXTar 
ApplicationXhtmlXml 
ApplicationXsltXml 
ApplicationXml 
ApplicationGzip 
ApplicationZip 
ApplicationWasm 

Constructor & Destructor Documentation

◆ ContentType() [1/2]

constexpr lintel::ContentType::ContentType ( Value  value)
inlineconstexpr
Parameters
valuethe content type enum value

◆ ContentType() [2/2]

lintel::ContentType::ContentType ( const std::string &  contentType)
explicit
Parameters
contentTypestring representation (e.g. "application/json")

Member Function Documentation

◆ getName()

std::string lintel::ContentType::getName ( ) const
Returns
the MIME type string

◆ getValue()

constexpr Value lintel::ContentType::getValue ( ) const
inlineconstexpr
Returns
the underlying enum value

◆ operator bool()

lintel::ContentType::operator bool ( )
explicitdelete

◆ operator Value()

constexpr lintel::ContentType::operator Value ( ) const
inlineconstexpr

Member Data Documentation

◆ kNameToValue

constexpr std::array<Mapping, 39> lintel::ContentType::kNameToValue
staticconstexpr

Sorted by name for binary search in build()

◆ kValueToName

constexpr std::array<Mapping, 39> lintel::ContentType::kValueToName
staticconstexpr

Sorted by value for lookup in getName()


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