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:
Dennis Oberst 2025-03-27 19:17:57 +01:00
parent a335b71abe
commit fd117e8f3a
2 changed files with 4 additions and 11 deletions

View File

@ -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)

View File

@ -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';