epubgrep/src/helpers.hpp

24 lines
642 B
C++

#ifndef EPUBGREP_HELPERS_HPP
#define EPUBGREP_HELPERS_HPP
#include <string>
#include <string_view>
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);
//! Un-escape &amp;, &#x20; and so on.
[[nodiscard]] std::string unescape_html(std::string_view html);
//! Returns environment variable or an empty string_view.
[[nodiscard]] std::string_view get_env(std::string_view name);
} // namespace epubgrep::helpers
#endif // EPUBGREP_HELPERS_HPP