2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
// author: Max Kellermann <max.kellermann@gmail.com>
|
2016-06-10 22:24:13 +02:00
|
|
|
|
2020-11-18 15:27:40 +01:00
|
|
|
#ifndef MIME_TYPE_HXX
|
|
|
|
#define MIME_TYPE_HXX
|
2016-06-10 22:24:13 +02:00
|
|
|
|
|
|
|
#include <string>
|
2020-11-04 20:27:28 +01:00
|
|
|
#include <string_view>
|
2016-06-10 22:31:26 +02:00
|
|
|
#include <map>
|
2016-06-10 22:24:13 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Extract the part of the MIME type before the parameters, i.e. the
|
|
|
|
* part before the semicolon. If there is no semicolon, it returns
|
|
|
|
* the string as-is.
|
|
|
|
*/
|
2021-02-08 14:59:40 +01:00
|
|
|
[[gnu::pure]]
|
2020-11-04 20:27:28 +01:00
|
|
|
std::string_view
|
|
|
|
GetMimeTypeBase(std::string_view s) noexcept;
|
2016-06-10 22:24:13 +02:00
|
|
|
|
2016-06-10 22:31:26 +02:00
|
|
|
/**
|
|
|
|
* Parse the parameters from a MIME type string. Parameters are
|
|
|
|
* separated by semicolon. Example:
|
|
|
|
*
|
|
|
|
* "foo/bar; param1=value1; param2=value2"
|
|
|
|
*/
|
2023-03-12 09:11:45 +01:00
|
|
|
std::map<std::string, std::string, std::less<>>
|
2020-11-04 21:24:53 +01:00
|
|
|
ParseMimeTypeParameters(std::string_view mime_type) noexcept;
|
2016-06-10 22:31:26 +02:00
|
|
|
|
2016-06-10 22:24:13 +02:00
|
|
|
#endif
|