mirror of https://github.com/qt/qtgrpc.git
tools [utils]: misc. improvements
- sort / restructure header usage - use utils::toAsciiLower, same as asciiToUpper() Change-Id: Ic5e7a369cea64cdb561471fb8c1246036263698d Pick-to: 6.9 6.8 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
parent
a335b71abe
commit
fd117e8f3a
|
|
@ -4,11 +4,8 @@
|
|||
|
||||
#include "utils.h"
|
||||
|
||||
#include <string_view>
|
||||
|
||||
#include <cctype>
|
||||
#include <cassert>
|
||||
#include <regex>
|
||||
#include <cctype>
|
||||
#include <filesystem>
|
||||
|
||||
namespace {
|
||||
|
|
@ -65,12 +62,7 @@ std::string replace(std::string_view where, std::string_view from, std::string_v
|
|||
|
||||
void asciiToLower(std::string &str)
|
||||
{
|
||||
const auto toLower = [](char c) {
|
||||
if (!isAsciiAlpha(c))
|
||||
return c;
|
||||
return char(c | char(0x20));
|
||||
};
|
||||
std::transform(std::begin(str), std::end(str), std::begin(str), toLower);
|
||||
std::transform(std::begin(str), std::end(str), std::begin(str), utils::toAsciiLower);
|
||||
}
|
||||
|
||||
void asciiToUpper(std::string &str)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#define QTPROTOBUFGEN_UTILS_H
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
|
|
@ -68,7 +69,7 @@ std::string join(const T &container, std::string_view separator, std::string_vie
|
|||
|
||||
size_t count(std::string_view s, char c);
|
||||
|
||||
// ASCI check functions
|
||||
// ASCII check functions
|
||||
constexpr bool isAsciiUpper(char32_t c) noexcept
|
||||
{
|
||||
return c >= 'A' && c <= 'Z';
|
||||
|
|
|
|||
Loading…
Reference in New Issue