From 58481b46a2c64fda4f506e15ee94dd97f527d552 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 6 Aug 2019 03:12:16 +0200 Subject: Save and show progress in manga and return to last page" --- src/plugins/Plugin.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/plugins/Plugin.cpp') diff --git a/src/plugins/Plugin.cpp b/src/plugins/Plugin.cpp index d87ac34..2367cb3 100644 --- a/src/plugins/Plugin.cpp +++ b/src/plugins/Plugin.cpp @@ -33,6 +33,29 @@ namespace QuickMedia { return DownloadResult::OK; } + static bool is_whitespace(char c) { + return c == ' ' || c == '\n' || c == '\t' || c == '\v'; + } + + std::string strip(const std::string &str) { + if(str.empty()) + return str; + + int start = 0; + for(; start < (int)str.size(); ++start) { + if(!is_whitespace(str[start])) + break; + } + + int end = str.size() - 1; + for(; end >= start; --end) { + if(!is_whitespace(str[end])) + break; + } + + return str.substr(start, end - start + 1); + } + std::string Plugin::url_param_encode(const std::string ¶m) const { std::ostringstream result; result.fill('0'); -- cgit v1.2.3