* @brief Does the provided wide string consist only from ASCII characters and is nice? * Nice string have ration of printable characters and escape sequences in the * string is at least @p minRatio. Empty string is never nice. * @param str Wide string to check. * @param minRatio Minimum ratio of printable characters. * @return @c True if the string seems nice, @c false otherwise
| 1032 | * @return @c True if the string seems nice, @c false otherwise. |
| 1033 | */ |
| 1034 | bool isNiceAsciiWideString(const std::vector<unsigned long long> &str, double minRatio) { |
| 1035 | assert(0.0 <= minRatio && minRatio <= 1.0); |
| 1036 | |
| 1037 | auto s = str; |
| 1038 | if (!s.empty() && s.back() == 0) |
| 1039 | s.pop_back(); |
| 1040 | |
| 1041 | auto niceCnt = std::count_if(s.begin(), s.end(), isNiceAsciiWideCharacter); |
| 1042 | return !s.empty() && (niceCnt) >= (s.size() * minRatio); |
| 1043 | } |
| 1044 | |
| 1045 | /** |
| 1046 | * @brief Returns an indentation string containing the specified number of |