diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-08-06 03:12:16 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2019-08-06 03:12:40 +0200 |
commit | 58481b46a2c64fda4f506e15ee94dd97f527d552 (patch) | |
tree | 337809ed5aadece3cc6a3746aa78a24b390472ca /src/plugins/Plugin.cpp | |
parent | 7ce2139650012d4c571c7e7600924853ab7032bb (diff) |
Save and show progress in manga and return to last page"
Diffstat (limited to 'src/plugins/Plugin.cpp')
-rw-r--r-- | src/plugins/Plugin.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
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'); |