1
0
Fork 0

Codefix: Codestyle consistency fixes. (#14008)

pull/14009/head
Peter Nelson 2025-04-15 21:57:13 +01:00 committed by GitHub
parent 03ed59a004
commit fa0814e257
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 12 deletions

View File

@ -53,7 +53,7 @@ public:
/** /**
* Append integer 'value' in given number 'base'. * Append integer 'value' in given number 'base'.
*/ */
template<class T> template <class T>
void PutIntegerBase(T value, int base) void PutIntegerBase(T value, int base)
{ {
std::array<char, 32> buf; std::array<char, 32> buf;
@ -67,8 +67,7 @@ public:
/** /**
* Compose data into a growing std::string. * Compose data into a growing std::string.
*/ */
class StringBuilder final : public BaseStringBuilder class StringBuilder final : public BaseStringBuilder {
{
std::string *dest; std::string *dest;
public: public:
/** /**

View File

@ -800,7 +800,7 @@ public:
void SkipUntilUtf8(char32_t c, SeparatorUsage sep); void SkipUntilUtf8(char32_t c, SeparatorUsage sep);
private: private:
template<class T> template <class T>
[[nodiscard]] static std::pair<size_type, T> ParseIntegerBase(std::string_view src, int base, bool log_errors) [[nodiscard]] static std::pair<size_type, T> ParseIntegerBase(std::string_view src, int base, bool log_errors)
{ {
if (base == 0) { if (base == 0) {
@ -850,7 +850,7 @@ public:
* @return Length of string match, and parsed value. * @return Length of string match, and parsed value.
* @note The parser rejects leading whitespace and unary plus. * @note The parser rejects leading whitespace and unary plus.
*/ */
template<class T> template <class T>
[[nodiscard]] std::pair<size_type, T> PeekIntegerBase(int base) const [[nodiscard]] std::pair<size_type, T> PeekIntegerBase(int base) const
{ {
return ParseIntegerBase<T>(this->src.substr(this->position), base, false); return ParseIntegerBase<T>(this->src.substr(this->position), base, false);
@ -861,7 +861,7 @@ public:
* @return Parsed value, if valid. * @return Parsed value, if valid.
* @note The parser rejects leading whitespace and unary plus. * @note The parser rejects leading whitespace and unary plus.
*/ */
template<class T> template <class T>
[[nodiscard]] std::optional<T> TryReadIntegerBase(int base) [[nodiscard]] std::optional<T> TryReadIntegerBase(int base)
{ {
auto [len, value] = this->PeekIntegerBase<T>(base); auto [len, value] = this->PeekIntegerBase<T>(base);
@ -876,7 +876,7 @@ public:
* @note The reader is advanced, even if no valid data was present. * @note The reader is advanced, even if no valid data was present.
* @note The parser rejects leading whitespace and unary plus. * @note The parser rejects leading whitespace and unary plus.
*/ */
template<class T> template <class T>
[[nodiscard]] T ReadIntegerBase(int base, T def = 0) [[nodiscard]] T ReadIntegerBase(int base, T def = 0)
{ {
auto [len, value] = ParseIntegerBase<T>(this->src.substr(this->position), base, true); auto [len, value] = ParseIntegerBase<T>(this->src.substr(this->position), base, true);

View File

@ -18,8 +18,7 @@
/** /**
* Builder implementation for InPlaceReplacement. * Builder implementation for InPlaceReplacement.
*/ */
class InPlaceBuilder final : public BaseStringBuilder class InPlaceBuilder final : public BaseStringBuilder {
{
std::span<char> dest; std::span<char> dest;
size_type position = 0; size_type position = 0;
const StringConsumer &consumer; const StringConsumer &consumer;
@ -90,8 +89,7 @@ public:
* - The Builder writes data to the buffer, replacing already consumed data. * - The Builder writes data to the buffer, replacing already consumed data.
* - The Builder asserts, if it overtakes the consumer. * - The Builder asserts, if it overtakes the consumer.
*/ */
class InPlaceReplacement class InPlaceReplacement {
{
public: public:
StringConsumer consumer; ///< Consumer from shared buffer StringConsumer consumer; ///< Consumer from shared buffer
InPlaceBuilder builder; ///< Builder into shared buffer InPlaceBuilder builder; ///< Builder into shared buffer

View File

@ -117,7 +117,7 @@ static bool IsSccEncodedCode(char32_t c)
* @param consumer The string to validate. * @param consumer The string to validate.
* @param settings The settings for the string validation. * @param settings The settings for the string validation.
*/ */
template<class Builder> template <class Builder>
static void StrMakeValid(Builder &builder, StringConsumer &consumer, StringValidationSettings settings) static void StrMakeValid(Builder &builder, StringConsumer &consumer, StringValidationSettings settings)
{ {
/* Assume the ABSOLUTE WORST to be in str as it comes from the outside. */ /* Assume the ABSOLUTE WORST to be in str as it comes from the outside. */