Mercurial > minori
comparison include/core/strings.h @ 320:1b5c04268d6a
services/kitsu: ACTUALLY finish GetAnimeList
there are some things the API just... doesn't provide. therefore
we have to request the genres separately any time a new anime info
box is opened...
| author | Paper <paper@paper.us.eu.org> |
|---|---|
| date | Wed, 12 Jun 2024 19:49:19 -0400 |
| parents | f31305b9f60a |
| children | c32467cd06bb |
comparison
equal
deleted
inserted
replaced
| 319:d928ec7b6a0d | 320:1b5c04268d6a |
|---|---|
| 15 | 15 |
| 16 /* Implode function: takes a vector of strings and turns it | 16 /* Implode function: takes a vector of strings and turns it |
| 17 * into a string, separated by delimiters. | 17 * into a string, separated by delimiters. |
| 18 */ | 18 */ |
| 19 std::string Implode(const std::vector<std::string>& vector, const std::string& delimiter); | 19 std::string Implode(const std::vector<std::string>& vector, const std::string& delimiter); |
| 20 std::string Implode(const std::set<std::string>& set, const std::string& delimiter); | |
| 21 std::vector<std::string> Split(const std::string& text, const std::string& delimiter); | 20 std::vector<std::string> Split(const std::string& text, const std::string& delimiter); |
| 22 | 21 |
| 23 /* Substring removal functions */ | 22 /* Substring removal functions */ |
| 24 void ReplaceAll(std::string& string, std::string_view find, std::string_view replace); | 23 void ReplaceAll(std::string& string, std::string_view find, std::string_view replace); |
| 25 void SanitizeLineEndings(std::string& string); | 24 void SanitizeLineEndings(std::string& string); |
| 46 std::string ToUtf8String(const QByteArray& ba); | 45 std::string ToUtf8String(const QByteArray& ba); |
| 47 QString ToQString(const std::string& string); | 46 QString ToQString(const std::string& string); |
| 48 QString ToQString(const std::wstring& wstring); | 47 QString ToQString(const std::wstring& wstring); |
| 49 | 48 |
| 50 /* not really an "int"... but who cares? */ | 49 /* not really an "int"... but who cares? */ |
| 51 template<typename T = int, std::enable_if_t<std::is_integral<T>::value, bool> = true> | 50 template<typename T = int, std::enable_if_t<std::is_arithmetic<T>::value, bool> = true> |
| 52 T ToInt(const std::string& str, T def = 0) { | 51 T ToInt(const std::string& str, T def = 0) { |
| 53 std::istringstream s(str); | 52 std::istringstream s(str); |
| 54 s >> std::noboolalpha >> def; | 53 s >> std::noboolalpha >> def; |
| 55 return def; | 54 return def; |
| 56 } | 55 } |
