class mime_view#

class mime_view#

A non-owning reference to a valid MIME type.

Public Functions

inline auto source() const noexcept -> name_view#

Get complete string of the mime.

DESCRIPTION

Get complete string of the mime.

  • "text/plain; charset=utf-8" -> "text/plain; charset=utf-8"

  • "image/svg+xml" -> "image/svg+xml"

inline auto essence() const noexcept -> name_view#

Get essense part of the mime.

DESCRIPTION

Get essense part of the mime.

  • "text/plain; charset=utf-8" -> "text/plain"

  • "image/svg+xml" -> "image/svg+xml"

inline auto type() const noexcept -> name_view#

Get type part of the mime.

DESCRIPTION

Get type part of the mime.

  • "text/plain; charset=utf-8" -> "text"

  • "image/svg+xml" -> "image"

inline auto subtype() const noexcept -> name_view#

Get subtype part of the mime.

DESCRIPTION

Get subtype part of the mime.

  • "text/plain; charset=utf-8" -> "plain"

  • "image/svg+xml" -> "svg"

inline auto suffix() const noexcept -> optional<name_view>#

Get suffix part of the mime.

DESCRIPTION

Get suffix part of the mime.

  • "text/plain; charset=utf-8" -> nullopt

  • "image/svg+xml" -> "xml"

inline auto params() const noexcept -> const params_view&#

Get parameters of the mime.

DESCRIPTION

Get parameters of the mime.

  • "text/plain; charset=utf-8" -> { { "charset", "utf-8" } }

  • "image/svg+xml" -> {}

inline operator std::string_view() const noexcept#

Get complete string of the mime.

DESCRIPTION

Get complete string of the mime.

  • "text/plain; charset=utf-8" -> "text/plain; charset=utf-8"

  • "image/svg+xml" -> "image/svg+xml"

Public Static Functions

static inline auto parse(std::string_view str) -> optional<mime_view>#

Parses a string into mime_view.

static inline auto from_extension(std::string_view ext) noexcept -> optional<mime_view>#

Get the mime from the file extension.

static inline auto from_path(std::string_view path) noexcept -> optional<mime_view>#

Get the mime from the file path.

Friends

inline friend auto operator==(const mime_view &lhs, const mime_view &rhs) -> bool#

Compare mime_view s for equality.

DESCRIPTION

Compare mime_view s for equality. It’s considered equivalent if and only if the source of mime_view s are case-insensitively equivalent.

inline friend auto operator==(const mime_view &lhs, const std::string_view &rhs) -> bool#

Compare mime_view ‘s equivalence against a string.

DESCRIPTION

Compare mime_view ‘s equivalence against a string. It’s considered equivalent if and only if the source of the mime_view are case-insensitively equivalent to the string.

inline friend auto operator<=>(const mime_view &lhs, const mime_view &rhs) -> std::strong_ordering#

Three-way compare mime_view s lexicographically.

DESCRIPTION

Three-way compare mime_view s lexicographically. The comparison is performed case-insensitively.

inline friend auto operator<=>(const mime_view &lhs, const std::string_view &rhs) -> std::strong_ordering#

Three-way compare mime_view lexicographically against a string.

DESCRIPTION

Three-way compare mime_view lexicographically against a string. The comparison is performed case-insensitively.

inline auto fitoria::mime::application_javascript() noexcept -> mime_view#

"application/javascript"

inline auto fitoria::mime::application_json() noexcept -> mime_view#

"application/json"

inline auto fitoria::mime::application_msgpack() noexcept -> mime_view#

"application/msgpack"

inline auto fitoria::mime::application_octet_stream() noexcept -> mime_view#

"application/octet-stream"

inline auto fitoria::mime::application_pdf() noexcept -> mime_view#

"application/pdf"

inline auto fitoria::mime::application_shockwave_flash() noexcept -> mime_view#

"application/x-shockwave-flash"

inline auto fitoria::mime::application_text() noexcept -> mime_view#

"application/text"

inline auto fitoria::mime::application_wasm() noexcept -> mime_view#

"application/wasm"

inline auto fitoria::mime::application_www_form_urlencoded() noexcept -> mime_view#

"application/x-www-form-urlencoded"

inline auto fitoria::mime::application_xml() noexcept -> mime_view#

"application/xml"

inline auto fitoria::mime::image_bmp() noexcept -> mime_view#

"image/bmp"

inline auto fitoria::mime::image_gif() noexcept -> mime_view#

"image/gif"

inline auto fitoria::mime::image_jpeg() noexcept -> mime_view#

"image/jpeg"

inline auto fitoria::mime::image_png() noexcept -> mime_view#

"image/png"

inline auto fitoria::mime::image_svg() noexcept -> mime_view#

"image/svg+xml"

inline auto fitoria::mime::image_tiff() noexcept -> mime_view#

"image/tiff"

inline auto fitoria::mime::multipart_form_data() noexcept -> mime_view#

"multipart/form-data"

inline auto fitoria::mime::text_css() noexcept -> mime_view#

"text/css"

inline auto fitoria::mime::text_csv() noexcept -> mime_view#

"text/csv"

inline auto fitoria::mime::text_html() noexcept -> mime_view#

"text/html"

inline auto fitoria::mime::text_javascript() noexcept -> mime_view#

"text/javascript"

inline auto fitoria::mime::text_plain() noexcept -> mime_view#

"text/plain"

inline auto fitoria::mime::text_xml() noexcept -> mime_view#

"text/xml"

inline auto fitoria::mime::video_flv() noexcept -> mime_view#

"video/x-flv"