2021-05-30 21:52:52 +02:00
|
|
|
#ifndef EPUBGREP_HELPERS_HPP
|
|
|
|
#define EPUBGREP_HELPERS_HPP
|
|
|
|
|
|
|
|
#include <string>
|
2021-05-30 22:35:32 +02:00
|
|
|
#include <string_view>
|
2021-05-30 21:52:52 +02:00
|
|
|
namespace epubgrep::helpers
|
|
|
|
{
|
|
|
|
|
|
|
|
//! Return true if check is whitespace.
|
|
|
|
[[nodiscard]] bool is_whitespace(char check);
|
|
|
|
|
|
|
|
//! Decode percent-encoded text. Used for restricted characters in URLs.
|
|
|
|
[[nodiscard]] std::string urldecode(std::string_view url);
|
|
|
|
|
2021-05-30 22:35:32 +02:00
|
|
|
//! Un-escape &,   and so on.
|
|
|
|
[[nodiscard]] std::string unescape_html(std::string_view html);
|
|
|
|
|
2021-05-31 18:50:41 +02:00
|
|
|
//! Returns environment variable or an empty string_view.
|
|
|
|
[[nodiscard]] std::string_view get_env(std::string_view name);
|
|
|
|
|
2021-05-30 21:52:52 +02:00
|
|
|
} // namespace epubgrep::helpers
|
|
|
|
|
|
|
|
#endif // EPUBGREP_HELPERS_HPP
|