mpd/src/util/MimeType.hxx

30 lines
702 B
C++
Raw Normal View History

// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
2020-11-18 15:27:40 +01:00
#ifndef MIME_TYPE_HXX
#define MIME_TYPE_HXX
#include <string>
#include <string_view>
#include <map>
/**
* 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.
*/
[[gnu::pure]]
std::string_view
GetMimeTypeBase(std::string_view s) noexcept;
/**
* Parse the parameters from a MIME type string. Parameters are
* separated by semicolon. Example:
*
* "foo/bar; param1=value1; param2=value2"
*/
std::map<std::string, std::string>
ParseMimeTypeParameters(std::string_view mime_type) noexcept;
#endif