diff options
author | somov <somov@yandex-team.ru> | 2022-02-10 16:45:47 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:47 +0300 |
commit | a5950576e397b1909261050b8c7da16db58f10b1 (patch) | |
tree | 7ba7677f6a4c3e19e2cefab34d16df2c8963b4d4 /contrib/restricted/abseil-cpp-tstring/y_absl/strings | |
parent | 81eddc8c0b55990194e112b02d127b87d54164a9 (diff) | |
download | ydb-a5950576e397b1909261050b8c7da16db58f10b1.tar.gz |
Restoring authorship annotation for <somov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/restricted/abseil-cpp-tstring/y_absl/strings')
56 files changed, 1078 insertions, 1078 deletions
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/ascii.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/ascii.cc index 959d6c27ff..45e3ea43c3 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/ascii.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/ascii.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/ascii.h" +#include "y_absl/strings/ascii.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace ascii_internal { @@ -155,19 +155,19 @@ ABSL_DLL const char kToUpper[256] = { } // namespace ascii_internal -void AsciiStrToLower(TString* s) { +void AsciiStrToLower(TString* s) { for (auto& ch : *s) { - ch = y_absl::ascii_tolower(ch); + ch = y_absl::ascii_tolower(ch); } } -void AsciiStrToUpper(TString* s) { +void AsciiStrToUpper(TString* s) { for (auto& ch : *s) { - ch = y_absl::ascii_toupper(ch); + ch = y_absl::ascii_toupper(ch); } } -void RemoveExtraAsciiWhitespace(TString* str) { +void RemoveExtraAsciiWhitespace(TString* str) { auto stripped = StripAsciiWhitespace(*str); if (stripped.empty()) { @@ -183,10 +183,10 @@ void RemoveExtraAsciiWhitespace(TString* str) { for (; input_it < input_end; ++input_it) { if (is_ws) { // Consecutive whitespace? Keep only the last. - is_ws = y_absl::ascii_isspace(*input_it); + is_ws = y_absl::ascii_isspace(*input_it); if (is_ws) --output_it; } else { - is_ws = y_absl::ascii_isspace(*input_it); + is_ws = y_absl::ascii_isspace(*input_it); } *output_it = *input_it; @@ -197,4 +197,4 @@ void RemoveExtraAsciiWhitespace(TString* str) { } ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/ascii.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/ascii.h index bc04710d8c..efe3c4f38f 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/ascii.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/ascii.h @@ -55,11 +55,11 @@ #include <algorithm> #include <util/generic/string.h> -#include "y_absl/base/attributes.h" +#include "y_absl/base/attributes.h" #include "y_absl/base/config.h" -#include "y_absl/strings/string_view.h" +#include "y_absl/strings/string_view.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace ascii_internal { @@ -165,12 +165,12 @@ inline char ascii_tolower(unsigned char c) { } // Converts the characters in `s` to lowercase, changing the contents of `s`. -void AsciiStrToLower(TString* s); +void AsciiStrToLower(TString* s); -// Creates a lowercase string from a given y_absl::string_view. -ABSL_MUST_USE_RESULT inline TString AsciiStrToLower(y_absl::string_view s) { - TString result(s); - y_absl::AsciiStrToLower(&result); +// Creates a lowercase string from a given y_absl::string_view. +ABSL_MUST_USE_RESULT inline TString AsciiStrToLower(y_absl::string_view s) { + TString result(s); + y_absl::AsciiStrToLower(&result); return result; } @@ -183,60 +183,60 @@ inline char ascii_toupper(unsigned char c) { } // Converts the characters in `s` to uppercase, changing the contents of `s`. -void AsciiStrToUpper(TString* s); +void AsciiStrToUpper(TString* s); -// Creates an uppercase string from a given y_absl::string_view. -ABSL_MUST_USE_RESULT inline TString AsciiStrToUpper(y_absl::string_view s) { - TString result(s); - y_absl::AsciiStrToUpper(&result); +// Creates an uppercase string from a given y_absl::string_view. +ABSL_MUST_USE_RESULT inline TString AsciiStrToUpper(y_absl::string_view s) { + TString result(s); + y_absl::AsciiStrToUpper(&result); return result; } -// Returns y_absl::string_view with whitespace stripped from the beginning of the +// Returns y_absl::string_view with whitespace stripped from the beginning of the // given string_view. -ABSL_MUST_USE_RESULT inline y_absl::string_view StripLeadingAsciiWhitespace( - y_absl::string_view str) { - auto it = std::find_if_not(str.begin(), str.end(), y_absl::ascii_isspace); +ABSL_MUST_USE_RESULT inline y_absl::string_view StripLeadingAsciiWhitespace( + y_absl::string_view str) { + auto it = std::find_if_not(str.begin(), str.end(), y_absl::ascii_isspace); return str.substr(it - str.begin()); } // Strips in place whitespace from the beginning of the given string. -inline void StripLeadingAsciiWhitespace(TString* str) { - auto it = std::find_if_not(str->cbegin(), str->cend(), y_absl::ascii_isspace); +inline void StripLeadingAsciiWhitespace(TString* str) { + auto it = std::find_if_not(str->cbegin(), str->cend(), y_absl::ascii_isspace); str->erase(str->begin(), it); } -// Returns y_absl::string_view with whitespace stripped from the end of the given +// Returns y_absl::string_view with whitespace stripped from the end of the given // string_view. -ABSL_MUST_USE_RESULT inline y_absl::string_view StripTrailingAsciiWhitespace( - y_absl::string_view str) { - auto it = std::find_if_not(str.rbegin(), str.rend(), y_absl::ascii_isspace); +ABSL_MUST_USE_RESULT inline y_absl::string_view StripTrailingAsciiWhitespace( + y_absl::string_view str) { + auto it = std::find_if_not(str.rbegin(), str.rend(), y_absl::ascii_isspace); return str.substr(0, str.rend() - it); } // Strips in place whitespace from the end of the given string -inline void StripTrailingAsciiWhitespace(TString* str) { - auto it = std::find_if_not(str->rbegin(), str->rend(), y_absl::ascii_isspace); +inline void StripTrailingAsciiWhitespace(TString* str) { + auto it = std::find_if_not(str->rbegin(), str->rend(), y_absl::ascii_isspace); str->erase(str->rend() - it); } -// Returns y_absl::string_view with whitespace stripped from both ends of the +// Returns y_absl::string_view with whitespace stripped from both ends of the // given string_view. -ABSL_MUST_USE_RESULT inline y_absl::string_view StripAsciiWhitespace( - y_absl::string_view str) { +ABSL_MUST_USE_RESULT inline y_absl::string_view StripAsciiWhitespace( + y_absl::string_view str) { return StripTrailingAsciiWhitespace(StripLeadingAsciiWhitespace(str)); } // Strips in place whitespace from both ends of the given string -inline void StripAsciiWhitespace(TString* str) { +inline void StripAsciiWhitespace(TString* str) { StripTrailingAsciiWhitespace(str); StripLeadingAsciiWhitespace(str); } // Removes leading, trailing, and consecutive internal whitespace. -void RemoveExtraAsciiWhitespace(TString*); +void RemoveExtraAsciiWhitespace(TString*); ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_ASCII_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/charconv.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/charconv.cc index 9515ca24dd..ff906ea64f 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/charconv.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/charconv.cc @@ -12,18 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/charconv.h" +#include "y_absl/strings/charconv.h" #include <algorithm> #include <cassert> #include <cmath> #include <cstring> -#include "y_absl/base/casts.h" +#include "y_absl/base/casts.h" #include "y_absl/numeric/bits.h" -#include "y_absl/numeric/int128.h" -#include "y_absl/strings/internal/charconv_bigint.h" -#include "y_absl/strings/internal/charconv_parse.h" +#include "y_absl/numeric/int128.h" +#include "y_absl/strings/internal/charconv_bigint.h" +#include "y_absl/strings/internal/charconv_parse.h" // The macro ABSL_BIT_PACK_FLOATS is defined on x86-64, where IEEE floating // point numbers have the same endianness in memory as a bitfield struct @@ -56,7 +56,7 @@ // end result normally has the 53rd bit set. It represents subnormals by using // narrower mantissas. -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace { @@ -124,7 +124,7 @@ struct FloatTraits<double> { assert(exponent == kMinNormalExponent); } dbl += mantissa; - return y_absl::bit_cast<double>(dbl); + return y_absl::bit_cast<double>(dbl); #endif // ABSL_BIT_PACK_FLOATS } }; @@ -164,7 +164,7 @@ struct FloatTraits<float> { assert(exponent == kMinNormalExponent); } flt += mantissa; - return y_absl::bit_cast<float>(flt); + return y_absl::bit_cast<float>(flt); #endif // ABSL_BIT_PACK_FLOATS } }; @@ -326,7 +326,7 @@ bool HandleEdgeCase(const strings_internal::ParsedFloat& input, bool negative, // number is stored in *value. template <typename FloatType> void EncodeResult(const CalculatedFloat& calculated, bool negative, - y_absl::from_chars_result* result, FloatType* value) { + y_absl::from_chars_result* result, FloatType* value) { if (calculated.exponent == kOverflow) { result->ec = std::errc::result_out_of_range; *value = negative ? -std::numeric_limits<FloatType>::max() @@ -432,7 +432,7 @@ bool MustRoundUp(uint64_t guess_mantissa, int guess_exponent, // better limit dynamically based on the value of parsed_decimal.exponent. // This would optimize pathological input cases only. (Sane inputs won't have // hundreds of digits of mantissa.) - y_absl::strings_internal::BigUnsigned<84> exact_mantissa; + y_absl::strings_internal::BigUnsigned<84> exact_mantissa; int exact_exponent = exact_mantissa.ReadFloatMantissa(parsed_decimal, 768); // Adjust the `guess` arguments to be halfway between A and B. @@ -446,11 +446,11 @@ bool MustRoundUp(uint64_t guess_mantissa, int guess_exponent, // // Because we are doing integer math, we can't directly deal with negative // exponents. We instead move these to the other side of the inequality. - y_absl::strings_internal::BigUnsigned<84>& lhs = exact_mantissa; + y_absl::strings_internal::BigUnsigned<84>& lhs = exact_mantissa; int comparison; if (exact_exponent >= 0) { lhs.MultiplyByFiveToTheNth(exact_exponent); - y_absl::strings_internal::BigUnsigned<84> rhs(guess_mantissa); + y_absl::strings_internal::BigUnsigned<84> rhs(guess_mantissa); // There are powers of 2 on both sides of the inequality; reduce this to // a single bit-shift. if (exact_exponent > guess_exponent) { @@ -463,8 +463,8 @@ bool MustRoundUp(uint64_t guess_mantissa, int guess_exponent, // Move the power of 5 to the other side of the equation, giving us: // lhs = exact_mantissa * 2**exact_exponent // rhs = guess_mantissa * 5**(-exact_exponent) * 2**guess_exponent - y_absl::strings_internal::BigUnsigned<84> rhs = - y_absl::strings_internal::BigUnsigned<84>::FiveToTheNth(-exact_exponent); + y_absl::strings_internal::BigUnsigned<84> rhs = + y_absl::strings_internal::BigUnsigned<84>::FiveToTheNth(-exact_exponent); rhs.MultiplyBy(guess_mantissa); if (exact_exponent > guess_exponent) { lhs.ShiftLeft(exact_exponent - guess_exponent); @@ -981,4 +981,4 @@ const int16_t kPower10ExponentTable[] = { } // namespace ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/charconv.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/charconv.h index 1a115aa251..a80092f504 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/charconv.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/charconv.h @@ -19,12 +19,12 @@ #include "y_absl/base/config.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN // Workalike compatibilty version of std::chars_format from C++17. // -// This is an bitfield enumerator which can be passed to y_absl::from_chars to +// This is an bitfield enumerator which can be passed to y_absl::from_chars to // configure the string-to-float conversion. enum class chars_format { scientific = 1, @@ -76,11 +76,11 @@ struct from_chars_result { // format that strtod() accepts, except that a "0x" prefix is NOT matched. // (In particular, in `hex` mode, the input "0xff" results in the largest // matching pattern "0".) -y_absl::from_chars_result from_chars(const char* first, const char* last, +y_absl::from_chars_result from_chars(const char* first, const char* last, double& value, // NOLINT chars_format fmt = chars_format::general); -y_absl::from_chars_result from_chars(const char* first, const char* last, +y_absl::from_chars_result from_chars(const char* first, const char* last, float& value, // NOLINT chars_format fmt = chars_format::general); @@ -115,6 +115,6 @@ inline chars_format& operator^=(chars_format& lhs, chars_format rhs) { } ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_CHARCONV_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/escaping.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/escaping.cc index 8c82740608..4461d83a85 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/escaping.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/escaping.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/escaping.h" +#include "y_absl/strings/escaping.h" #include <algorithm> #include <cassert> @@ -22,18 +22,18 @@ #include <limits> #include <util/generic/string.h> -#include "y_absl/base/internal/endian.h" -#include "y_absl/base/internal/raw_logging.h" -#include "y_absl/base/internal/unaligned_access.h" -#include "y_absl/strings/internal/char_map.h" +#include "y_absl/base/internal/endian.h" +#include "y_absl/base/internal/raw_logging.h" +#include "y_absl/base/internal/unaligned_access.h" +#include "y_absl/strings/internal/char_map.h" #include "y_absl/strings/internal/escaping.h" -#include "y_absl/strings/internal/resize_uninitialized.h" -#include "y_absl/strings/internal/utf8.h" -#include "y_absl/strings/str_cat.h" -#include "y_absl/strings/str_join.h" -#include "y_absl/strings/string_view.h" +#include "y_absl/strings/internal/resize_uninitialized.h" +#include "y_absl/strings/internal/utf8.h" +#include "y_absl/strings/str_cat.h" +#include "y_absl/strings/str_join.h" +#include "y_absl/strings/string_view.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace { @@ -45,7 +45,7 @@ inline bool is_octal_digit(char c) { return ('0' <= c) && (c <= '7'); } inline int hex_digit_to_int(char c) { static_assert('0' == 0x30 && 'A' == 0x41 && 'a' == 0x61, "Character set must be ASCII."); - assert(y_absl::ascii_isxdigit(c)); + assert(y_absl::ascii_isxdigit(c)); int x = static_cast<unsigned char>(c); if (x > '9') { x += 9; @@ -53,10 +53,10 @@ inline int hex_digit_to_int(char c) { return x & 0xf; } -inline bool IsSurrogate(char32_t c, y_absl::string_view src, TString* error) { +inline bool IsSurrogate(char32_t c, y_absl::string_view src, TString* error) { if (c >= 0xD800 && c <= 0xDFFF) { if (error) { - *error = y_absl::StrCat("invalid surrogate character (0xD800-DFFF): \\", + *error = y_absl::StrCat("invalid surrogate character (0xD800-DFFF): \\", src); } return true; @@ -81,8 +81,8 @@ inline bool IsSurrogate(char32_t c, y_absl::string_view src, TString* error) { // NOTE: any changes to this function must also be reflected in the older // UnescapeCEscapeSequences(). // ---------------------------------------------------------------------- -bool CUnescapeInternal(y_absl::string_view source, bool leave_nulls_escaped, - char* dest, ptrdiff_t* dest_len, TString* error) { +bool CUnescapeInternal(y_absl::string_view source, bool leave_nulls_escaped, + char* dest, ptrdiff_t* dest_len, TString* error) { char* d = dest; const char* p = source.data(); const char* end = p + source.size(); @@ -128,7 +128,7 @@ bool CUnescapeInternal(y_absl::string_view source, bool leave_nulls_escaped, if (ch > 0xff) { if (error) { *error = "Value of \\" + - TString(octal_start, p + 1 - octal_start) + + TString(octal_start, p + 1 - octal_start) + " exceeds 0xff"; } return false; @@ -149,19 +149,19 @@ bool CUnescapeInternal(y_absl::string_view source, bool leave_nulls_escaped, if (p >= last_byte) { if (error) *error = "String cannot end with \\x"; return false; - } else if (!y_absl::ascii_isxdigit(p[1])) { + } else if (!y_absl::ascii_isxdigit(p[1])) { if (error) *error = "\\x cannot be followed by a non-hex digit"; return false; } unsigned int ch = 0; const char* hex_start = p; - while (p < last_byte && y_absl::ascii_isxdigit(p[1])) + while (p < last_byte && y_absl::ascii_isxdigit(p[1])) // Arbitrarily many hex digits ch = (ch << 4) + hex_digit_to_int(*++p); if (ch > 0xFF) { if (error) { *error = "Value of \\" + - TString(hex_start, p + 1 - hex_start) + + TString(hex_start, p + 1 - hex_start) + " exceeds 0xff"; } return false; @@ -184,18 +184,18 @@ bool CUnescapeInternal(y_absl::string_view source, bool leave_nulls_escaped, if (p + 4 >= end) { if (error) { *error = "\\u must be followed by 4 hex digits: \\" + - TString(hex_start, p + 1 - hex_start); + TString(hex_start, p + 1 - hex_start); } return false; } for (int i = 0; i < 4; ++i) { // Look one char ahead. - if (y_absl::ascii_isxdigit(p[1])) { + if (y_absl::ascii_isxdigit(p[1])) { rune = (rune << 4) + hex_digit_to_int(*++p); // Advance p. } else { if (error) { *error = "\\u must be followed by 4 hex digits: \\" + - TString(hex_start, p + 1 - hex_start); + TString(hex_start, p + 1 - hex_start); } return false; } @@ -207,7 +207,7 @@ bool CUnescapeInternal(y_absl::string_view source, bool leave_nulls_escaped, d += 5; break; } - if (IsSurrogate(rune, y_absl::string_view(hex_start, 5), error)) { + if (IsSurrogate(rune, y_absl::string_view(hex_start, 5), error)) { return false; } d += strings_internal::EncodeUTF8Char(d, rune); @@ -220,20 +220,20 @@ bool CUnescapeInternal(y_absl::string_view source, bool leave_nulls_escaped, if (p + 8 >= end) { if (error) { *error = "\\U must be followed by 8 hex digits: \\" + - TString(hex_start, p + 1 - hex_start); + TString(hex_start, p + 1 - hex_start); } return false; } for (int i = 0; i < 8; ++i) { // Look one char ahead. - if (y_absl::ascii_isxdigit(p[1])) { + if (y_absl::ascii_isxdigit(p[1])) { // Don't change rune until we're sure this // is within the Unicode limit, but do advance p. uint32_t newrune = (rune << 4) + hex_digit_to_int(*++p); if (newrune > 0x10FFFF) { if (error) { *error = "Value of \\" + - TString(hex_start, p + 1 - hex_start) + + TString(hex_start, p + 1 - hex_start) + " exceeds Unicode limit (0x10FFFF)"; } return false; @@ -243,7 +243,7 @@ bool CUnescapeInternal(y_absl::string_view source, bool leave_nulls_escaped, } else { if (error) { *error = "\\U must be followed by 8 hex digits: \\" + - TString(hex_start, p + 1 - hex_start); + TString(hex_start, p + 1 - hex_start); } return false; } @@ -255,14 +255,14 @@ bool CUnescapeInternal(y_absl::string_view source, bool leave_nulls_escaped, d += 9; break; } - if (IsSurrogate(rune, y_absl::string_view(hex_start, 9), error)) { + if (IsSurrogate(rune, y_absl::string_view(hex_start, 9), error)) { return false; } d += strings_internal::EncodeUTF8Char(d, rune); break; } default: { - if (error) *error = TString("Unknown escape sequence: \\") + *p; + if (error) *error = TString("Unknown escape sequence: \\") + *p; return false; } } @@ -276,11 +276,11 @@ bool CUnescapeInternal(y_absl::string_view source, bool leave_nulls_escaped, // ---------------------------------------------------------------------- // CUnescapeInternal() // -// Same as above but uses a TString for output. 'source' and 'dest' +// Same as above but uses a TString for output. 'source' and 'dest' // may be the same. // ---------------------------------------------------------------------- -bool CUnescapeInternal(y_absl::string_view source, bool leave_nulls_escaped, - TString* dest, TString* error) { +bool CUnescapeInternal(y_absl::string_view source, bool leave_nulls_escaped, + TString* dest, TString* error) { strings_internal::STLStringResizeUninitialized(dest, source.size()); ptrdiff_t dest_size; @@ -304,11 +304,11 @@ bool CUnescapeInternal(y_absl::string_view source, bool leave_nulls_escaped, // preparing query flags. The 'Hex' version uses hexadecimal rather than // octal sequences. The 'Utf8Safe' version does not touch UTF-8 bytes. // -// Escaped chars: \n, \r, \t, ", ', \, and !y_absl::ascii_isprint(). +// Escaped chars: \n, \r, \t, ", ', \, and !y_absl::ascii_isprint(). // ---------------------------------------------------------------------- -TString CEscapeInternal(y_absl::string_view src, bool use_hex, +TString CEscapeInternal(y_absl::string_view src, bool use_hex, bool utf8_safe) { - TString dest; + TString dest; bool last_hex_escape = false; // true if last output char was \xNN. for (unsigned char c : src) { @@ -325,8 +325,8 @@ TString CEscapeInternal(y_absl::string_view src, bool use_hex, // digit then that digit must be escaped too to prevent it being // interpreted as part of the character code by C. if ((!utf8_safe || c < 0x80) && - (!y_absl::ascii_isprint(c) || - (last_hex_escape && y_absl::ascii_isxdigit(c)))) { + (!y_absl::ascii_isprint(c) || + (last_hex_escape && y_absl::ascii_isxdigit(c)))) { if (use_hex) { dest.append("\\" "x"); dest.push_back(numbers_internal::kHexChar[c / 16]); @@ -373,13 +373,13 @@ constexpr char c_escaped_len[256] = { // Calculates the length of the C-style escaped version of 'src'. // Assumes that non-printable characters are escaped using octal sequences, and // that UTF-8 bytes are not handled specially. -inline size_t CEscapedLength(y_absl::string_view src) { +inline size_t CEscapedLength(y_absl::string_view src) { size_t escaped_len = 0; for (unsigned char c : src) escaped_len += c_escaped_len[c]; return escaped_len; } -void CEscapeAndAppendInternal(y_absl::string_view src, TString* dest) { +void CEscapeAndAppendInternal(y_absl::string_view src, TString* dest) { size_t escaped_len = CEscapedLength(src); if (escaped_len == src.size()) { dest->append(src.data(), src.size()); @@ -460,7 +460,7 @@ bool Base64UnescapeInternal(const char* src_param, size_t szsrc, char* dest, ch = *src++; \ decode = unbase64[ch]; \ if (decode < 0) { \ - if (y_absl::ascii_isspace(ch) && szsrc >= remain) goto label; \ + if (y_absl::ascii_isspace(ch) && szsrc >= remain) goto label; \ state = 4 - remain; \ break; \ } @@ -550,7 +550,7 @@ bool Base64UnescapeInternal(const char* src_param, size_t szsrc, char* dest, // if the loop terminated because we read a bad character, return // now. if (decode < 0 && ch != kPad64Equals && ch != kPad64Dot && - !y_absl::ascii_isspace(ch)) + !y_absl::ascii_isspace(ch)) return false; if (ch == kPad64Equals || ch == kPad64Dot) { @@ -569,7 +569,7 @@ bool Base64UnescapeInternal(const char* src_param, size_t szsrc, char* dest, ch = *src++; decode = unbase64[ch]; if (decode < 0) { - if (y_absl::ascii_isspace(ch)) { + if (y_absl::ascii_isspace(ch)) { continue; } else if (ch == kPad64Equals || ch == kPad64Dot) { // back up one character; we'll read it again when we check @@ -653,7 +653,7 @@ bool Base64UnescapeInternal(const char* src_param, size_t szsrc, char* dest, while (szsrc > 0) { if (*src == kPad64Equals || *src == kPad64Dot) ++equals; - else if (!y_absl::ascii_isspace(*src)) + else if (!y_absl::ascii_isspace(*src)) return false; --szsrc; ++src; @@ -829,7 +829,7 @@ void HexStringToBytesInternal(const char* from, T to, ptrdiff_t num) { } // This is a templated function so that T can be either a char* or a -// TString. +// TString. template <typename T> void BytesToHexStringInternal(const unsigned char* src, T dest, ptrdiff_t num) { auto dest_ptr = &dest[0]; @@ -846,26 +846,26 @@ void BytesToHexStringInternal(const unsigned char* src, T dest, ptrdiff_t num) { // // See CUnescapeInternal() for implementation details. // ---------------------------------------------------------------------- -bool CUnescape(y_absl::string_view source, TString* dest, - TString* error) { +bool CUnescape(y_absl::string_view source, TString* dest, + TString* error) { return CUnescapeInternal(source, kUnescapeNulls, dest, error); } -TString CEscape(y_absl::string_view src) { - TString dest; +TString CEscape(y_absl::string_view src) { + TString dest; CEscapeAndAppendInternal(src, &dest); return dest; } -TString CHexEscape(y_absl::string_view src) { +TString CHexEscape(y_absl::string_view src) { return CEscapeInternal(src, true, false); } -TString Utf8SafeCEscape(y_absl::string_view src) { +TString Utf8SafeCEscape(y_absl::string_view src) { return CEscapeInternal(src, false, true); } -TString Utf8SafeCHexEscape(y_absl::string_view src) { +TString Utf8SafeCHexEscape(y_absl::string_view src) { return CEscapeInternal(src, true, true); } @@ -893,57 +893,57 @@ TString Utf8SafeCHexEscape(y_absl::string_view src) { // indicate that the text was not an integer multiple of three bytes long. // ---------------------------------------------------------------------- -bool Base64Unescape(y_absl::string_view src, TString* dest) { +bool Base64Unescape(y_absl::string_view src, TString* dest) { return Base64UnescapeInternal(src.data(), src.size(), dest, kUnBase64); } -bool WebSafeBase64Unescape(y_absl::string_view src, TString* dest) { +bool WebSafeBase64Unescape(y_absl::string_view src, TString* dest) { return Base64UnescapeInternal(src.data(), src.size(), dest, kUnWebSafeBase64); } -void Base64Escape(y_absl::string_view src, TString* dest) { +void Base64Escape(y_absl::string_view src, TString* dest) { strings_internal::Base64EscapeInternal( reinterpret_cast<const unsigned char*>(src.data()), src.size(), dest, true, strings_internal::kBase64Chars); } -void WebSafeBase64Escape(y_absl::string_view src, TString* dest) { +void WebSafeBase64Escape(y_absl::string_view src, TString* dest) { strings_internal::Base64EscapeInternal( reinterpret_cast<const unsigned char*>(src.data()), src.size(), dest, false, kWebSafeBase64Chars); } -TString Base64Escape(y_absl::string_view src) { - TString dest; +TString Base64Escape(y_absl::string_view src) { + TString dest; strings_internal::Base64EscapeInternal( reinterpret_cast<const unsigned char*>(src.data()), src.size(), &dest, true, strings_internal::kBase64Chars); return dest; } -TString WebSafeBase64Escape(y_absl::string_view src) { - TString dest; +TString WebSafeBase64Escape(y_absl::string_view src) { + TString dest; strings_internal::Base64EscapeInternal( reinterpret_cast<const unsigned char*>(src.data()), src.size(), &dest, false, kWebSafeBase64Chars); return dest; } -TString HexStringToBytes(y_absl::string_view from) { - TString result; +TString HexStringToBytes(y_absl::string_view from) { + TString result; const auto num = from.size() / 2; strings_internal::STLStringResizeUninitialized(&result, num); - y_absl::HexStringToBytesInternal<TString&>(from.data(), result, num); + y_absl::HexStringToBytesInternal<TString&>(from.data(), result, num); return result; } -TString BytesToHexString(y_absl::string_view from) { - TString result; +TString BytesToHexString(y_absl::string_view from) { + TString result; strings_internal::STLStringResizeUninitialized(&result, 2 * from.size()); - y_absl::BytesToHexStringInternal<TString&>( + y_absl::BytesToHexStringInternal<TString&>( reinterpret_cast<const unsigned char*>(from.data()), result, from.size()); return result; } ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/escaping.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/escaping.h index 8868b87879..098fb91d36 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/escaping.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/escaping.h @@ -27,12 +27,12 @@ #include <util/generic/string.h> #include <vector> -#include "y_absl/base/macros.h" -#include "y_absl/strings/ascii.h" -#include "y_absl/strings/str_join.h" -#include "y_absl/strings/string_view.h" +#include "y_absl/base/macros.h" +#include "y_absl/strings/ascii.h" +#include "y_absl/strings/str_join.h" +#include "y_absl/strings/string_view.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN // CUnescape() @@ -63,16 +63,16 @@ ABSL_NAMESPACE_BEGIN // // Example: // -// TString s = "foo\\rbar\\nbaz\\t"; -// TString unescaped_s; -// if (!y_absl::CUnescape(s, &unescaped_s) { +// TString s = "foo\\rbar\\nbaz\\t"; +// TString unescaped_s; +// if (!y_absl::CUnescape(s, &unescaped_s) { // ... // } // EXPECT_EQ(unescaped_s, "foo\rbar\nbaz\t"); -bool CUnescape(y_absl::string_view source, TString* dest, TString* error); +bool CUnescape(y_absl::string_view source, TString* dest, TString* error); // Overload of `CUnescape()` with no error reporting. -inline bool CUnescape(y_absl::string_view source, TString* dest) { +inline bool CUnescape(y_absl::string_view source, TString* dest) { return CUnescape(source, dest, nullptr); } @@ -84,10 +84,10 @@ inline bool CUnescape(y_absl::string_view source, TString* dest) { // // Example: // -// TString s = "foo\rbar\tbaz\010\011\012\013\014\x0d\n"; -// TString escaped_s = y_absl::CEscape(s); +// TString s = "foo\rbar\tbaz\010\011\012\013\014\x0d\n"; +// TString escaped_s = y_absl::CEscape(s); // EXPECT_EQ(escaped_s, "foo\\rbar\\tbaz\\010\\t\\n\\013\\014\\r\\n"); -TString CEscape(y_absl::string_view src); +TString CEscape(y_absl::string_view src); // CHexEscape() // @@ -97,10 +97,10 @@ TString CEscape(y_absl::string_view src); // // Example: // -// TString s = "foo\rbar\tbaz\010\011\012\013\014\x0d\n"; -// TString escaped_s = y_absl::CHexEscape(s); +// TString s = "foo\rbar\tbaz\010\011\012\013\014\x0d\n"; +// TString escaped_s = y_absl::CHexEscape(s); // EXPECT_EQ(escaped_s, "foo\\rbar\\tbaz\\x08\\t\\n\\x0b\\x0c\\r\\n"); -TString CHexEscape(y_absl::string_view src); +TString CHexEscape(y_absl::string_view src); // Utf8SafeCEscape() // @@ -108,57 +108,57 @@ TString CHexEscape(y_absl::string_view src); // octal sequences, and passing through UTF-8 characters without conversion. // I.e., when encountering any bytes with their high bit set, this function // will not escape those values, whether or not they are valid UTF-8. -TString Utf8SafeCEscape(y_absl::string_view src); +TString Utf8SafeCEscape(y_absl::string_view src); // Utf8SafeCHexEscape() // // Escapes a 'src' string using C-style escape sequences, escaping bytes as // hexadecimal sequences, and passing through UTF-8 characters without // conversion. -TString Utf8SafeCHexEscape(y_absl::string_view src); +TString Utf8SafeCHexEscape(y_absl::string_view src); // Base64Unescape() // // Converts a `src` string encoded in Base64 to its binary equivalent, writing // it to a `dest` buffer, returning `true` on success. If `src` contains invalid // characters, `dest` is cleared and returns `false`. -bool Base64Unescape(y_absl::string_view src, TString* dest); +bool Base64Unescape(y_absl::string_view src, TString* dest); // WebSafeBase64Unescape() // // Converts a `src` string encoded in Base64 to its binary equivalent, writing // it to a `dest` buffer, but using '-' instead of '+', and '_' instead of '/'. // If `src` contains invalid characters, `dest` is cleared and returns `false`. -bool WebSafeBase64Unescape(y_absl::string_view src, TString* dest); +bool WebSafeBase64Unescape(y_absl::string_view src, TString* dest); // Base64Escape() // // Encodes a `src` string into a base64-encoded string, with padding characters. // This function conforms with RFC 4648 section 4 (base64). -void Base64Escape(y_absl::string_view src, TString* dest); -TString Base64Escape(y_absl::string_view src); +void Base64Escape(y_absl::string_view src, TString* dest); +TString Base64Escape(y_absl::string_view src); // WebSafeBase64Escape() // // Encodes a `src` string into a base64-like string, using '-' instead of '+' // and '_' instead of '/', and without padding. This function conforms with RFC // 4648 section 5 (base64url). -void WebSafeBase64Escape(y_absl::string_view src, TString* dest); -TString WebSafeBase64Escape(y_absl::string_view src); +void WebSafeBase64Escape(y_absl::string_view src, TString* dest); +TString WebSafeBase64Escape(y_absl::string_view src); // HexStringToBytes() // // Converts an ASCII hex string into bytes, returning binary data of length // `from.size()/2`. -TString HexStringToBytes(y_absl::string_view from); +TString HexStringToBytes(y_absl::string_view from); // BytesToHexString() // // Converts binary data into an ASCII text string, returning a string of size // `2*from.size()`. -TString BytesToHexString(y_absl::string_view from); +TString BytesToHexString(y_absl::string_view from); ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_ESCAPING_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/char_map.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/char_map.h index 25428e304c..b8badd7901 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/char_map.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/char_map.h @@ -24,10 +24,10 @@ #include <cstdint> #include <cstring> -#include "y_absl/base/macros.h" -#include "y_absl/base/port.h" +#include "y_absl/base/macros.h" +#include "y_absl/base/port.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { @@ -151,6 +151,6 @@ constexpr Charmap PunctCharmap() { return GraphCharmap() & ~AlnumCharmap(); } } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_CHAR_MAP_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/charconv_bigint.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/charconv_bigint.cc index 72a4fa188b..f47fecbf1f 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/charconv_bigint.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/charconv_bigint.cc @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/internal/charconv_bigint.h" +#include "y_absl/strings/internal/charconv_bigint.h" #include <algorithm> #include <cassert> #include <util/generic/string.h> -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { @@ -336,9 +336,9 @@ void BigUnsigned<max_words>::MultiplyStep(int original_size, } template <int max_words> -TString BigUnsigned<max_words>::ToString() const { +TString BigUnsigned<max_words>::ToString() const { BigUnsigned<max_words> copy = *this; - TString result; + TString result; // Build result in reverse order while (copy.size() > 0) { int next_digit = copy.DivMod<10>(); @@ -347,7 +347,7 @@ TString BigUnsigned<max_words>::ToString() const { if (result.empty()) { result.push_back('0'); } - std::reverse(result.begin(), result.vend()); + std::reverse(result.begin(), result.vend()); return result; } @@ -356,4 +356,4 @@ template class BigUnsigned<84>; } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/charconv_bigint.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/charconv_bigint.h index a77aab14dd..13b1d5db44 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/charconv_bigint.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/charconv_bigint.h @@ -21,11 +21,11 @@ #include <util/generic/string.h> #include "y_absl/base/config.h" -#include "y_absl/strings/ascii.h" -#include "y_absl/strings/internal/charconv_parse.h" -#include "y_absl/strings/string_view.h" +#include "y_absl/strings/ascii.h" +#include "y_absl/strings/internal/charconv_parse.h" +#include "y_absl/strings/string_view.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { @@ -41,7 +41,7 @@ ABSL_DLL extern const uint32_t kTenToNth[kMaxSmallPowerOfTen + 1]; // Large, fixed-width unsigned integer. // // Exact rounding for decimal-to-binary floating point conversion requires very -// large integer math, but a design goal of y_absl::from_chars is to avoid +// large integer math, but a design goal of y_absl::from_chars is to avoid // allocating memory. The integer precision needed for decimal-to-binary // conversions is large but bounded, so a huge fixed-width integer class // suffices. @@ -68,7 +68,7 @@ class BigUnsigned { // Constructs a BigUnsigned from the given string_view containing a decimal // value. If the input string is not a decimal integer, constructs a 0 // instead. - explicit BigUnsigned(y_absl::string_view sv) : size_(0), words_{} { + explicit BigUnsigned(y_absl::string_view sv) : size_(0), words_{} { // Check for valid input, returning a 0 otherwise. This is reasonable // behavior only because this constructor is for unit tests. if (std::find_if_not(sv.begin(), sv.end(), ascii_isdigit) != sv.end() || @@ -212,7 +212,7 @@ class BigUnsigned { // Returns this integer as a decimal string. This is not used in the decimal- // to-binary conversion; it is intended to aid in testing. - TString ToString() const; + TString ToString() const; int size() const { return size_; } const uint32_t* words() const { return words_; } @@ -418,6 +418,6 @@ extern template class BigUnsigned<84>; } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_CHARCONV_BIGINT_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/charconv_parse.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/charconv_parse.cc index f0f78eb68c..d13dc938ef 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/charconv_parse.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/charconv_parse.cc @@ -12,16 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/internal/charconv_parse.h" -#include "y_absl/strings/charconv.h" +#include "y_absl/strings/internal/charconv_parse.h" +#include "y_absl/strings/charconv.h" #include <cassert> #include <cstdint> #include <limits> -#include "y_absl/strings/internal/memutil.h" +#include "y_absl/strings/internal/memutil.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace { @@ -501,4 +501,4 @@ template ParsedFloat ParseFloat<16>(const char* begin, const char* end, } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/charconv_parse.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/charconv_parse.h index 3f942cd4cb..31239d9ab4 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/charconv_parse.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/charconv_parse.h @@ -18,9 +18,9 @@ #include <cstdint> #include "y_absl/base/config.h" -#include "y_absl/strings/charconv.h" +#include "y_absl/strings/charconv.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { @@ -86,14 +86,14 @@ struct ParsedFloat { // *not* consumed. The `hex` bit from format_flags is ignored by ParseFloat. template <int base> ParsedFloat ParseFloat(const char* begin, const char* end, - y_absl::chars_format format_flags); + y_absl::chars_format format_flags); extern template ParsedFloat ParseFloat<10>(const char* begin, const char* end, - y_absl::chars_format format_flags); + y_absl::chars_format format_flags); extern template ParsedFloat ParseFloat<16>(const char* begin, const char* end, - y_absl::chars_format format_flags); + y_absl::chars_format format_flags); } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_CHARCONV_PARSE_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/escaping_test_common.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/escaping_test_common.h index f145127225..c9f4351692 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/escaping_test_common.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/escaping_test_common.h @@ -19,15 +19,15 @@ #define ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_ #include <array> -#include "y_absl/strings/string_view.h" +#include "y_absl/strings/string_view.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { struct base64_testcase { - y_absl::string_view plaintext; - y_absl::string_view cyphertext; + y_absl::string_view plaintext; + y_absl::string_view cyphertext; }; inline const std::array<base64_testcase, 5>& base64_strings() { @@ -128,6 +128,6 @@ inline const std::array<base64_testcase, 5>& base64_strings() { } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/memutil.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/memutil.cc index 0ba6574fdb..801181e3fc 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/memutil.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/memutil.cc @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/internal/memutil.h" +#include "y_absl/strings/internal/memutil.h" #include <cstdlib> -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { @@ -26,8 +26,8 @@ int memcasecmp(const char* s1, const char* s2, size_t len) { for (size_t i = 0; i < len; i++) { const int diff = - int{static_cast<unsigned char>(y_absl::ascii_tolower(us1[i]))} - - int{static_cast<unsigned char>(y_absl::ascii_tolower(us2[i]))}; + int{static_cast<unsigned char>(y_absl::ascii_tolower(us1[i]))} - + int{static_cast<unsigned char>(y_absl::ascii_tolower(us2[i]))}; if (diff != 0) return diff; } return 0; @@ -109,4 +109,4 @@ const char* memmatch(const char* phaystack, size_t haylen, const char* pneedle, } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/memutil.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/memutil.h index ee442fe25f..fb6a48ebad 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/memutil.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/memutil.h @@ -24,7 +24,7 @@ // The difference between the mem and str versions is the mem version // takes a pointer and a length, rather than a '\0'-terminated string. // The memcase* routines defined here assume the locale is "C" -// (they use y_absl::ascii_tolower instead of tolower). +// (they use y_absl::ascii_tolower instead of tolower). // // These routines are based on the BSD library. // @@ -65,10 +65,10 @@ #include <cstddef> #include <cstring> -#include "y_absl/base/port.h" // disable some warnings on Windows -#include "y_absl/strings/ascii.h" // for y_absl::ascii_tolower +#include "y_absl/base/port.h" // disable some warnings on Windows +#include "y_absl/strings/ascii.h" // for y_absl::ascii_tolower -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { @@ -98,10 +98,10 @@ const char* int_memmatch(const char* haystack, size_t haylen, for (; haystack < hayend; ++haystack) { char hay = case_sensitive ? *haystack - : y_absl::ascii_tolower(static_cast<unsigned char>(*haystack)); + : y_absl::ascii_tolower(static_cast<unsigned char>(*haystack)); char nee = case_sensitive ? *needle - : y_absl::ascii_tolower(static_cast<unsigned char>(*needle)); + : y_absl::ascii_tolower(static_cast<unsigned char>(*needle)); if (hay == nee) { if (++needle == needleend) { return haystack + 1 - neelen; @@ -143,6 +143,6 @@ const char* memmatch(const char* phaystack, size_t haylen, const char* pneedle, } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_MEMUTIL_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/numbers_test_common.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/numbers_test_common.h index 12aec3ac11..ef07171c41 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/numbers_test_common.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/numbers_test_common.h @@ -25,12 +25,12 @@ #include "y_absl/base/config.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { template <typename IntType> -inline bool Itoa(IntType value, int base, TString* destination) { +inline bool Itoa(IntType value, int base, TString* destination) { destination->clear(); if (base <= 1 || base > 36) { return false; @@ -179,6 +179,6 @@ inline const std::array<uint64_test_case, 34>& strtouint64_test_cases() { } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_NUMBERS_TEST_COMMON_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/ostringstream.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/ostringstream.cc index ba18857d83..df891f0533 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/ostringstream.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/ostringstream.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/internal/ostringstream.h" +#include "y_absl/strings/internal/ostringstream.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { @@ -33,4 +33,4 @@ std::streamsize OStringStream::xsputn(const char* s, std::streamsize n) { } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/ostringstream.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/ostringstream.h index d00cef9c23..aa1d8d6658 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/ostringstream.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/ostringstream.h @@ -20,24 +20,24 @@ #include <streambuf> #include <util/generic/string.h> -#include "y_absl/base/port.h" +#include "y_absl/base/port.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { -// The same as std::ostringstream but appends to a user-specified TString, +// The same as std::ostringstream but appends to a user-specified TString, // and is faster. It is ~70% faster to create, ~50% faster to write to, and -// completely free to extract the result TString. +// completely free to extract the result TString. // -// TString s; +// TString s; // OStringStream strm(&s); // strm << 42 << ' ' << 3.14; // appends to `s` // // The stream object doesn't have to be named. Starting from C++11 operator<< // works with rvalues of std::ostream. // -// TString s; +// TString s; // OStringStream(&s) << 42 << ' ' << 3.14; // appends to `s` // // OStringStream is faster to create than std::ostringstream but it's still @@ -46,14 +46,14 @@ namespace strings_internal { // // Creates unnecessary instances of OStringStream: slow. // -// TString s; +// TString s; // OStringStream(&s) << 42; // OStringStream(&s) << ' '; // OStringStream(&s) << 3.14; // // Creates a single instance of OStringStream and reuses it: fast. // -// TString s; +// TString s; // OStringStream strm(&s); // strm << 42; // strm << ' '; @@ -65,13 +65,13 @@ class OStringStream : private std::basic_streambuf<char>, public std::ostream { // The argument can be null, in which case you'll need to call str(p) with a // non-null argument before you can write to the stream. // - // The destructor of OStringStream doesn't use the TString. It's OK to - // destroy the TString before the stream. - explicit OStringStream(TString* s) : std::ostream(this), s_(s) {} + // The destructor of OStringStream doesn't use the TString. It's OK to + // destroy the TString before the stream. + explicit OStringStream(TString* s) : std::ostream(this), s_(s) {} - TString* str() { return s_; } - const TString* str() const { return s_; } - void str(TString* s) { s_ = s; } + TString* str() { return s_; } + const TString* str() const { return s_; } + void str(TString* s) { s_ = s; } private: using Buf = std::basic_streambuf<char>; @@ -79,11 +79,11 @@ class OStringStream : private std::basic_streambuf<char>, public std::ostream { Buf::int_type overflow(int c) override; std::streamsize xsputn(const char* s, std::streamsize n) override; - TString* s_; + TString* s_; }; } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_OSTRINGSTREAM_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/pow10_helper.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/pow10_helper.h index e4d41d7e4e..b4a9b1c3db 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/pow10_helper.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/pow10_helper.h @@ -24,7 +24,7 @@ #include "y_absl/base/config.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { @@ -35,6 +35,6 @@ double Pow10(int exp); } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_POW10_HELPER_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/resize_uninitialized.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/resize_uninitialized.h index 14860bb237..9ed8ca2063 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/resize_uninitialized.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/resize_uninitialized.h @@ -22,10 +22,10 @@ #include <type_traits> #include <utility> -#include "y_absl/base/port.h" -#include "y_absl/meta/type_traits.h" // for void_t +#include "y_absl/base/port.h" +#include "y_absl/meta/type_traits.h" // for void_t -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { @@ -41,7 +41,7 @@ struct ResizeUninitializedTraits { // __resize_default_init is provided by libc++ >= 8.0 template <typename string_type> struct ResizeUninitializedTraits< - string_type, y_absl::void_t<decltype(std::declval<string_type&>() + string_type, y_absl::void_t<decltype(std::declval<string_type&>() .__resize_default_init(237))> > { using HasMember = std::true_type; static void Resize(string_type* s, size_t new_size) { @@ -49,8 +49,8 @@ struct ResizeUninitializedTraits< } }; -// Returns true if the TString implementation supports a resize where -// the new characters added to the TString are left untouched. +// Returns true if the TString implementation supports a resize where +// the new characters added to the TString are left untouched. // // (A better name might be "STLStringSupportsUninitializedResize", alluding to // the previous function.) @@ -62,7 +62,7 @@ inline constexpr bool STLStringSupportsNontrashingResize(string_type*) { // Like str->resize(new_size), except any new characters added to "*str" as a // result of resizing may be left uninitialized, rather than being filled with // '0' bytes. Typically used when code is then going to overwrite the backing -// store of the TString with known data. +// store of the TString with known data. template <typename string_type, typename = void> inline void STLStringResizeUninitialized(string_type* s, size_t new_size) { ResizeUninitializedTraits<string_type>::Resize(s, new_size); @@ -114,6 +114,6 @@ void STLStringResizeUninitializedAmortized(string_type* s, size_t new_size) { } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_RESIZE_UNINITIALIZED_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/stl_type_traits.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/stl_type_traits.h index db8d4635d0..c082ae4443 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/stl_type_traits.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/stl_type_traits.h @@ -18,9 +18,9 @@ // wrappers of STL containers. // // DO NOT INCLUDE THIS FILE DIRECTLY. Use this file by including -// y_absl/strings/str_split.h. +// y_absl/strings/str_split.h. // -// IWYU pragma: private, include "y_absl/strings/str_split.h" +// IWYU pragma: private, include "y_absl/strings/str_split.h" #ifndef ABSL_STRINGS_INTERNAL_STL_TYPE_TRAITS_H_ #define ABSL_STRINGS_INTERNAL_STL_TYPE_TRAITS_H_ @@ -37,9 +37,9 @@ #include <unordered_set> #include <vector> -#include "y_absl/meta/type_traits.h" +#include "y_absl/meta/type_traits.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { @@ -48,25 +48,25 @@ struct IsSpecializationImpl : std::false_type {}; template <template <typename...> class T, typename... Args> struct IsSpecializationImpl<T<Args...>, T> : std::true_type {}; template <typename C, template <typename...> class T> -using IsSpecialization = IsSpecializationImpl<y_absl::decay_t<C>, T>; +using IsSpecialization = IsSpecializationImpl<y_absl::decay_t<C>, T>; template <typename C> struct IsArrayImpl : std::false_type {}; template <template <typename, size_t> class A, typename T, size_t N> struct IsArrayImpl<A<T, N>> : std::is_same<A<T, N>, std::array<T, N>> {}; template <typename C> -using IsArray = IsArrayImpl<y_absl::decay_t<C>>; +using IsArray = IsArrayImpl<y_absl::decay_t<C>>; template <typename C> struct IsBitsetImpl : std::false_type {}; template <template <size_t> class B, size_t N> struct IsBitsetImpl<B<N>> : std::is_same<B<N>, std::bitset<N>> {}; template <typename C> -using IsBitset = IsBitsetImpl<y_absl::decay_t<C>>; +using IsBitset = IsBitsetImpl<y_absl::decay_t<C>>; template <typename C> struct IsSTLContainer - : y_absl::disjunction< + : y_absl::disjunction< IsArray<C>, IsBitset<C>, IsSpecialization<C, std::deque>, IsSpecialization<C, std::forward_list>, IsSpecialization<C, std::list>, IsSpecialization<C, std::map>, @@ -85,20 +85,20 @@ struct IsBaseOfSpecializationImpl : std::false_type {}; // template. template <typename C, template <typename, typename> class T> struct IsBaseOfSpecializationImpl< - C, T, y_absl::void_t<typename C::value_type, typename C::allocator_type>> + C, T, y_absl::void_t<typename C::value_type, typename C::allocator_type>> : std::is_base_of<C, T<typename C::value_type, typename C::allocator_type>> {}; template <typename C, template <typename, typename, typename> class T> struct IsBaseOfSpecializationImpl< C, T, - y_absl::void_t<typename C::key_type, typename C::key_compare, + y_absl::void_t<typename C::key_type, typename C::key_compare, typename C::allocator_type>> : std::is_base_of<C, T<typename C::key_type, typename C::key_compare, typename C::allocator_type>> {}; template <typename C, template <typename, typename, typename, typename> class T> struct IsBaseOfSpecializationImpl< C, T, - y_absl::void_t<typename C::key_type, typename C::mapped_type, + y_absl::void_t<typename C::key_type, typename C::mapped_type, typename C::key_compare, typename C::allocator_type>> : std::is_base_of<C, T<typename C::key_type, typename C::mapped_type, @@ -107,7 +107,7 @@ struct IsBaseOfSpecializationImpl< template <typename C, template <typename, typename, typename, typename> class T> struct IsBaseOfSpecializationImpl< C, T, - y_absl::void_t<typename C::key_type, typename C::hasher, + y_absl::void_t<typename C::key_type, typename C::hasher, typename C::key_equal, typename C::allocator_type>> : std::is_base_of<C, T<typename C::key_type, typename C::hasher, typename C::key_equal, typename C::allocator_type>> { @@ -116,14 +116,14 @@ template <typename C, template <typename, typename, typename, typename, typename> class T> struct IsBaseOfSpecializationImpl< C, T, - y_absl::void_t<typename C::key_type, typename C::mapped_type, + y_absl::void_t<typename C::key_type, typename C::mapped_type, typename C::hasher, typename C::key_equal, typename C::allocator_type>> : std::is_base_of<C, T<typename C::key_type, typename C::mapped_type, typename C::hasher, typename C::key_equal, typename C::allocator_type>> {}; template <typename C, template <typename...> class T> -using IsBaseOfSpecialization = IsBaseOfSpecializationImpl<y_absl::decay_t<C>, T>; +using IsBaseOfSpecialization = IsBaseOfSpecializationImpl<y_absl::decay_t<C>, T>; template <typename C> struct IsBaseOfArrayImpl : std::false_type {}; @@ -131,18 +131,18 @@ template <template <typename, size_t> class A, typename T, size_t N> struct IsBaseOfArrayImpl<A<T, N>> : std::is_base_of<A<T, N>, std::array<T, N>> { }; template <typename C> -using IsBaseOfArray = IsBaseOfArrayImpl<y_absl::decay_t<C>>; +using IsBaseOfArray = IsBaseOfArrayImpl<y_absl::decay_t<C>>; template <typename C> struct IsBaseOfBitsetImpl : std::false_type {}; template <template <size_t> class B, size_t N> struct IsBaseOfBitsetImpl<B<N>> : std::is_base_of<B<N>, std::bitset<N>> {}; template <typename C> -using IsBaseOfBitset = IsBaseOfBitsetImpl<y_absl::decay_t<C>>; +using IsBaseOfBitset = IsBaseOfBitsetImpl<y_absl::decay_t<C>>; template <typename C> struct IsBaseOfSTLContainer - : y_absl::disjunction<IsBaseOfArray<C>, IsBaseOfBitset<C>, + : y_absl::disjunction<IsBaseOfArray<C>, IsBaseOfBitset<C>, IsBaseOfSpecialization<C, std::deque>, IsBaseOfSpecialization<C, std::forward_list>, IsBaseOfSpecialization<C, std::list>, @@ -163,20 +163,20 @@ struct IsConvertibleToSpecializationImpl : std::false_type {}; // STL template. template <typename C, template <typename, typename> class T> struct IsConvertibleToSpecializationImpl< - C, T, y_absl::void_t<typename C::value_type, typename C::allocator_type>> + C, T, y_absl::void_t<typename C::value_type, typename C::allocator_type>> : std::is_convertible< C, T<typename C::value_type, typename C::allocator_type>> {}; template <typename C, template <typename, typename, typename> class T> struct IsConvertibleToSpecializationImpl< C, T, - y_absl::void_t<typename C::key_type, typename C::key_compare, + y_absl::void_t<typename C::key_type, typename C::key_compare, typename C::allocator_type>> : std::is_convertible<C, T<typename C::key_type, typename C::key_compare, typename C::allocator_type>> {}; template <typename C, template <typename, typename, typename, typename> class T> struct IsConvertibleToSpecializationImpl< C, T, - y_absl::void_t<typename C::key_type, typename C::mapped_type, + y_absl::void_t<typename C::key_type, typename C::mapped_type, typename C::key_compare, typename C::allocator_type>> : std::is_convertible< C, T<typename C::key_type, typename C::mapped_type, @@ -184,7 +184,7 @@ struct IsConvertibleToSpecializationImpl< template <typename C, template <typename, typename, typename, typename> class T> struct IsConvertibleToSpecializationImpl< C, T, - y_absl::void_t<typename C::key_type, typename C::hasher, + y_absl::void_t<typename C::key_type, typename C::hasher, typename C::key_equal, typename C::allocator_type>> : std::is_convertible< C, T<typename C::key_type, typename C::hasher, typename C::key_equal, @@ -193,7 +193,7 @@ template <typename C, template <typename, typename, typename, typename, typename> class T> struct IsConvertibleToSpecializationImpl< C, T, - y_absl::void_t<typename C::key_type, typename C::mapped_type, + y_absl::void_t<typename C::key_type, typename C::mapped_type, typename C::hasher, typename C::key_equal, typename C::allocator_type>> : std::is_convertible<C, T<typename C::key_type, typename C::mapped_type, @@ -201,7 +201,7 @@ struct IsConvertibleToSpecializationImpl< typename C::allocator_type>> {}; template <typename C, template <typename...> class T> using IsConvertibleToSpecialization = - IsConvertibleToSpecializationImpl<y_absl::decay_t<C>, T>; + IsConvertibleToSpecializationImpl<y_absl::decay_t<C>, T>; template <typename C> struct IsConvertibleToArrayImpl : std::false_type {}; @@ -209,7 +209,7 @@ template <template <typename, size_t> class A, typename T, size_t N> struct IsConvertibleToArrayImpl<A<T, N>> : std::is_convertible<A<T, N>, std::array<T, N>> {}; template <typename C> -using IsConvertibleToArray = IsConvertibleToArrayImpl<y_absl::decay_t<C>>; +using IsConvertibleToArray = IsConvertibleToArrayImpl<y_absl::decay_t<C>>; template <typename C> struct IsConvertibleToBitsetImpl : std::false_type {}; @@ -217,11 +217,11 @@ template <template <size_t> class B, size_t N> struct IsConvertibleToBitsetImpl<B<N>> : std::is_convertible<B<N>, std::bitset<N>> {}; template <typename C> -using IsConvertibleToBitset = IsConvertibleToBitsetImpl<y_absl::decay_t<C>>; +using IsConvertibleToBitset = IsConvertibleToBitsetImpl<y_absl::decay_t<C>>; template <typename C> struct IsConvertibleToSTLContainer - : y_absl::disjunction< + : y_absl::disjunction< IsConvertibleToArray<C>, IsConvertibleToBitset<C>, IsConvertibleToSpecialization<C, std::deque>, IsConvertibleToSpecialization<C, std::forward_list>, @@ -238,11 +238,11 @@ struct IsConvertibleToSTLContainer template <typename C> struct IsStrictlyBaseOfAndConvertibleToSTLContainer - : y_absl::conjunction<y_absl::negation<IsSTLContainer<C>>, + : y_absl::conjunction<y_absl::negation<IsSTLContainer<C>>, IsBaseOfSTLContainer<C>, IsConvertibleToSTLContainer<C>> {}; } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_STL_TYPE_TRAITS_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/arg.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/arg.cc index 8d5c3b61ac..cc80be14e4 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/arg.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/arg.cc @@ -16,7 +16,7 @@ // POSIX spec: // http://pubs.opengroup.org/onlinepubs/009695399/functions/fprintf.html // -#include "y_absl/strings/internal/str_format/arg.h" +#include "y_absl/strings/internal/str_format/arg.h" #include <cassert> #include <cerrno> @@ -24,11 +24,11 @@ #include <util/generic/string.h> #include <type_traits> -#include "y_absl/base/port.h" -#include "y_absl/strings/internal/str_format/float_conversion.h" +#include "y_absl/base/port.h" +#include "y_absl/strings/internal/str_format/float_conversion.h" #include "y_absl/strings/numbers.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace str_format_internal { namespace { @@ -46,20 +46,20 @@ void ReducePadding(size_t n, size_t *capacity) { template <typename T> struct MakeUnsigned : std::make_unsigned<T> {}; template <> -struct MakeUnsigned<y_absl::int128> { - using type = y_absl::uint128; +struct MakeUnsigned<y_absl::int128> { + using type = y_absl::uint128; }; template <> -struct MakeUnsigned<y_absl::uint128> { - using type = y_absl::uint128; +struct MakeUnsigned<y_absl::uint128> { + using type = y_absl::uint128; }; template <typename T> struct IsSigned : std::is_signed<T> {}; template <> -struct IsSigned<y_absl::int128> : std::true_type {}; +struct IsSigned<y_absl::int128> : std::true_type {}; template <> -struct IsSigned<y_absl::uint128> : std::false_type {}; +struct IsSigned<y_absl::uint128> : std::false_type {}; // Integral digit printer. // Call one of the PrintAs* routines after construction once. @@ -467,12 +467,12 @@ IntegralConvertResult FormatConvertImpl(unsigned long long v, // NOLINT FormatSinkImpl *sink) { return {ConvertIntArg(v, conv, sink)}; } -IntegralConvertResult FormatConvertImpl(y_absl::int128 v, +IntegralConvertResult FormatConvertImpl(y_absl::int128 v, const FormatConversionSpecImpl conv, FormatSinkImpl *sink) { return {ConvertIntArg(v, conv, sink)}; } -IntegralConvertResult FormatConvertImpl(y_absl::uint128 v, +IntegralConvertResult FormatConvertImpl(y_absl::uint128 v, const FormatConversionSpecImpl conv, FormatSinkImpl *sink) { return {ConvertIntArg(v, conv, sink)}; @@ -485,4 +485,4 @@ ABSL_INTERNAL_FORMAT_DISPATCH_OVERLOADS_EXPAND_(); } // namespace str_format_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/arg.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/arg.h index 59b7bcc727..3ea87a3c30 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/arg.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/arg.h @@ -27,13 +27,13 @@ #include <util/stream/str.h> #include <type_traits> -#include "y_absl/base/port.h" -#include "y_absl/meta/type_traits.h" -#include "y_absl/numeric/int128.h" -#include "y_absl/strings/internal/str_format/extension.h" -#include "y_absl/strings/string_view.h" +#include "y_absl/base/port.h" +#include "y_absl/meta/type_traits.h" +#include "y_absl/numeric/int128.h" +#include "y_absl/strings/internal/str_format/extension.h" +#include "y_absl/strings/string_view.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN class Cord; @@ -261,7 +261,7 @@ struct FormatCountCaptureHelper { static ArgConvertResult<FormatConversionCharSetInternal::n> ConvertHelper( const FormatCountCapture& v, FormatConversionSpecImpl conv, FormatSinkImpl* sink) { - const y_absl::enable_if_t<sizeof(T) != 0, FormatCountCapture>& v2 = v; + const y_absl::enable_if_t<sizeof(T) != 0, FormatCountCapture>& v2 = v; if (conv.conversion_char() != str_format_internal::FormatConversionCharInternal::n) { @@ -515,7 +515,7 @@ class FormatArgImpl { ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(double, __VA_ARGS__); \ ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(long double, __VA_ARGS__); \ ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(const char*, __VA_ARGS__); \ - ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(TString, __VA_ARGS__); \ + ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(TString, __VA_ARGS__); \ ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(string_view, __VA_ARGS__) ABSL_INTERNAL_FORMAT_DISPATCH_OVERLOADS_EXPAND_(extern); @@ -523,6 +523,6 @@ ABSL_INTERNAL_FORMAT_DISPATCH_OVERLOADS_EXPAND_(extern); } // namespace str_format_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_STR_FORMAT_ARG_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/bind.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/bind.cc index 211ce25dea..a728a33344 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/bind.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/bind.cc @@ -12,21 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/internal/str_format/bind.h" +#include "y_absl/strings/internal/str_format/bind.h" #include <cerrno> #include <limits> #include <sstream> #include <util/generic/string.h> -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace str_format_internal { namespace { inline bool BindFromPosition(int position, int* value, - y_absl::Span<const FormatArgImpl> pack) { + y_absl::Span<const FormatArgImpl> pack) { assert(position > 0); if (static_cast<size_t>(position) > pack.size()) { return false; @@ -37,7 +37,7 @@ inline bool BindFromPosition(int position, int* value, class ArgContext { public: - explicit ArgContext(y_absl::Span<const FormatArgImpl> pack) : pack_(pack) {} + explicit ArgContext(y_absl::Span<const FormatArgImpl> pack) : pack_(pack) {} // Fill 'bound' with the results of applying the context's argument pack // to the specified 'unbound'. We synthesize a BoundConversion by @@ -48,7 +48,7 @@ class ArgContext { bool Bind(const UnboundConversion* unbound, BoundConversion* bound); private: - y_absl::Span<const FormatArgImpl> pack_; + y_absl::Span<const FormatArgImpl> pack_; }; inline bool ArgContext::Bind(const UnboundConversion* unbound, @@ -102,7 +102,7 @@ inline bool ArgContext::Bind(const UnboundConversion* unbound, template <typename Converter> class ConverterConsumer { public: - ConverterConsumer(Converter converter, y_absl::Span<const FormatArgImpl> pack) + ConverterConsumer(Converter converter, y_absl::Span<const FormatArgImpl> pack) : converter_(converter), arg_context_(pack) {} bool Append(string_view s) { @@ -122,7 +122,7 @@ class ConverterConsumer { template <typename Converter> bool ConvertAll(const UntypedFormatSpecImpl format, - y_absl::Span<const FormatArgImpl> args, Converter converter) { + y_absl::Span<const FormatArgImpl> args, Converter converter) { if (format.has_parsed_conversion()) { return format.parsed_conversion()->ProcessFormat( ConverterConsumer<Converter>(converter, args)); @@ -172,15 +172,15 @@ class SummarizingConverter { } // namespace bool BindWithPack(const UnboundConversion* props, - y_absl::Span<const FormatArgImpl> pack, + y_absl::Span<const FormatArgImpl> pack, BoundConversion* bound) { return ArgContext(pack).Bind(props, bound); } -TString Summarize(const UntypedFormatSpecImpl format, - y_absl::Span<const FormatArgImpl> args) { +TString Summarize(const UntypedFormatSpecImpl format, + y_absl::Span<const FormatArgImpl> args) { typedef SummarizingConverter Converter; - TString out; + TString out; { // inner block to destroy sink before returning out. It ensures a last // flush. @@ -194,7 +194,7 @@ TString Summarize(const UntypedFormatSpecImpl format, bool FormatUntyped(FormatRawSinkImpl raw_sink, const UntypedFormatSpecImpl format, - y_absl::Span<const FormatArgImpl> args) { + y_absl::Span<const FormatArgImpl> args) { FormatSinkImpl sink(raw_sink); using Converter = DefaultConverter; return ConvertAll(format, args, Converter(&sink)); @@ -205,8 +205,8 @@ std::ostream& Streamable::Print(std::ostream& os) const { return os; } -TString& AppendPack(TString* out, const UntypedFormatSpecImpl format, - y_absl::Span<const FormatArgImpl> args) { +TString& AppendPack(TString* out, const UntypedFormatSpecImpl format, + y_absl::Span<const FormatArgImpl> args) { size_t orig = out->size(); if (ABSL_PREDICT_FALSE(!FormatUntyped(out, format, args))) { out->erase(orig); @@ -214,9 +214,9 @@ TString& AppendPack(TString* out, const UntypedFormatSpecImpl format, return *out; } -TString FormatPack(const UntypedFormatSpecImpl format, - y_absl::Span<const FormatArgImpl> args) { - TString out; +TString FormatPack(const UntypedFormatSpecImpl format, + y_absl::Span<const FormatArgImpl> args) { + TString out; if (ABSL_PREDICT_FALSE(!FormatUntyped(&out, format, args))) { out.clear(); } @@ -224,7 +224,7 @@ TString FormatPack(const UntypedFormatSpecImpl format, } int FprintF(std::FILE* output, const UntypedFormatSpecImpl format, - y_absl::Span<const FormatArgImpl> args) { + y_absl::Span<const FormatArgImpl> args) { FILERawSink sink(output); if (!FormatUntyped(&sink, format, args)) { errno = EINVAL; @@ -242,7 +242,7 @@ int FprintF(std::FILE* output, const UntypedFormatSpecImpl format, } int SnprintF(char* output, size_t size, const UntypedFormatSpecImpl format, - y_absl::Span<const FormatArgImpl> args) { + y_absl::Span<const FormatArgImpl> args) { BufferRawSink sink(output, size ? size - 1 : 0); if (!FormatUntyped(&sink, format, args)) { errno = EINVAL; @@ -255,4 +255,4 @@ int SnprintF(char* output, size_t size, const UntypedFormatSpecImpl format, } // namespace str_format_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/bind.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/bind.h index 3966610710..b2e4326b5d 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/bind.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/bind.h @@ -20,13 +20,13 @@ #include <sstream> #include <util/generic/string.h> -#include "y_absl/base/port.h" -#include "y_absl/strings/internal/str_format/arg.h" -#include "y_absl/strings/internal/str_format/checker.h" -#include "y_absl/strings/internal/str_format/parser.h" -#include "y_absl/types/span.h" +#include "y_absl/base/port.h" +#include "y_absl/strings/internal/str_format/arg.h" +#include "y_absl/strings/internal/str_format/checker.h" +#include "y_absl/strings/internal/str_format/parser.h" +#include "y_absl/types/span.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN class UntypedFormatSpec; @@ -145,13 +145,13 @@ class FormatSpecTemplate class Streamable { public: Streamable(const UntypedFormatSpecImpl& format, - y_absl::Span<const FormatArgImpl> args) + y_absl::Span<const FormatArgImpl> args) : format_(format) { if (args.size() <= ABSL_ARRAYSIZE(few_args_)) { for (size_t i = 0; i < args.size(); ++i) { few_args_[i] = args[i]; } - args_ = y_absl::MakeSpan(few_args_, args.size()); + args_ = y_absl::MakeSpan(few_args_, args.size()); } else { many_args_.assign(args.begin(), args.end()); args_ = many_args_; @@ -166,7 +166,7 @@ class Streamable { private: const UntypedFormatSpecImpl& format_; - y_absl::Span<const FormatArgImpl> args_; + y_absl::Span<const FormatArgImpl> args_; // if args_.size() is 4 or less: FormatArgImpl few_args_[4] = {FormatArgImpl(0), FormatArgImpl(0), FormatArgImpl(0), FormatArgImpl(0)}; @@ -175,27 +175,27 @@ class Streamable { }; // for testing -TString Summarize(UntypedFormatSpecImpl format, - y_absl::Span<const FormatArgImpl> args); +TString Summarize(UntypedFormatSpecImpl format, + y_absl::Span<const FormatArgImpl> args); bool BindWithPack(const UnboundConversion* props, - y_absl::Span<const FormatArgImpl> pack, BoundConversion* bound); + y_absl::Span<const FormatArgImpl> pack, BoundConversion* bound); bool FormatUntyped(FormatRawSinkImpl raw_sink, UntypedFormatSpecImpl format, - y_absl::Span<const FormatArgImpl> args); + y_absl::Span<const FormatArgImpl> args); -TString& AppendPack(TString* out, UntypedFormatSpecImpl format, - y_absl::Span<const FormatArgImpl> args); +TString& AppendPack(TString* out, UntypedFormatSpecImpl format, + y_absl::Span<const FormatArgImpl> args); -TString FormatPack(const UntypedFormatSpecImpl format, - y_absl::Span<const FormatArgImpl> args); +TString FormatPack(const UntypedFormatSpecImpl format, + y_absl::Span<const FormatArgImpl> args); int FprintF(std::FILE* output, UntypedFormatSpecImpl format, - y_absl::Span<const FormatArgImpl> args); + y_absl::Span<const FormatArgImpl> args); int SnprintF(char* output, size_t size, UntypedFormatSpecImpl format, - y_absl::Span<const FormatArgImpl> args); + y_absl::Span<const FormatArgImpl> args); -// Returned by Streamed(v). Converts via '%s' to the TString created +// Returned by Streamed(v). Converts via '%s' to the TString created // by std::ostream << v. template <typename T> class StreamedWrapper { @@ -212,6 +212,6 @@ class StreamedWrapper { } // namespace str_format_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_STR_FORMAT_BIND_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/checker.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/checker.h index 7c530d2507..8ec89dd294 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/checker.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/checker.h @@ -16,8 +16,8 @@ #define ABSL_STRINGS_INTERNAL_STR_FORMAT_CHECKER_H_ #include "y_absl/base/attributes.h" -#include "y_absl/strings/internal/str_format/arg.h" -#include "y_absl/strings/internal/str_format/extension.h" +#include "y_absl/strings/internal/str_format/arg.h" +#include "y_absl/strings/internal/str_format/extension.h" // Compile time check support for entry points. @@ -27,7 +27,7 @@ #endif // ABSL_HAVE_ATTRIBUTE(enable_if) && !defined(__native_client__) #endif // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace str_format_internal { @@ -328,6 +328,6 @@ constexpr bool ValidFormatImpl(string_view format) { } // namespace str_format_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_STR_FORMAT_CHECKER_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/extension.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/extension.cc index f2a4169ae7..efc93c046c 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/extension.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/extension.cc @@ -13,18 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/internal/str_format/extension.h" +#include "y_absl/strings/internal/str_format/extension.h" #include <errno.h> #include <algorithm> #include <util/generic/string.h> -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace str_format_internal { TString FlagsToString(Flags v) { - TString s; + TString s; s.append(FlagsContains(v, Flags::kLeft) ? "-" : ""); s.append(FlagsContains(v, Flags::kShowPos) ? "+" : ""); s.append(FlagsContains(v, Flags::kSignCol) ? " " : ""); @@ -72,4 +72,4 @@ bool FormatSinkImpl::PutPaddedString(string_view value, int width, } // namespace str_format_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/extension.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/extension.h index e5de5cb6a1..02697a1324 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/extension.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/extension.h @@ -23,12 +23,12 @@ #include <ostream> #include "y_absl/base/config.h" -#include "y_absl/base/port.h" +#include "y_absl/base/port.h" #include "y_absl/meta/type_traits.h" -#include "y_absl/strings/internal/str_format/output.h" -#include "y_absl/strings/string_view.h" +#include "y_absl/strings/internal/str_format/output.h" +#include "y_absl/strings/string_view.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN enum class FormatConversionChar : uint8_t; @@ -440,6 +440,6 @@ inline size_t Excess(size_t used, size_t capacity) { } // namespace str_format_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_STR_FORMAT_EXTENSION_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/float_conversion.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/float_conversion.cc index c49062538d..c56af14d5c 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/float_conversion.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/float_conversion.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/internal/str_format/float_conversion.h" +#include "y_absl/strings/internal/str_format/float_conversion.h" #include <string.h> @@ -23,7 +23,7 @@ #include <util/generic/string.h> #include "y_absl/base/attributes.h" -#include "y_absl/base/config.h" +#include "y_absl/base/config.h" #include "y_absl/base/optimization.h" #include "y_absl/functional/function_ref.h" #include "y_absl/meta/type_traits.h" @@ -34,7 +34,7 @@ #include "y_absl/types/optional.h" #include "y_absl/types/span.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace str_format_internal { @@ -955,7 +955,7 @@ bool FallbackToSnprintf(const Float v, const FormatConversionSpecImpl &conv, *fp = 0; assert(fp < fmt + sizeof(fmt)); } - TString space(512, '\0'); + TString space(512, '\0'); y_absl::string_view result; while (true) { int n = snprintf(&space[0], space.size(), fmt, w, p, v); @@ -1420,4 +1420,4 @@ bool ConvertFloatImpl(double v, const FormatConversionSpecImpl &conv, } // namespace str_format_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/float_conversion.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/float_conversion.h index d93a415756..78c57edf1b 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/float_conversion.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/float_conversion.h @@ -15,9 +15,9 @@ #ifndef ABSL_STRINGS_INTERNAL_STR_FORMAT_FLOAT_CONVERSION_H_ #define ABSL_STRINGS_INTERNAL_STR_FORMAT_FLOAT_CONVERSION_H_ -#include "y_absl/strings/internal/str_format/extension.h" +#include "y_absl/strings/internal/str_format/extension.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace str_format_internal { @@ -32,6 +32,6 @@ bool ConvertFloatImpl(long double v, const FormatConversionSpecImpl &conv, } // namespace str_format_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_STR_FORMAT_FLOAT_CONVERSION_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/output.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/output.cc index ade3f67ef2..cbe31f2d94 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/output.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/output.cc @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/internal/str_format/output.h" +#include "y_absl/strings/internal/str_format/output.h" #include <errno.h> #include <cstring> -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace str_format_internal { @@ -69,4 +69,4 @@ void FILERawSink::Write(string_view v) { } // namespace str_format_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/output.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/output.h index 8fc46fbafa..5ff7c5435a 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/output.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/output.h @@ -25,8 +25,8 @@ #include <ostream> #include <util/generic/string.h> -#include "y_absl/base/port.h" -#include "y_absl/strings/string_view.h" +#include "y_absl/base/port.h" +#include "y_absl/strings/string_view.h" namespace y_absl { ABSL_NAMESPACE_BEGIN @@ -67,7 +67,7 @@ class FILERawSink { }; // Provide RawSink integration with common types from the STL. -inline void AbslFormatFlush(TString* out, string_view s) { +inline void AbslFormatFlush(TString* out, string_view s) { out->append(s.data(), s.size()); } inline void AbslFormatFlush(std::ostream* out, string_view s) { @@ -91,6 +91,6 @@ auto InvokeFlush(T* out, string_view s) -> decltype(AbslFormatFlush(out, s)) { } // namespace str_format_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_STR_FORMAT_OUTPUT_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/parser.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/parser.cc index af07e32fe5..56e52a214c 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/parser.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/parser.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/internal/str_format/parser.h" +#include "y_absl/strings/internal/str_format/parser.h" #include <assert.h> #include <string.h> @@ -27,7 +27,7 @@ #include <util/generic/string.h> #include <unordered_set> -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace str_format_internal { @@ -336,4 +336,4 @@ bool ParsedFormatBase::MatchesConversions( } // namespace str_format_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/parser.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/parser.h index ba614bb8b4..e8beb3c5e7 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/parser.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/parser.h @@ -28,10 +28,10 @@ #include <util/generic/string.h> #include <vector> -#include "y_absl/strings/internal/str_format/checker.h" -#include "y_absl/strings/internal/str_format/extension.h" +#include "y_absl/strings/internal/str_format/checker.h" +#include "y_absl/strings/internal/str_format/extension.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace str_format_internal { @@ -352,6 +352,6 @@ class ExtendedParsedFormat : public str_format_internal::ParsedFormatBase { }; } // namespace str_format_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_STR_FORMAT_PARSER_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/ya.make b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/ya.make index ff8069cd0f..2cf0a66cd3 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/ya.make +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_format/ya.make @@ -12,13 +12,13 @@ LICENSE(Apache-2.0) LICENSE_TEXTS(.yandex_meta/licenses.list.txt) PEERDIR( - contrib/restricted/abseil-cpp-tstring/y_absl/base - contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/raw_logging - contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/spinlock_wait - contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/throw_delegate - contrib/restricted/abseil-cpp-tstring/y_absl/base/log_severity - contrib/restricted/abseil-cpp-tstring/y_absl/numeric - contrib/restricted/abseil-cpp-tstring/y_absl/strings + contrib/restricted/abseil-cpp-tstring/y_absl/base + contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/raw_logging + contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/spinlock_wait + contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/throw_delegate + contrib/restricted/abseil-cpp-tstring/y_absl/base/log_severity + contrib/restricted/abseil-cpp-tstring/y_absl/numeric + contrib/restricted/abseil-cpp-tstring/y_absl/strings contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/absl_strings_internal ) diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_join_internal.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_join_internal.h index 0a220fa33d..33f875c913 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_join_internal.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_join_internal.h @@ -24,9 +24,9 @@ // - JoinTuple() // // DO NOT INCLUDE THIS FILE DIRECTLY. Use this file by including -// y_absl/strings/str_join.h +// y_absl/strings/str_join.h // -// IWYU pragma: private, include "y_absl/strings/str_join.h" +// IWYU pragma: private, include "y_absl/strings/str_join.h" #ifndef ABSL_STRINGS_INTERNAL_STR_JOIN_INTERNAL_H_ #define ABSL_STRINGS_INTERNAL_STR_JOIN_INTERNAL_H_ @@ -38,11 +38,11 @@ #include <type_traits> #include <utility> -#include "y_absl/strings/internal/ostringstream.h" -#include "y_absl/strings/internal/resize_uninitialized.h" -#include "y_absl/strings/str_cat.h" +#include "y_absl/strings/internal/ostringstream.h" +#include "y_absl/strings/internal/resize_uninitialized.h" +#include "y_absl/strings/str_cat.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { @@ -59,11 +59,11 @@ struct AlphaNumFormatterImpl { // This template is needed in order to support passing in a dereferenced // vector<bool>::iterator template <typename T> - void operator()(TString* out, const T& t) const { + void operator()(TString* out, const T& t) const { StrAppend(out, AlphaNum(t)); } - void operator()(TString* out, const AlphaNum& t) const { + void operator()(TString* out, const AlphaNum& t) const { StrAppend(out, t); } }; @@ -80,7 +80,7 @@ class StreamFormatterImpl { // The method isn't const because it mutates state. Making it const will // render StreamFormatterImpl thread-hostile. template <typename T> - void operator()(TString* out, const T& t) { + void operator()(TString* out, const T& t) { // The stream is created lazily to avoid paying the relatively high cost // of its construction when joining an empty range. if (strm_) { @@ -101,18 +101,18 @@ class StreamFormatterImpl { template <typename F1, typename F2> class PairFormatterImpl { public: - PairFormatterImpl(F1 f1, y_absl::string_view sep, F2 f2) + PairFormatterImpl(F1 f1, y_absl::string_view sep, F2 f2) : f1_(std::move(f1)), sep_(sep), f2_(std::move(f2)) {} template <typename T> - void operator()(TString* out, const T& p) { + void operator()(TString* out, const T& p) { f1_(out, p.first); out->append(sep_); f2_(out, p.second); } template <typename T> - void operator()(TString* out, const T& p) const { + void operator()(TString* out, const T& p) const { f1_(out, p.first); out->append(sep_); f2_(out, p.second); @@ -120,7 +120,7 @@ class PairFormatterImpl { private: F1 f1_; - TString sep_; + TString sep_; F2 f2_; }; @@ -135,12 +135,12 @@ class DereferenceFormatterImpl { : f_(std::forward<Formatter>(f)) {} template <typename T> - void operator()(TString* out, const T& t) { + void operator()(TString* out, const T& t) { f_(out, *t); } template <typename T> - void operator()(TString* out, const T& t) const { + void operator()(TString* out, const T& t) const { f_(out, *t); } @@ -168,11 +168,11 @@ struct DefaultFormatter<char*> { typedef AlphaNumFormatterImpl Type; }; template <> -struct DefaultFormatter<TString> { +struct DefaultFormatter<TString> { typedef NoFormatter Type; }; template <> -struct DefaultFormatter<y_absl::string_view> { +struct DefaultFormatter<y_absl::string_view> { typedef NoFormatter Type; }; template <typename ValueType> @@ -193,10 +193,10 @@ struct DefaultFormatter<std::unique_ptr<ValueType>> // iterator range, each separated by the given separator, into an output string, // and formats each element using the provided Formatter object. template <typename Iterator, typename Formatter> -TString JoinAlgorithm(Iterator start, Iterator end, y_absl::string_view s, +TString JoinAlgorithm(Iterator start, Iterator end, y_absl::string_view s, Formatter&& f) { - TString result; - y_absl::string_view sep(""); + TString result; + y_absl::string_view sep(""); for (Iterator it = start; it != end; ++it) { result.append(sep.data(), sep.size()); f(&result, *it); @@ -208,12 +208,12 @@ TString JoinAlgorithm(Iterator start, Iterator end, y_absl::string_view s, // A joining algorithm that's optimized for a forward iterator range of // string-like objects that do not need any additional formatting. This is to // optimize the common case of joining, say, a std::vector<string> or a -// std::vector<y_absl::string_view>. +// std::vector<y_absl::string_view>. // // This is an overload of the previous JoinAlgorithm() function. Here the // Formatter argument is of type NoFormatter. Since NoFormatter is an internal // type, this overload is only invoked when strings::Join() is called with a -// range of string-like objects (e.g., TString, y_absl::string_view), and an +// range of string-like objects (e.g., TString, y_absl::string_view), and an // explicit Formatter argument was NOT specified. // // The optimization is that the needed space will be reserved in the output @@ -224,9 +224,9 @@ template <typename Iterator, typename = typename std::enable_if<std::is_convertible< typename std::iterator_traits<Iterator>::iterator_category, std::forward_iterator_tag>::value>::type> -TString JoinAlgorithm(Iterator start, Iterator end, y_absl::string_view s, +TString JoinAlgorithm(Iterator start, Iterator end, y_absl::string_view s, NoFormatter) { - TString result; + TString result; if (start != end) { // Sums size size_t result_size = start->size(); @@ -262,7 +262,7 @@ TString JoinAlgorithm(Iterator start, Iterator end, y_absl::string_view s, template <size_t I, size_t N> struct JoinTupleLoop { template <typename Tup, typename Formatter> - void operator()(TString* out, const Tup& tup, y_absl::string_view sep, + void operator()(TString* out, const Tup& tup, y_absl::string_view sep, Formatter&& fmt) { if (I > 0) out->append(sep.data(), sep.size()); fmt(out, std::get<I>(tup)); @@ -272,20 +272,20 @@ struct JoinTupleLoop { template <size_t N> struct JoinTupleLoop<N, N> { template <typename Tup, typename Formatter> - void operator()(TString*, const Tup&, y_absl::string_view, Formatter&&) {} + void operator()(TString*, const Tup&, y_absl::string_view, Formatter&&) {} }; template <typename... T, typename Formatter> -TString JoinAlgorithm(const std::tuple<T...>& tup, y_absl::string_view sep, +TString JoinAlgorithm(const std::tuple<T...>& tup, y_absl::string_view sep, Formatter&& fmt) { - TString result; + TString result; JoinTupleLoop<0, sizeof...(T)>()(&result, tup, sep, fmt); return result; } template <typename Iterator> -TString JoinRange(Iterator first, Iterator last, - y_absl::string_view separator) { +TString JoinRange(Iterator first, Iterator last, + y_absl::string_view separator) { // No formatter was explicitly given, so a default must be chosen. typedef typename std::iterator_traits<Iterator>::value_type ValueType; typedef typename DefaultFormatter<ValueType>::Type Formatter; @@ -293,7 +293,7 @@ TString JoinRange(Iterator first, Iterator last, } template <typename Range, typename Formatter> -TString JoinRange(const Range& range, y_absl::string_view separator, +TString JoinRange(const Range& range, y_absl::string_view separator, Formatter&& fmt) { using std::begin; using std::end; @@ -301,7 +301,7 @@ TString JoinRange(const Range& range, y_absl::string_view separator, } template <typename Range> -TString JoinRange(const Range& range, y_absl::string_view separator) { +TString JoinRange(const Range& range, y_absl::string_view separator) { using std::begin; using std::end; return JoinRange(begin(range), end(range), separator); @@ -309,6 +309,6 @@ TString JoinRange(const Range& range, y_absl::string_view separator) { } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_STR_JOIN_INTERNAL_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_split_internal.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_split_internal.h index 237864c0ed..0f787b1bdc 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_split_internal.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/str_split_internal.h @@ -22,9 +22,9 @@ // - Splitter<> // // DO NOT INCLUDE THIS FILE DIRECTLY. Use this file by including -// y_absl/strings/str_split.h. +// y_absl/strings/str_split.h. // -// IWYU pragma: private, include "y_absl/strings/str_split.h" +// IWYU pragma: private, include "y_absl/strings/str_split.h" #ifndef ABSL_STRINGS_INTERNAL_STR_SPLIT_INTERNAL_H_ #define ABSL_STRINGS_INTERNAL_STR_SPLIT_INTERNAL_H_ @@ -37,20 +37,20 @@ #include <utility> #include <vector> -#include "y_absl/base/macros.h" -#include "y_absl/base/port.h" -#include "y_absl/meta/type_traits.h" -#include "y_absl/strings/string_view.h" +#include "y_absl/base/macros.h" +#include "y_absl/base/port.h" +#include "y_absl/meta/type_traits.h" +#include "y_absl/strings/string_view.h" #ifdef _GLIBCXX_DEBUG -#include "y_absl/strings/internal/stl_type_traits.h" +#include "y_absl/strings/internal/stl_type_traits.h" #endif // _GLIBCXX_DEBUG -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { -// This class is implicitly constructible from everything that y_absl::string_view +// This class is implicitly constructible from everything that y_absl::string_view // is implicitly constructible from, except for rvalue strings. This means it // can be used as a function parameter in places where passing a temporary // string might cause memory lifetime issues. @@ -59,19 +59,19 @@ class ConvertibleToStringView { ConvertibleToStringView(const char* s) // NOLINT(runtime/explicit) : value_(s) {} ConvertibleToStringView(char* s) : value_(s) {} // NOLINT(runtime/explicit) - ConvertibleToStringView(y_absl::string_view s) // NOLINT(runtime/explicit) + ConvertibleToStringView(y_absl::string_view s) // NOLINT(runtime/explicit) : value_(s) {} - ConvertibleToStringView(const TString& s) // NOLINT(runtime/explicit) + ConvertibleToStringView(const TString& s) // NOLINT(runtime/explicit) : value_(s) {} // Disable conversion from rvalue strings. ConvertibleToStringView(TString&& s) = delete; ConvertibleToStringView(const TString&& s) = delete; - y_absl::string_view value() const { return value_; } + y_absl::string_view value() const { return value_; } private: - y_absl::string_view value_; + y_absl::string_view value_; }; // An iterator that enumerates the parts of a string from a Splitter. The text @@ -84,7 +84,7 @@ template <typename Splitter> class SplitIterator { public: using iterator_category = std::input_iterator_tag; - using value_type = y_absl::string_view; + using value_type = y_absl::string_view; using difference_type = ptrdiff_t; using pointer = const value_type*; using reference = const value_type&; @@ -97,14 +97,14 @@ class SplitIterator { delimiter_(splitter->delimiter()), predicate_(splitter->predicate()) { // Hack to maintain backward compatibility. This one block makes it so an - // empty y_absl::string_view whose .data() happens to be nullptr behaves - // *differently* from an otherwise empty y_absl::string_view whose .data() is + // empty y_absl::string_view whose .data() happens to be nullptr behaves + // *differently* from an otherwise empty y_absl::string_view whose .data() is // not nullptr. This is an undesirable difference in general, but this // behavior is maintained to avoid breaking existing code that happens to // depend on this old behavior/bug. Perhaps it will be fixed one day. The // difference in behavior is as follows: - // Split(y_absl::string_view(""), '-'); // {""} - // Split(y_absl::string_view(), '-'); // {} + // Split(y_absl::string_view(""), '-'); // {""} + // Split(y_absl::string_view(), '-'); // {} if (splitter_->text().data() == nullptr) { state_ = kEndState; pos_ = splitter_->text().size(); @@ -129,8 +129,8 @@ class SplitIterator { state_ = kEndState; return *this; } - const y_absl::string_view text = splitter_->text(); - const y_absl::string_view d = delimiter_.Find(text, pos_); + const y_absl::string_view text = splitter_->text(); + const y_absl::string_view d = delimiter_.Find(text, pos_); if (d.data() == text.data() + text.size()) state_ = kLastState; curr_ = text.substr(pos_, d.data() - (text.data() + pos_)); pos_ += curr_.size() + d.size(); @@ -155,7 +155,7 @@ class SplitIterator { private: size_t pos_; State state_; - y_absl::string_view curr_; + y_absl::string_view curr_; const Splitter* splitter_; typename Splitter::DelimiterType delimiter_; typename Splitter::PredicateType predicate_; @@ -165,21 +165,21 @@ class SplitIterator { template <typename T, typename = void> struct HasMappedType : std::false_type {}; template <typename T> -struct HasMappedType<T, y_absl::void_t<typename T::mapped_type>> +struct HasMappedType<T, y_absl::void_t<typename T::mapped_type>> : std::true_type {}; // HasValueType<T>::value is true iff there exists a type T::value_type. template <typename T, typename = void> struct HasValueType : std::false_type {}; template <typename T> -struct HasValueType<T, y_absl::void_t<typename T::value_type>> : std::true_type { +struct HasValueType<T, y_absl::void_t<typename T::value_type>> : std::true_type { }; // HasConstIterator<T>::value is true iff there exists a type T::const_iterator. template <typename T, typename = void> struct HasConstIterator : std::false_type {}; template <typename T> -struct HasConstIterator<T, y_absl::void_t<typename T::const_iterator>> +struct HasConstIterator<T, y_absl::void_t<typename T::const_iterator>> : std::true_type {}; // HasEmplace<T>::value is true iff there exists a method T::emplace(). @@ -213,13 +213,13 @@ struct SplitterIsConvertibleToImpl : std::false_type {}; template <typename C> struct SplitterIsConvertibleToImpl<C, true, false> - : std::is_constructible<typename C::value_type, y_absl::string_view> {}; + : std::is_constructible<typename C::value_type, y_absl::string_view> {}; template <typename C> struct SplitterIsConvertibleToImpl<C, true, true> - : y_absl::conjunction< - std::is_constructible<typename C::key_type, y_absl::string_view>, - std::is_constructible<typename C::mapped_type, y_absl::string_view>> {}; + : y_absl::conjunction< + std::is_constructible<typename C::key_type, y_absl::string_view>, + std::is_constructible<typename C::mapped_type, y_absl::string_view>> {}; template <typename C> struct SplitterIsConvertibleTo @@ -234,7 +234,7 @@ struct SplitterIsConvertibleTo HasMappedType<C>::value> { }; -// This class implements the range that is returned by y_absl::StrSplit(). This +// This class implements the range that is returned by y_absl::StrSplit(). This // class has templated conversion operators that allow it to be implicitly // converted to a variety of types that the caller may have specified on the // left-hand side of an assignment. @@ -245,11 +245,11 @@ struct SplitterIsConvertibleTo // within a range-for loop. // // Output containers can be collections of any type that is constructible from -// an y_absl::string_view. +// an y_absl::string_view. // // An Predicate functor may be supplied. This predicate will be used to filter // the split strings: only strings for which the predicate returns true will be -// kept. A Predicate object is any unary functor that takes an y_absl::string_view +// kept. A Predicate object is any unary functor that takes an y_absl::string_view // and returns bool. // // The StringType parameter can be either string_view or string, depending on @@ -272,7 +272,7 @@ class Splitter { const Delimiter& delimiter() const { return delimiter_; } const Predicate& predicate() const { return predicate_; } - // Range functions that iterate the split substrings as y_absl::string_view + // Range functions that iterate the split substrings as y_absl::string_view // objects. These methods enable a Splitter to be used in a range-based for // loop. const_iterator begin() const { return {const_iterator::kInitState, this}; } @@ -294,7 +294,7 @@ class Splitter { // corresponding value. template <typename First, typename Second> operator std::pair<First, Second>() const { // NOLINT(runtime/explicit) - y_absl::string_view first, second; + y_absl::string_view first, second; auto it = begin(); if (it != end()) { first = *it; @@ -325,24 +325,24 @@ class Splitter { } }; - // Partial specialization for a std::vector<y_absl::string_view>. + // Partial specialization for a std::vector<y_absl::string_view>. // // Optimized for the common case of splitting to a - // std::vector<y_absl::string_view>. In this case we first split the results to - // a small array of y_absl::string_view on the stack, to reduce reallocations. + // std::vector<y_absl::string_view>. In this case we first split the results to + // a small array of y_absl::string_view on the stack, to reduce reallocations. template <typename A> - struct ConvertToContainer<std::vector<y_absl::string_view, A>, - y_absl::string_view, false> { - std::vector<y_absl::string_view, A> operator()( + struct ConvertToContainer<std::vector<y_absl::string_view, A>, + y_absl::string_view, false> { + std::vector<y_absl::string_view, A> operator()( const Splitter& splitter) const { struct raw_view { const char* data; size_t size; - operator y_absl::string_view() const { // NOLINT(runtime/explicit) + operator y_absl::string_view() const { // NOLINT(runtime/explicit) return {data, size}; } }; - std::vector<y_absl::string_view, A> v; + std::vector<y_absl::string_view, A> v; std::array<raw_view, 16> ar; for (auto it = splitter.begin(); !it.at_end();) { size_t index = 0; @@ -357,17 +357,17 @@ class Splitter { } }; - // Partial specialization for a std::vector<TString>. + // Partial specialization for a std::vector<TString>. // - // Optimized for the common case of splitting to a std::vector<TString>. - // In this case we first split the results to a std::vector<y_absl::string_view> - // so the returned std::vector<TString> can have space reserved to avoid - // TString moves. + // Optimized for the common case of splitting to a std::vector<TString>. + // In this case we first split the results to a std::vector<y_absl::string_view> + // so the returned std::vector<TString> can have space reserved to avoid + // TString moves. template <typename A> - struct ConvertToContainer<std::vector<TString, A>, TString, false> { - std::vector<TString, A> operator()(const Splitter& splitter) const { - const std::vector<y_absl::string_view> v = splitter; - return std::vector<TString, A>(v.begin(), v.end()); + struct ConvertToContainer<std::vector<TString, A>, TString, false> { + std::vector<TString, A> operator()(const Splitter& splitter) const { + const std::vector<y_absl::string_view> v = splitter; + return std::vector<TString, A>(v.begin(), v.end()); } }; @@ -425,6 +425,6 @@ class Splitter { } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_STR_SPLIT_INTERNAL_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/utf8.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/utf8.cc index 06b1cae79d..a33b67d1a8 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/utf8.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/utf8.cc @@ -14,9 +14,9 @@ // UTF8 utilities, implemented to reduce dependencies. -#include "y_absl/strings/internal/utf8.h" +#include "y_absl/strings/internal/utf8.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { @@ -50,4 +50,4 @@ size_t EncodeUTF8Char(char *buffer, char32_t utf8_char) { } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/utf8.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/utf8.h index 1b2d6abd51..e51e407a5a 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/utf8.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/utf8.h @@ -22,7 +22,7 @@ #include "y_absl/base/config.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { @@ -45,6 +45,6 @@ size_t EncodeUTF8Char(char *buffer, char32_t utf8_char); } // namespace strings_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_INTERNAL_UTF8_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/match.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/match.cc index 3197bdf432..c84ac9ce47 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/match.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/match.cc @@ -12,19 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/match.h" +#include "y_absl/strings/match.h" -#include "y_absl/strings/internal/memutil.h" +#include "y_absl/strings/internal/memutil.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN bool EqualsIgnoreCase(y_absl::string_view piece1, y_absl::string_view piece2) noexcept { return (piece1.size() == piece2.size() && - 0 == y_absl::strings_internal::memcasecmp(piece1.data(), piece2.data(), + 0 == y_absl::strings_internal::memcasecmp(piece1.data(), piece2.data(), piece1.size())); - // memcasecmp uses y_absl::ascii_tolower(). + // memcasecmp uses y_absl::ascii_tolower(). } bool StartsWithIgnoreCase(y_absl::string_view text, @@ -40,4 +40,4 @@ bool EndsWithIgnoreCase(y_absl::string_view text, } ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/match.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/match.h index 4709abc93f..133eae9c63 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/match.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/match.h @@ -18,26 +18,26 @@ // ----------------------------------------------------------------------------- // // This file contains simple utilities for performing string matching checks. -// All of these function parameters are specified as `y_absl::string_view`, -// meaning that these functions can accept `TString`, `y_absl::string_view` or +// All of these function parameters are specified as `y_absl::string_view`, +// meaning that these functions can accept `TString`, `y_absl::string_view` or // NUL-terminated C-style strings. // // Examples: -// TString s = "foo"; -// y_absl::string_view sv = "f"; -// assert(y_absl::StrContains(s, sv)); +// TString s = "foo"; +// y_absl::string_view sv = "f"; +// assert(y_absl::StrContains(s, sv)); // // Note: The order of parameters in these functions is designed to mimic the // order an equivalent member function would exhibit; -// e.g. `s.Contains(x)` ==> `y_absl::StrContains(s, x). +// e.g. `s.Contains(x)` ==> `y_absl::StrContains(s, x). #ifndef ABSL_STRINGS_MATCH_H_ #define ABSL_STRINGS_MATCH_H_ #include <cstring> -#include "y_absl/strings/string_view.h" +#include "y_absl/strings/string_view.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN // StrContains() @@ -95,6 +95,6 @@ bool EndsWithIgnoreCase(y_absl::string_view text, y_absl::string_view suffix) noexcept; ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_MATCH_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/numbers.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/numbers.cc index 528d044fa6..30db79a678 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/numbers.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/numbers.cc @@ -15,7 +15,7 @@ // This file contains string processing functions related to // numeric values. -#include "y_absl/strings/numbers.h" +#include "y_absl/strings/numbers.h" #include <algorithm> #include <cassert> @@ -31,19 +31,19 @@ #include <utility> #include "y_absl/base/attributes.h" -#include "y_absl/base/internal/raw_logging.h" +#include "y_absl/base/internal/raw_logging.h" #include "y_absl/numeric/bits.h" -#include "y_absl/strings/ascii.h" -#include "y_absl/strings/charconv.h" -#include "y_absl/strings/escaping.h" -#include "y_absl/strings/internal/memutil.h" -#include "y_absl/strings/match.h" -#include "y_absl/strings/str_cat.h" - -namespace y_absl { +#include "y_absl/strings/ascii.h" +#include "y_absl/strings/charconv.h" +#include "y_absl/strings/escaping.h" +#include "y_absl/strings/internal/memutil.h" +#include "y_absl/strings/match.h" +#include "y_absl/strings/str_cat.h" + +namespace y_absl { ABSL_NAMESPACE_BEGIN -bool SimpleAtof(y_absl::string_view str, float* out) { +bool SimpleAtof(y_absl::string_view str, float* out) { *out = 0.0; str = StripAsciiWhitespace(str); // std::from_chars doesn't accept an initial +, but SimpleAtof does, so if one @@ -54,7 +54,7 @@ bool SimpleAtof(y_absl::string_view str, float* out) { return false; } } - auto result = y_absl::from_chars(str.data(), str.data() + str.size(), *out); + auto result = y_absl::from_chars(str.data(), str.data() + str.size(), *out); if (result.ec == std::errc::invalid_argument) { return false; } @@ -74,7 +74,7 @@ bool SimpleAtof(y_absl::string_view str, float* out) { return true; } -bool SimpleAtod(y_absl::string_view str, double* out) { +bool SimpleAtod(y_absl::string_view str, double* out) { *out = 0.0; str = StripAsciiWhitespace(str); // std::from_chars doesn't accept an initial +, but SimpleAtod does, so if one @@ -85,7 +85,7 @@ bool SimpleAtod(y_absl::string_view str, double* out) { return false; } } - auto result = y_absl::from_chars(str.data(), str.data() + str.size(), *out); + auto result = y_absl::from_chars(str.data(), str.data() + str.size(), *out); if (result.ec == std::errc::invalid_argument) { return false; } @@ -105,7 +105,7 @@ bool SimpleAtod(y_absl::string_view str, double* out) { return true; } -bool SimpleAtob(y_absl::string_view str, bool* out) { +bool SimpleAtob(y_absl::string_view str, bool* out) { ABSL_RAW_CHECK(out != nullptr, "Output pointer must not be nullptr."); if (EqualsIgnoreCase(str, "true") || EqualsIgnoreCase(str, "t") || EqualsIgnoreCase(str, "yes") || EqualsIgnoreCase(str, "y") || @@ -630,7 +630,7 @@ static const int8_t kAsciiToInt[256] = { 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36}; // Parse the sign and optional hex or oct prefix in text. -inline bool safe_parse_sign_and_base(y_absl::string_view* text /*inout*/, +inline bool safe_parse_sign_and_base(y_absl::string_view* text /*inout*/, int* base_ptr /*inout*/, bool* negative_ptr /*output*/) { if (text->data() == nullptr) { @@ -642,10 +642,10 @@ inline bool safe_parse_sign_and_base(y_absl::string_view* text /*inout*/, int base = *base_ptr; // Consume whitespace. - while (start < end && y_absl::ascii_isspace(start[0])) { + while (start < end && y_absl::ascii_isspace(start[0])) { ++start; } - while (start < end && y_absl::ascii_isspace(end[-1])) { + while (start < end && y_absl::ascii_isspace(end[-1])) { --end; } if (start >= end) { @@ -694,7 +694,7 @@ inline bool safe_parse_sign_and_base(y_absl::string_view* text /*inout*/, } else { return false; } - *text = y_absl::string_view(start, end - start); + *text = y_absl::string_view(start, end - start); *base_ptr = base; return true; } @@ -914,7 +914,7 @@ const IntType LookupTables<IntType>::kVminOverBase[] = #undef X_OVER_BASE_INITIALIZER template <typename IntType> -inline bool safe_parse_positive_int(y_absl::string_view text, int base, +inline bool safe_parse_positive_int(y_absl::string_view text, int base, IntType* value_p) { IntType value = 0; const IntType vmax = std::numeric_limits<IntType>::max(); @@ -950,7 +950,7 @@ inline bool safe_parse_positive_int(y_absl::string_view text, int base, } template <typename IntType> -inline bool safe_parse_negative_int(y_absl::string_view text, int base, +inline bool safe_parse_negative_int(y_absl::string_view text, int base, IntType* value_p) { IntType value = 0; const IntType vmin = std::numeric_limits<IntType>::min(); @@ -995,7 +995,7 @@ inline bool safe_parse_negative_int(y_absl::string_view text, int base, // Input format based on POSIX.1-2008 strtol // http://pubs.opengroup.org/onlinepubs/9699919799/functions/strtol.html template <typename IntType> -inline bool safe_int_internal(y_absl::string_view text, IntType* value_p, +inline bool safe_int_internal(y_absl::string_view text, IntType* value_p, int base) { *value_p = 0; bool negative; @@ -1010,7 +1010,7 @@ inline bool safe_int_internal(y_absl::string_view text, IntType* value_p, } template <typename IntType> -inline bool safe_uint_internal(y_absl::string_view text, IntType* value_p, +inline bool safe_uint_internal(y_absl::string_view text, IntType* value_p, int base) { *value_p = 0; bool negative; @@ -1064,11 +1064,11 @@ ABSL_CONST_INIT ABSL_DLL const char two_ASCII_digits[100][2] = { {'9', '0'}, {'9', '1'}, {'9', '2'}, {'9', '3'}, {'9', '4'}, {'9', '5'}, {'9', '6'}, {'9', '7'}, {'9', '8'}, {'9', '9'}}; -bool safe_strto32_base(y_absl::string_view text, int32_t* value, int base) { +bool safe_strto32_base(y_absl::string_view text, int32_t* value, int base) { return safe_int_internal<int32_t>(text, value, base); } -bool safe_strto64_base(y_absl::string_view text, int64_t* value, int base) { +bool safe_strto64_base(y_absl::string_view text, int64_t* value, int base) { return safe_int_internal<int64_t>(text, value, base); } @@ -1076,18 +1076,18 @@ bool safe_strto128_base(y_absl::string_view text, int128* value, int base) { return safe_int_internal<y_absl::int128>(text, value, base); } -bool safe_strtou32_base(y_absl::string_view text, uint32_t* value, int base) { +bool safe_strtou32_base(y_absl::string_view text, uint32_t* value, int base) { return safe_uint_internal<uint32_t>(text, value, base); } -bool safe_strtou64_base(y_absl::string_view text, uint64_t* value, int base) { +bool safe_strtou64_base(y_absl::string_view text, uint64_t* value, int base) { return safe_uint_internal<uint64_t>(text, value, base); } -bool safe_strtou128_base(y_absl::string_view text, uint128* value, int base) { - return safe_uint_internal<y_absl::uint128>(text, value, base); +bool safe_strtou128_base(y_absl::string_view text, uint128* value, int base) { + return safe_uint_internal<y_absl::uint128>(text, value, base); } } // namespace numbers_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/numbers.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/numbers.h index ce181d8eb1..b1832e8f3c 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/numbers.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/numbers.h @@ -23,11 +23,11 @@ #ifndef ABSL_STRINGS_NUMBERS_H_ #define ABSL_STRINGS_NUMBERS_H_ -#if defined(__SSE4_2__) && !defined(__CUDACC__) -#define _Y__SSE4_2__ -#endif - -#ifdef _Y__SSE4_2__ +#if defined(__SSE4_2__) && !defined(__CUDACC__) +#define _Y__SSE4_2__ +#endif + +#ifdef _Y__SSE4_2__ #ifdef _MSC_VER #include <intrin.h> #else @@ -44,21 +44,21 @@ #include <type_traits> #include "y_absl/base/config.h" -#ifdef _Y__SSE4_2__ +#ifdef _Y__SSE4_2__ // TODO(jorg): Remove this when we figure out the right way // to swap bytes on SSE 4.2 that works with the compilers // we claim to support. Also, add tests for the compiler // that doesn't support the Intel _bswap64 intrinsic but // does support all the SSE 4.2 intrinsics -#include "y_absl/base/internal/endian.h" +#include "y_absl/base/internal/endian.h" #endif -#include "y_absl/base/macros.h" -#include "y_absl/base/port.h" +#include "y_absl/base/macros.h" +#include "y_absl/base/port.h" #include "y_absl/numeric/bits.h" -#include "y_absl/numeric/int128.h" -#include "y_absl/strings/string_view.h" +#include "y_absl/numeric/int128.h" +#include "y_absl/strings/string_view.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN // SimpleAtoi() @@ -70,7 +70,7 @@ ABSL_NAMESPACE_BEGIN // encountered, this function returns `false`, leaving `out` in an unspecified // state. template <typename int_type> -ABSL_MUST_USE_RESULT bool SimpleAtoi(y_absl::string_view str, int_type* out); +ABSL_MUST_USE_RESULT bool SimpleAtoi(y_absl::string_view str, int_type* out); // SimpleAtof() // @@ -81,7 +81,7 @@ ABSL_MUST_USE_RESULT bool SimpleAtoi(y_absl::string_view str, int_type* out); // allowed formats for `str`, except SimpleAtof() is locale-independent and will // always use the "C" locale. If any errors are encountered, this function // returns `false`, leaving `out` in an unspecified state. -ABSL_MUST_USE_RESULT bool SimpleAtof(y_absl::string_view str, float* out); +ABSL_MUST_USE_RESULT bool SimpleAtof(y_absl::string_view str, float* out); // SimpleAtod() // @@ -92,7 +92,7 @@ ABSL_MUST_USE_RESULT bool SimpleAtof(y_absl::string_view str, float* out); // allowed formats for `str`, except SimpleAtod is locale-independent and will // always use the "C" locale. If any errors are encountered, this function // returns `false`, leaving `out` in an unspecified state. -ABSL_MUST_USE_RESULT bool SimpleAtod(y_absl::string_view str, double* out); +ABSL_MUST_USE_RESULT bool SimpleAtod(y_absl::string_view str, double* out); // SimpleAtob() // @@ -102,7 +102,7 @@ ABSL_MUST_USE_RESULT bool SimpleAtod(y_absl::string_view str, double* out); // are interpreted as boolean `false`: "false", "f", "no", "n", "0". If any // errors are encountered, this function returns `false`, leaving `out` in an // unspecified state. -ABSL_MUST_USE_RESULT bool SimpleAtob(y_absl::string_view str, bool* out); +ABSL_MUST_USE_RESULT bool SimpleAtob(y_absl::string_view str, bool* out); // SimpleHexAtoi() // @@ -124,11 +124,11 @@ ABSL_MUST_USE_RESULT inline bool SimpleHexAtoi(y_absl::string_view str, y_absl::uint128* out); ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl // End of public API. Implementation details follow. -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace numbers_internal { @@ -152,13 +152,13 @@ inline void PutTwoDigits(size_t i, char* buf) { // safe_strto?() functions for implementing SimpleAtoi() -bool safe_strto32_base(y_absl::string_view text, int32_t* value, int base); -bool safe_strto64_base(y_absl::string_view text, int64_t* value, int base); +bool safe_strto32_base(y_absl::string_view text, int32_t* value, int base); +bool safe_strto64_base(y_absl::string_view text, int64_t* value, int base); bool safe_strto128_base(y_absl::string_view text, y_absl::int128* value, int base); -bool safe_strtou32_base(y_absl::string_view text, uint32_t* value, int base); -bool safe_strtou64_base(y_absl::string_view text, uint64_t* value, int base); -bool safe_strtou128_base(y_absl::string_view text, y_absl::uint128* value, +bool safe_strtou32_base(y_absl::string_view text, uint32_t* value, int base); +bool safe_strtou64_base(y_absl::string_view text, uint64_t* value, int base); +bool safe_strtou128_base(y_absl::string_view text, y_absl::uint128* value, int base); static const int kFastToBufferSize = 32; @@ -207,7 +207,7 @@ char* FastIntToBuffer(int_type i, char* buffer) { // Implementation of SimpleAtoi, generalized to support arbitrary base (used // with base different from 10 elsewhere in Abseil implementation). template <typename int_type> -ABSL_MUST_USE_RESULT bool safe_strtoi_base(y_absl::string_view s, int_type* out, +ABSL_MUST_USE_RESULT bool safe_strtoi_base(y_absl::string_view s, int_type* out, int base) { static_assert(sizeof(*out) == 4 || sizeof(*out) == 8, "SimpleAtoi works only with 32-bit or 64-bit integers."); @@ -248,8 +248,8 @@ ABSL_MUST_USE_RESULT bool safe_strtoi_base(y_absl::string_view s, int_type* out, // Returns the number of non-pad digits of the output (it can never be zero // since 0 has one digit). inline size_t FastHexToBufferZeroPad16(uint64_t val, char* out) { -#ifdef _Y__SSE4_2__ - uint64_t be = y_absl::big_endian::FromHost64(val); +#ifdef _Y__SSE4_2__ + uint64_t be = y_absl::big_endian::FromHost64(val); const auto kNibbleMask = _mm_set1_epi8(0xf); const auto kHexDigits = _mm_setr_epi8('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); @@ -262,7 +262,7 @@ inline size_t FastHexToBufferZeroPad16(uint64_t val, char* out) { #else for (int i = 0; i < 8; ++i) { auto byte = (val >> (56 - 8 * i)) & 0xFF; - auto* hex = &y_absl::numbers_internal::kHexTable[byte * 2]; + auto* hex = &y_absl::numbers_internal::kHexTable[byte * 2]; std::memcpy(out + 2 * i, hex, 2); } #endif @@ -273,17 +273,17 @@ inline size_t FastHexToBufferZeroPad16(uint64_t val, char* out) { } // namespace numbers_internal template <typename int_type> -ABSL_MUST_USE_RESULT bool SimpleAtoi(y_absl::string_view str, int_type* out) { +ABSL_MUST_USE_RESULT bool SimpleAtoi(y_absl::string_view str, int_type* out) { return numbers_internal::safe_strtoi_base(str, out, 10); } -ABSL_MUST_USE_RESULT inline bool SimpleAtoi(y_absl::string_view str, +ABSL_MUST_USE_RESULT inline bool SimpleAtoi(y_absl::string_view str, y_absl::int128* out) { return numbers_internal::safe_strto128_base(str, out, 10); } ABSL_MUST_USE_RESULT inline bool SimpleAtoi(y_absl::string_view str, - y_absl::uint128* out) { + y_absl::uint128* out) { return numbers_internal::safe_strtou128_base(str, out, 10); } @@ -303,6 +303,6 @@ ABSL_MUST_USE_RESULT inline bool SimpleHexAtoi(y_absl::string_view str, } ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_NUMBERS_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_cat.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_cat.cc index 9e11702eae..f29ba3c877 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_cat.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_cat.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/str_cat.h" +#include "y_absl/strings/str_cat.h" #include <assert.h> @@ -20,11 +20,11 @@ #include <cstdint> #include <cstring> -#include "y_absl/strings/ascii.h" -#include "y_absl/strings/internal/resize_uninitialized.h" -#include "y_absl/strings/numbers.h" +#include "y_absl/strings/ascii.h" +#include "y_absl/strings/internal/resize_uninitialized.h" +#include "y_absl/strings/numbers.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN AlphaNum::AlphaNum(Hex hex) { @@ -32,16 +32,16 @@ AlphaNum::AlphaNum(Hex hex) { "This function only works when output buffer >= 32 bytes long"); char* const end = &digits_[numbers_internal::kFastToBufferSize]; auto real_width = - y_absl::numbers_internal::FastHexToBufferZeroPad16(hex.value, end - 16); + y_absl::numbers_internal::FastHexToBufferZeroPad16(hex.value, end - 16); if (real_width >= hex.width) { - piece_ = y_absl::string_view(end - real_width, real_width); + piece_ = y_absl::string_view(end - real_width, real_width); } else { // Pad first 16 chars because FastHexToBufferZeroPad16 pads only to 16 and // max pad width can be up to 20. std::memset(end - 32, hex.fill, 16); // Patch up everything else up to the real_width. std::memset(end - real_width - 16, hex.fill, 16); - piece_ = y_absl::string_view(end - hex.width, hex.width); + piece_ = y_absl::string_view(end - hex.width, hex.width); } } @@ -73,7 +73,7 @@ AlphaNum::AlphaNum(Dec dec) { if (add_sign_again) *--writer = '-'; } - piece_ = y_absl::string_view(writer, end - writer); + piece_ = y_absl::string_view(writer, end - writer); } // ---------------------------------------------------------------------- @@ -95,9 +95,9 @@ static char* Append(char* out, const AlphaNum& x) { return after; } -TString StrCat(const AlphaNum& a, const AlphaNum& b) { - TString result; - y_absl::strings_internal::STLStringResizeUninitialized(&result, +TString StrCat(const AlphaNum& a, const AlphaNum& b) { + TString result; + y_absl::strings_internal::STLStringResizeUninitialized(&result, a.size() + b.size()); char* const begin = &result[0]; char* out = begin; @@ -107,8 +107,8 @@ TString StrCat(const AlphaNum& a, const AlphaNum& b) { return result; } -TString StrCat(const AlphaNum& a, const AlphaNum& b, const AlphaNum& c) { - TString result; +TString StrCat(const AlphaNum& a, const AlphaNum& b, const AlphaNum& c) { + TString result; strings_internal::STLStringResizeUninitialized( &result, a.size() + b.size() + c.size()); char* const begin = &result[0]; @@ -120,9 +120,9 @@ TString StrCat(const AlphaNum& a, const AlphaNum& b, const AlphaNum& c) { return result; } -TString StrCat(const AlphaNum& a, const AlphaNum& b, const AlphaNum& c, +TString StrCat(const AlphaNum& a, const AlphaNum& b, const AlphaNum& c, const AlphaNum& d) { - TString result; + TString result; strings_internal::STLStringResizeUninitialized( &result, a.size() + b.size() + c.size() + d.size()); char* const begin = &result[0]; @@ -138,8 +138,8 @@ TString StrCat(const AlphaNum& a, const AlphaNum& b, const AlphaNum& c, namespace strings_internal { // Do not call directly - these are not part of the public API. -TString CatPieces(std::initializer_list<y_absl::string_view> pieces) { - TString result; +TString CatPieces(std::initializer_list<y_absl::string_view> pieces) { + TString result; size_t total_size = 0; for (const y_absl::string_view& piece : pieces) total_size += piece.size(); strings_internal::STLStringResizeUninitialized(&result, total_size); @@ -157,7 +157,7 @@ TString CatPieces(std::initializer_list<y_absl::string_view> pieces) { return result; } -// It's possible to call StrAppend with an y_absl::string_view that is itself a +// It's possible to call StrAppend with an y_absl::string_view that is itself a // fragment of the string we're appending to. However the results of this are // random. Therefore, check for this in debug mode. Use unsigned math so we // only have to do one comparison. Note, there's an exception case: appending an @@ -166,8 +166,8 @@ TString CatPieces(std::initializer_list<y_absl::string_view> pieces) { assert(((src).size() == 0) || \ (uintptr_t((src).data() - (dest).data()) > uintptr_t((dest).size()))) -void AppendPieces(TString* dest, - std::initializer_list<y_absl::string_view> pieces) { +void AppendPieces(TString* dest, + std::initializer_list<y_absl::string_view> pieces) { size_t old_size = dest->size(); size_t total_size = old_size; for (const y_absl::string_view& piece : pieces) { @@ -190,15 +190,15 @@ void AppendPieces(TString* dest, } // namespace strings_internal -void StrAppend(TString* dest, const AlphaNum& a) { +void StrAppend(TString* dest, const AlphaNum& a) { ASSERT_NO_OVERLAP(*dest, a); dest->append(a.data(), a.size()); } -void StrAppend(TString* dest, const AlphaNum& a, const AlphaNum& b) { +void StrAppend(TString* dest, const AlphaNum& a, const AlphaNum& b) { ASSERT_NO_OVERLAP(*dest, a); ASSERT_NO_OVERLAP(*dest, b); - TString::size_type old_size = dest->size(); + TString::size_type old_size = dest->size(); strings_internal::STLStringResizeUninitializedAmortized( dest, old_size + a.size() + b.size()); char* const begin = &(*dest)[0]; @@ -208,12 +208,12 @@ void StrAppend(TString* dest, const AlphaNum& a, const AlphaNum& b) { assert(out == begin + dest->size()); } -void StrAppend(TString* dest, const AlphaNum& a, const AlphaNum& b, +void StrAppend(TString* dest, const AlphaNum& a, const AlphaNum& b, const AlphaNum& c) { ASSERT_NO_OVERLAP(*dest, a); ASSERT_NO_OVERLAP(*dest, b); ASSERT_NO_OVERLAP(*dest, c); - TString::size_type old_size = dest->size(); + TString::size_type old_size = dest->size(); strings_internal::STLStringResizeUninitializedAmortized( dest, old_size + a.size() + b.size() + c.size()); char* const begin = &(*dest)[0]; @@ -224,13 +224,13 @@ void StrAppend(TString* dest, const AlphaNum& a, const AlphaNum& b, assert(out == begin + dest->size()); } -void StrAppend(TString* dest, const AlphaNum& a, const AlphaNum& b, +void StrAppend(TString* dest, const AlphaNum& a, const AlphaNum& b, const AlphaNum& c, const AlphaNum& d) { ASSERT_NO_OVERLAP(*dest, a); ASSERT_NO_OVERLAP(*dest, b); ASSERT_NO_OVERLAP(*dest, c); ASSERT_NO_OVERLAP(*dest, d); - TString::size_type old_size = dest->size(); + TString::size_type old_size = dest->size(); strings_internal::STLStringResizeUninitializedAmortized( dest, old_size + a.size() + b.size() + c.size() + d.size()); char* const begin = &(*dest)[0]; @@ -243,4 +243,4 @@ void StrAppend(TString* dest, const AlphaNum& a, const AlphaNum& b, } ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_cat.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_cat.h index a77c9ae906..a214ac0ba6 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_cat.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_cat.h @@ -28,7 +28,7 @@ // to your function, your callers will automagically convert bools, integers, // and floating point values to strings for you. // -// NOTE: Use of `AlphaNum` outside of the //y_absl/strings package is unsupported +// NOTE: Use of `AlphaNum` outside of the //y_absl/strings package is unsupported // except for the specific case of function parameters of type `AlphaNum` or // `const AlphaNum &`. In particular, instantiating `AlphaNum` directly as a // stack variable is not supported. @@ -59,17 +59,17 @@ #include <type_traits> #include <vector> -#include "y_absl/base/port.h" -#include "y_absl/strings/numbers.h" -#include "y_absl/strings/string_view.h" +#include "y_absl/base/port.h" +#include "y_absl/strings/numbers.h" +#include "y_absl/strings/string_view.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { // AlphaNumBuffer allows a way to pass a string to StrCat without having to do // memory allocation. It is simply a pair of a fixed-size character array, and -// a size. Please don't use outside of y_absl, yet. +// a size. Please don't use outside of y_absl, yet. template <size_t max_size> struct AlphaNumBuffer { std::array<char, max_size> data; @@ -138,40 +138,40 @@ struct Hex { template <typename Int> explicit Hex( - Int v, PadSpec spec = y_absl::kNoPad, + Int v, PadSpec spec = y_absl::kNoPad, typename std::enable_if<sizeof(Int) == 1 && !std::is_pointer<Int>::value>::type* = nullptr) : Hex(spec, static_cast<uint8_t>(v)) {} template <typename Int> explicit Hex( - Int v, PadSpec spec = y_absl::kNoPad, + Int v, PadSpec spec = y_absl::kNoPad, typename std::enable_if<sizeof(Int) == 2 && !std::is_pointer<Int>::value>::type* = nullptr) : Hex(spec, static_cast<uint16_t>(v)) {} template <typename Int> explicit Hex( - Int v, PadSpec spec = y_absl::kNoPad, + Int v, PadSpec spec = y_absl::kNoPad, typename std::enable_if<sizeof(Int) == 4 && !std::is_pointer<Int>::value>::type* = nullptr) : Hex(spec, static_cast<uint32_t>(v)) {} template <typename Int> explicit Hex( - Int v, PadSpec spec = y_absl::kNoPad, + Int v, PadSpec spec = y_absl::kNoPad, typename std::enable_if<sizeof(Int) == 8 && !std::is_pointer<Int>::value>::type* = nullptr) : Hex(spec, static_cast<uint64_t>(v)) {} template <typename Pointee> - explicit Hex(Pointee* v, PadSpec spec = y_absl::kNoPad) + explicit Hex(Pointee* v, PadSpec spec = y_absl::kNoPad) : Hex(spec, reinterpret_cast<uintptr_t>(v)) {} private: Hex(PadSpec spec, uint64_t v) : value(v), - width(spec == y_absl::kNoPad + width(spec == y_absl::kNoPad ? 1 - : spec >= y_absl::kSpacePad2 ? spec - y_absl::kSpacePad2 + 2 - : spec - y_absl::kZeroPad2 + 2), - fill(spec >= y_absl::kSpacePad2 ? ' ' : '0') {} + : spec >= y_absl::kSpacePad2 ? spec - y_absl::kSpacePad2 + 2 + : spec - y_absl::kZeroPad2 + 2), + fill(spec >= y_absl::kSpacePad2 ? ' ' : '0') {} }; // ----------------------------------------------------------------------------- @@ -188,15 +188,15 @@ struct Dec { bool neg; template <typename Int> - explicit Dec(Int v, PadSpec spec = y_absl::kNoPad, + explicit Dec(Int v, PadSpec spec = y_absl::kNoPad, typename std::enable_if<(sizeof(Int) <= 8)>::type* = nullptr) : value(v >= 0 ? static_cast<uint64_t>(v) : uint64_t{0} - static_cast<uint64_t>(v)), - width(spec == y_absl::kNoPad + width(spec == y_absl::kNoPad ? 1 - : spec >= y_absl::kSpacePad2 ? spec - y_absl::kSpacePad2 + 2 - : spec - y_absl::kZeroPad2 + 2), - fill(spec >= y_absl::kSpacePad2 ? ' ' : '0'), + : spec >= y_absl::kSpacePad2 ? spec - y_absl::kSpacePad2 + 2 + : spec - y_absl::kZeroPad2 + 2), + fill(spec >= y_absl::kSpacePad2 ? ' ' : '0'), neg(v < 0) {} }; @@ -246,25 +246,25 @@ class AlphaNum { : piece_(&buf.data[0], buf.size) {} AlphaNum(const char* c_str) : piece_(c_str) {} // NOLINT(runtime/explicit) - AlphaNum(y_absl::string_view pc) : piece_(pc) {} // NOLINT(runtime/explicit) + AlphaNum(y_absl::string_view pc) : piece_(pc) {} // NOLINT(runtime/explicit) template <typename Allocator> AlphaNum( // NOLINT(runtime/explicit) const std::basic_string<char, std::char_traits<char>, Allocator>& str) : piece_(str) {} - AlphaNum(const TString& str) - : piece_(str.data(), str.size()) {} - + AlphaNum(const TString& str) + : piece_(str.data(), str.size()) {} + // Use string literals ":" instead of character literals ':'. AlphaNum(char c) = delete; // NOLINT(runtime/explicit) AlphaNum(const AlphaNum&) = delete; AlphaNum& operator=(const AlphaNum&) = delete; - y_absl::string_view::size_type size() const { return piece_.size(); } + y_absl::string_view::size_type size() const { return piece_.size(); } const char* data() const { return piece_.data(); } - y_absl::string_view Piece() const { return piece_; } + y_absl::string_view Piece() const { return piece_; } // Normal enums are already handled by the integer formatters. // This overload matches only scoped enums. @@ -286,7 +286,7 @@ class AlphaNum { AlphaNum(T e) : AlphaNum(static_cast<bool>(e)) {} // NOLINT(runtime/explicit) private: - y_absl::string_view piece_; + y_absl::string_view piece_; char digits_[numbers_internal::kFastToBufferSize]; }; @@ -321,27 +321,27 @@ class AlphaNum { namespace strings_internal { // Do not call directly - this is not part of the public API. -TString CatPieces(std::initializer_list<y_absl::string_view> pieces); -void AppendPieces(TString* dest, - std::initializer_list<y_absl::string_view> pieces); +TString CatPieces(std::initializer_list<y_absl::string_view> pieces); +void AppendPieces(TString* dest, + std::initializer_list<y_absl::string_view> pieces); } // namespace strings_internal -ABSL_MUST_USE_RESULT inline TString StrCat() { return TString(); } +ABSL_MUST_USE_RESULT inline TString StrCat() { return TString(); } -ABSL_MUST_USE_RESULT inline TString StrCat(const AlphaNum& a) { - return TString(a.data(), a.size()); +ABSL_MUST_USE_RESULT inline TString StrCat(const AlphaNum& a) { + return TString(a.data(), a.size()); } -ABSL_MUST_USE_RESULT TString StrCat(const AlphaNum& a, const AlphaNum& b); -ABSL_MUST_USE_RESULT TString StrCat(const AlphaNum& a, const AlphaNum& b, +ABSL_MUST_USE_RESULT TString StrCat(const AlphaNum& a, const AlphaNum& b); +ABSL_MUST_USE_RESULT TString StrCat(const AlphaNum& a, const AlphaNum& b, const AlphaNum& c); -ABSL_MUST_USE_RESULT TString StrCat(const AlphaNum& a, const AlphaNum& b, +ABSL_MUST_USE_RESULT TString StrCat(const AlphaNum& a, const AlphaNum& b, const AlphaNum& c, const AlphaNum& d); // Support 5 or more arguments template <typename... AV> -ABSL_MUST_USE_RESULT inline TString StrCat( +ABSL_MUST_USE_RESULT inline TString StrCat( const AlphaNum& a, const AlphaNum& b, const AlphaNum& c, const AlphaNum& d, const AlphaNum& e, const AV&... args) { return strings_internal::CatPieces( @@ -361,32 +361,32 @@ ABSL_MUST_USE_RESULT inline TString StrCat( // not try to check each of its input arguments to be sure that they are not // a subset of the string being appended to. That is, while this will work: // -// TString s = "foo"; +// TString s = "foo"; // s += s; // // This output is undefined: // -// TString s = "foo"; +// TString s = "foo"; // StrAppend(&s, s); // -// This output is undefined as well, since `y_absl::string_view` does not own its +// This output is undefined as well, since `y_absl::string_view` does not own its // data: // -// TString s = "foobar"; -// y_absl::string_view p = s; +// TString s = "foobar"; +// y_absl::string_view p = s; // StrAppend(&s, p); -inline void StrAppend(TString*) {} -void StrAppend(TString* dest, const AlphaNum& a); -void StrAppend(TString* dest, const AlphaNum& a, const AlphaNum& b); -void StrAppend(TString* dest, const AlphaNum& a, const AlphaNum& b, +inline void StrAppend(TString*) {} +void StrAppend(TString* dest, const AlphaNum& a); +void StrAppend(TString* dest, const AlphaNum& a, const AlphaNum& b); +void StrAppend(TString* dest, const AlphaNum& a, const AlphaNum& b, const AlphaNum& c); -void StrAppend(TString* dest, const AlphaNum& a, const AlphaNum& b, +void StrAppend(TString* dest, const AlphaNum& a, const AlphaNum& b, const AlphaNum& c, const AlphaNum& d); // Support 5 or more arguments template <typename... AV> -inline void StrAppend(TString* dest, const AlphaNum& a, const AlphaNum& b, +inline void StrAppend(TString* dest, const AlphaNum& a, const AlphaNum& b, const AlphaNum& c, const AlphaNum& d, const AlphaNum& e, const AV&... args) { strings_internal::AppendPieces( @@ -406,6 +406,6 @@ SixDigits(double d) { } ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_STR_CAT_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_format.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_format.h index 4079f38fb4..ba6e332450 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_format.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_format.h @@ -25,17 +25,17 @@ // // Example: // -// TString s = y_absl::StrFormat( +// TString s = y_absl::StrFormat( // "%s %s You have $%d!", "Hello", name, dollars); // // The library consists of the following basic utilities: // -// * `y_absl::StrFormat()`, a type-safe replacement for `std::sprintf()`, to +// * `y_absl::StrFormat()`, a type-safe replacement for `std::sprintf()`, to // write a format string to a `string` value. -// * `y_absl::StrAppendFormat()` to append a format string to a `string` -// * `y_absl::StreamFormat()` to more efficiently write a format string to a +// * `y_absl::StrAppendFormat()` to append a format string to a `string` +// * `y_absl::StreamFormat()` to more efficiently write a format string to a // stream, such as`std::cout`. -// * `y_absl::PrintF()`, `y_absl::FPrintF()` and `y_absl::SNPrintF()` as +// * `y_absl::PrintF()`, `y_absl::FPrintF()` and `y_absl::SNPrintF()` as // replacements for `std::printf()`, `std::fprintf()` and `std::snprintf()`. // // Note: a version of `std::sprintf()` is not supported as it is @@ -73,13 +73,13 @@ #include <cstdio> #include <util/generic/string.h> -#include "y_absl/strings/internal/str_format/arg.h" // IWYU pragma: export -#include "y_absl/strings/internal/str_format/bind.h" // IWYU pragma: export -#include "y_absl/strings/internal/str_format/checker.h" // IWYU pragma: export -#include "y_absl/strings/internal/str_format/extension.h" // IWYU pragma: export -#include "y_absl/strings/internal/str_format/parser.h" // IWYU pragma: export +#include "y_absl/strings/internal/str_format/arg.h" // IWYU pragma: export +#include "y_absl/strings/internal/str_format/bind.h" // IWYU pragma: export +#include "y_absl/strings/internal/str_format/checker.h" // IWYU pragma: export +#include "y_absl/strings/internal/str_format/extension.h" // IWYU pragma: export +#include "y_absl/strings/internal/str_format/parser.h" // IWYU pragma: export -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN // UntypedFormatSpec @@ -90,9 +90,9 @@ ABSL_NAMESPACE_BEGIN // // Example: // -// y_absl::UntypedFormatSpec format("%d"); -// TString out; -// CHECK(y_absl::FormatUntyped(&out, format, {y_absl::FormatArg(1)})); +// y_absl::UntypedFormatSpec format("%d"); +// TString out; +// CHECK(y_absl::FormatUntyped(&out, format, {y_absl::FormatArg(1)})); class UntypedFormatSpec { public: UntypedFormatSpec() = delete; @@ -118,7 +118,7 @@ class UntypedFormatSpec { // // Example: // -// y_absl::StrFormat("%s", y_absl::FormatStreamed(obj)); +// y_absl::StrFormat("%s", y_absl::FormatStreamed(obj)); template <typename T> str_format_internal::StreamedWrapper<T> FormatStreamed(const T& v) { return str_format_internal::StreamedWrapper<T>(v); @@ -137,8 +137,8 @@ str_format_internal::StreamedWrapper<T> FormatStreamed(const T& v) { // Example: // // int n = 0; -// TString s = y_absl::StrFormat("%s%d%n", "hello", 123, -// y_absl::FormatCountCapture(&n)); +// TString s = y_absl::StrFormat("%s%d%n", "hello", 123, +// y_absl::FormatCountCapture(&n)); // EXPECT_EQ(8, n); class FormatCountCapture { public: @@ -171,7 +171,7 @@ class FormatCountCapture { // For a `FormatSpec` to be valid at compile-time, it must be provided as // either: // -// * A `constexpr` literal or `y_absl::string_view`, which is how it most often +// * A `constexpr` literal or `y_absl::string_view`, which is how it most often // used. // * A `ParsedFormat` instantiation, which ensures the format string is // valid before use. (See below.) @@ -179,16 +179,16 @@ class FormatCountCapture { // Example: // // // Provided as a string literal. -// y_absl::StrFormat("Welcome to %s, Number %d!", "The Village", 6); +// y_absl::StrFormat("Welcome to %s, Number %d!", "The Village", 6); // -// // Provided as a constexpr y_absl::string_view. -// constexpr y_absl::string_view formatString = "Welcome to %s, Number %d!"; -// y_absl::StrFormat(formatString, "The Village", 6); +// // Provided as a constexpr y_absl::string_view. +// constexpr y_absl::string_view formatString = "Welcome to %s, Number %d!"; +// y_absl::StrFormat(formatString, "The Village", 6); // // // Provided as a pre-compiled ParsedFormat object. // // Note that this example is useful only for illustration purposes. -// y_absl::ParsedFormat<'s', 'd'> formatString("Welcome to %s, Number %d!"); -// y_absl::StrFormat(formatString, "TheVillage", 6); +// y_absl::ParsedFormat<'s', 'd'> formatString("Welcome to %s, Number %d!"); +// y_absl::StrFormat(formatString, "TheVillage", 6); // // A format string generally follows the POSIX syntax as used within the POSIX // `printf` specification. @@ -210,7 +210,7 @@ class FormatCountCapture { // * `p` for pointer address values // * `n` for the special case of writing out the number of characters // written to this point. The resulting value must be captured within an -// `y_absl::FormatCountCapture` type. +// `y_absl::FormatCountCapture` type. // // Implementation-defined behavior: // * A null pointer provided to "%s" or "%p" is output as "(nil)". @@ -224,7 +224,7 @@ class FormatCountCapture { // "%c", 'a' -> "a" // "%c", 32 -> " " // "%s", "C" -> "C" -// "%s", TString("C++") -> "C++" +// "%s", TString("C++") -> "C++" // "%d", -10 -> "-10" // "%o", 10 -> "12" // "%x", 16 -> "10" @@ -235,8 +235,8 @@ class FormatCountCapture { // "%p", (void*)&value -> "0x7ffdeb6ad2a4" // // int n = 0; -// TString s = y_absl::StrFormat( -// "%s%d%n", "hello", 123, y_absl::FormatCountCapture(&n)); +// TString s = y_absl::StrFormat( +// "%s%d%n", "hello", 123, y_absl::FormatCountCapture(&n)); // EXPECT_EQ(8, n); // // The `FormatSpec` intrinsically supports all of these fundamental C++ types: @@ -248,7 +248,7 @@ class FormatCountCapture { // // However, in the `str_format` library, a format conversion specifies a broader // C++ conceptual category instead of an exact type. For example, `%s` binds to -// any string-like argument, so `TString`, `y_absl::string_view`, and +// any string-like argument, so `TString`, `y_absl::string_view`, and // `const char*` are all accepted. Likewise, `%d` accepts any integer-like // argument, etc. @@ -271,13 +271,13 @@ using FormatSpec = str_format_internal::FormatSpecTemplate< // Example: // // // Verified at compile time. -// y_absl::ParsedFormat<'s', 'd'> formatString("Welcome to %s, Number %d!"); -// y_absl::StrFormat(formatString, "TheVillage", 6); +// y_absl::ParsedFormat<'s', 'd'> formatString("Welcome to %s, Number %d!"); +// y_absl::StrFormat(formatString, "TheVillage", 6); // // // Verified at runtime. -// auto format_runtime = y_absl::ParsedFormat<'d'>::New(format_string); +// auto format_runtime = y_absl::ParsedFormat<'d'>::New(format_string); // if (format_runtime) { -// value = y_absl::StrFormat(*format_runtime, i); +// value = y_absl::StrFormat(*format_runtime, i); // } else { // ... error case ... // } @@ -329,13 +329,13 @@ using ParsedFormat = str_format_internal::ExtendedParsedFormat< // // Example: // -// TString s = y_absl::StrFormat( +// TString s = y_absl::StrFormat( // "Welcome to %s, Number %d!", "The Village", 6); // EXPECT_EQ("Welcome to The Village, Number 6!", s); // // Returns an empty string in case of error. template <typename... Args> -ABSL_MUST_USE_RESULT TString StrFormat(const FormatSpec<Args...>& format, +ABSL_MUST_USE_RESULT TString StrFormat(const FormatSpec<Args...>& format, const Args&... args) { return str_format_internal::FormatPack( str_format_internal::UntypedFormatSpecImpl::Extract(format), @@ -350,10 +350,10 @@ ABSL_MUST_USE_RESULT TString StrFormat(const FormatSpec<Args...>& format, // // Example: // -// TString orig("For example PI is approximately "); +// TString orig("For example PI is approximately "); // std::cout << StrAppendFormat(&orig, "%12.6f", 3.14); template <typename... Args> -TString& StrAppendFormat(TString* dst, +TString& StrAppendFormat(TString* dst, const FormatSpec<Args...>& format, const Args&... args) { return str_format_internal::AppendPack( @@ -365,7 +365,7 @@ TString& StrAppendFormat(TString* dst, // // Writes to an output stream given a format string and zero or more arguments, // generally in a manner that is more efficient than streaming the result of -// `y_absl:: StrFormat()`. The returned object must be streamed before the full +// `y_absl:: StrFormat()`. The returned object must be streamed before the full // expression ends. // // Example: @@ -383,12 +383,12 @@ ABSL_MUST_USE_RESULT str_format_internal::Streamable StreamFormat( // // Writes to stdout given a format string and zero or more arguments. This // function is functionally equivalent to `std::printf()` (and type-safe); -// prefer `y_absl::PrintF()` over `std::printf()`. +// prefer `y_absl::PrintF()` over `std::printf()`. // // Example: // // std::string_view s = "Ulaanbaatar"; -// y_absl::PrintF("The capital of Mongolia is %s", s); +// y_absl::PrintF("The capital of Mongolia is %s", s); // // Outputs: "The capital of Mongolia is Ulaanbaatar" // @@ -403,12 +403,12 @@ int PrintF(const FormatSpec<Args...>& format, const Args&... args) { // // Writes to a file given a format string and zero or more arguments. This // function is functionally equivalent to `std::fprintf()` (and type-safe); -// prefer `y_absl::FPrintF()` over `std::fprintf()`. +// prefer `y_absl::FPrintF()` over `std::fprintf()`. // // Example: // // std::string_view s = "Ulaanbaatar"; -// y_absl::FPrintF(stdout, "The capital of Mongolia is %s", s); +// y_absl::FPrintF(stdout, "The capital of Mongolia is %s", s); // // Outputs: "The capital of Mongolia is Ulaanbaatar" // @@ -424,9 +424,9 @@ int FPrintF(std::FILE* output, const FormatSpec<Args...>& format, // // Writes to a sized buffer given a format string and zero or more arguments. // This function is functionally equivalent to `std::snprintf()` (and -// type-safe); prefer `y_absl::SNPrintF()` over `std::snprintf()`. +// type-safe); prefer `y_absl::SNPrintF()` over `std::snprintf()`. // -// In particular, a successful call to `y_absl::SNPrintF()` writes at most `size` +// In particular, a successful call to `y_absl::SNPrintF()` writes at most `size` // bytes of the formatted output to `output`, including a NUL-terminator, and // returns the number of bytes that would have been written if truncation did // not occur. In the event of an error, a negative value is returned and `errno` @@ -436,7 +436,7 @@ int FPrintF(std::FILE* output, const FormatSpec<Args...>& format, // // std::string_view s = "Ulaanbaatar"; // char output[128]; -// y_absl::SNPrintF(output, sizeof(output), +// y_absl::SNPrintF(output, sizeof(output), // "The capital of Mongolia is %s", s); // // Post-condition: output == "The capital of Mongolia is Ulaanbaatar" @@ -487,7 +487,7 @@ class FormatRawSink { // Format() // // Writes a formatted string to an arbitrary sink object (implementing the -// `y_absl::FormatRawSink` interface), using a format string and zero or more +// `y_absl::FormatRawSink` interface), using a format string and zero or more // additional arguments. // // By default, `TString`, `std::ostream`, and `y_absl::Cord` are supported as @@ -522,7 +522,7 @@ using FormatArg = str_format_internal::FormatArgImpl; // FormatUntyped() // // Writes a formatted string to an arbitrary sink object (implementing the -// `y_absl::FormatRawSink` interface), using an `UntypedFormatSpec` and zero or +// `y_absl::FormatRawSink` interface), using an `UntypedFormatSpec` and zero or // more additional arguments. // // This function acts as the most generic formatting function in the @@ -533,26 +533,26 @@ using FormatArg = str_format_internal::FormatArgImpl; // On failure, this function returns `false` and the state of the sink is // unspecified. // -// The arguments are provided in an `y_absl::Span<const y_absl::FormatArg>`. -// Each `y_absl::FormatArg` object binds to a single argument and keeps a +// The arguments are provided in an `y_absl::Span<const y_absl::FormatArg>`. +// Each `y_absl::FormatArg` object binds to a single argument and keeps a // reference to it. The values used to create the `FormatArg` objects must // outlive this function call. // // Example: // -// std::optional<TString> FormatDynamic( -// const TString& in_format, -// const vector<TString>& in_args) { -// TString out; -// std::vector<y_absl::FormatArg> args; +// std::optional<TString> FormatDynamic( +// const TString& in_format, +// const vector<TString>& in_args) { +// TString out; +// std::vector<y_absl::FormatArg> args; // for (const auto& v : in_args) { // // It is important that 'v' is a reference to the objects in in_args. // // The values we pass to FormatArg must outlive the call to // // FormatUntyped. // args.emplace_back(v); // } -// y_absl::UntypedFormatSpec format(in_format); -// if (!y_absl::FormatUntyped(&out, format, args)) { +// y_absl::UntypedFormatSpec format(in_format); +// if (!y_absl::FormatUntyped(&out, format, args)) { // return std::nullopt; // } // return std::move(out); @@ -560,7 +560,7 @@ using FormatArg = str_format_internal::FormatArgImpl; // ABSL_MUST_USE_RESULT inline bool FormatUntyped( FormatRawSink raw_sink, const UntypedFormatSpec& format, - y_absl::Span<const FormatArg> args) { + y_absl::Span<const FormatArg> args) { return str_format_internal::FormatUntyped( str_format_internal::FormatRawSinkImpl::Extract(raw_sink), str_format_internal::UntypedFormatSpecImpl::Extract(format), args); @@ -807,6 +807,6 @@ struct FormatConvertResult { }; ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_STR_FORMAT_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_join.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_join.h index 46a0323c6e..41d3205da7 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_join.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_join.h @@ -18,30 +18,30 @@ // ----------------------------------------------------------------------------- // // This header file contains functions for joining a range of elements and -// returning the result as a TString. StrJoin operations are specified by +// returning the result as a TString. StrJoin operations are specified by // passing a range, a separator string to use between the elements joined, and // an optional Formatter responsible for converting each argument in the range // to a string. If omitted, a default `AlphaNumFormatter()` is called on the -// elements to be joined, using the same formatting that `y_absl::StrCat()` uses. +// elements to be joined, using the same formatting that `y_absl::StrCat()` uses. // This package defines a number of default formatters, and you can define your // own implementations. // // Ranges are specified by passing a container with `std::begin()` and // `std::end()` iterators, container-specific `begin()` and `end()` iterators, a // brace-initialized `std::initializer_list`, or a `std::tuple` of heterogeneous -// objects. The separator string is specified as an `y_absl::string_view`. +// objects. The separator string is specified as an `y_absl::string_view`. // -// Because the default formatter uses the `y_absl::AlphaNum` class, -// `y_absl::StrJoin()`, like `y_absl::StrCat()`, will work out-of-the-box on +// Because the default formatter uses the `y_absl::AlphaNum` class, +// `y_absl::StrJoin()`, like `y_absl::StrCat()`, will work out-of-the-box on // collections of strings, ints, floats, doubles, etc. // // Example: // -// std::vector<TString> v = {"foo", "bar", "baz"}; -// TString s = y_absl::StrJoin(v, "-"); +// std::vector<TString> v = {"foo", "bar", "baz"}; +// TString s = y_absl::StrJoin(v, "-"); // EXPECT_EQ("foo-bar-baz", s); // -// See comments on the `y_absl::StrJoin()` function for more examples. +// See comments on the `y_absl::StrJoin()` function for more examples. #ifndef ABSL_STRINGS_STR_JOIN_H_ #define ABSL_STRINGS_STR_JOIN_H_ @@ -55,11 +55,11 @@ #include <type_traits> #include <utility> -#include "y_absl/base/macros.h" -#include "y_absl/strings/internal/str_join_internal.h" -#include "y_absl/strings/string_view.h" +#include "y_absl/base/macros.h" +#include "y_absl/strings/internal/str_join_internal.h" +#include "y_absl/strings/string_view.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN // ----------------------------------------------------------------------------- @@ -67,25 +67,25 @@ ABSL_NAMESPACE_BEGIN // ----------------------------------------------------------------------------- // // A Formatter is a function object that is responsible for formatting its -// argument as a string and appending it to a given output TString. +// argument as a string and appending it to a given output TString. // Formatters may be implemented as function objects, lambdas, or normal -// functions. You may provide your own Formatter to enable `y_absl::StrJoin()` to +// functions. You may provide your own Formatter to enable `y_absl::StrJoin()` to // work with arbitrary types. // // The following is an example of a custom Formatter that simply uses -// `std::to_string()` to format an integer as a TString. +// `std::to_string()` to format an integer as a TString. // // struct MyFormatter { -// void operator()(TString* out, int i) const { +// void operator()(TString* out, int i) const { // out->append(std::to_string(i)); // } // }; // // You would use the above formatter by passing an instance of it as the final -// argument to `y_absl::StrJoin()`: +// argument to `y_absl::StrJoin()`: // // std::vector<int> v = {1, 2, 3, 4}; -// TString s = y_absl::StrJoin(v, "-", MyFormatter()); +// TString s = y_absl::StrJoin(v, "-", MyFormatter()); // EXPECT_EQ("1-2-3-4", s); // // The following standard formatters are provided within this file: @@ -97,7 +97,7 @@ ABSL_NAMESPACE_BEGIN // AlphaNumFormatter() // -// Default formatter used if none is specified. Uses `y_absl::AlphaNum` to convert +// Default formatter used if none is specified. Uses `y_absl::AlphaNum` to convert // numeric arguments to strings. inline strings_internal::AlphaNumFormatterImpl AlphaNumFormatter() { return strings_internal::AlphaNumFormatterImpl(); @@ -110,14 +110,14 @@ inline strings_internal::StreamFormatterImpl StreamFormatter() { return strings_internal::StreamFormatterImpl(); } -// Function Template: PairFormatter(Formatter, y_absl::string_view, Formatter) +// Function Template: PairFormatter(Formatter, y_absl::string_view, Formatter) // // Formats a `std::pair` by putting a given separator between the pair's // `.first` and `.second` members. This formatter allows you to specify // custom Formatters for both the first and second member of each pair. template <typename FirstFormatter, typename SecondFormatter> inline strings_internal::PairFormatterImpl<FirstFormatter, SecondFormatter> -PairFormatter(FirstFormatter f1, y_absl::string_view sep, SecondFormatter f2) { +PairFormatter(FirstFormatter f1, y_absl::string_view sep, SecondFormatter f2) { return strings_internal::PairFormatterImpl<FirstFormatter, SecondFormatter>( std::move(f1), sep, std::move(f2)); } @@ -127,7 +127,7 @@ PairFormatter(FirstFormatter f1, y_absl::string_view sep, SecondFormatter f2) { inline strings_internal::PairFormatterImpl< strings_internal::AlphaNumFormatterImpl, strings_internal::AlphaNumFormatterImpl> -PairFormatter(y_absl::string_view sep) { +PairFormatter(y_absl::string_view sep) { return PairFormatter(AlphaNumFormatter(), sep, AlphaNumFormatter()); } @@ -157,8 +157,8 @@ DereferenceFormatter() { // StrJoin() // ----------------------------------------------------------------------------- // -// Joins a range of elements and returns the result as a TString. -// `y_absl::StrJoin()` takes a range, a separator string to use between the +// Joins a range of elements and returns the result as a TString. +// `y_absl::StrJoin()` takes a range, a separator string to use between the // elements joined, and an optional Formatter responsible for converting each // argument in the range to a string. // @@ -167,23 +167,23 @@ DereferenceFormatter() { // // Example 1: // // Joins a collection of strings. This pattern also works with a collection -// // of `y_absl::string_view` or even `const char*`. -// std::vector<TString> v = {"foo", "bar", "baz"}; -// TString s = y_absl::StrJoin(v, "-"); +// // of `y_absl::string_view` or even `const char*`. +// std::vector<TString> v = {"foo", "bar", "baz"}; +// TString s = y_absl::StrJoin(v, "-"); // EXPECT_EQ("foo-bar-baz", s); // // Example 2: // // Joins the values in the given `std::initializer_list<>` specified using // // brace initialization. This pattern also works with an initializer_list -// // of ints or `y_absl::string_view` -- any `AlphaNum`-compatible type. -// TString s = y_absl::StrJoin({"foo", "bar", "baz"}, "-"); +// // of ints or `y_absl::string_view` -- any `AlphaNum`-compatible type. +// TString s = y_absl::StrJoin({"foo", "bar", "baz"}, "-"); // EXPECT_EQ("foo-bar-baz", s); // // Example 3: // // Joins a collection of ints. This pattern also works with floats, // // doubles, int64s -- any `StrCat()`-compatible type. // std::vector<int> v = {1, 2, 3, -4}; -// TString s = y_absl::StrJoin(v, "-"); +// TString s = y_absl::StrJoin(v, "-"); // EXPECT_EQ("1-2-3--4", s); // // Example 4: @@ -194,7 +194,7 @@ DereferenceFormatter() { // // `std::vector<int*>`. // int x = 1, y = 2, z = 3; // std::vector<int*> v = {&x, &y, &z}; -// TString s = y_absl::StrJoin(v, "-"); +// TString s = y_absl::StrJoin(v, "-"); // EXPECT_EQ("1-2-3", s); // // Example 5: @@ -203,91 +203,91 @@ DereferenceFormatter() { // v.emplace_back(new int(1)); // v.emplace_back(new int(2)); // v.emplace_back(new int(3)); -// TString s = y_absl::StrJoin(v, "-"); +// TString s = y_absl::StrJoin(v, "-"); // EXPECT_EQ("1-2-3", s); // // Example 6: // // Joins a `std::map`, with each key-value pair separated by an equals // // sign. This pattern would also work with, say, a // // `std::vector<std::pair<>>`. -// std::map<TString, int> m = { +// std::map<TString, int> m = { // std::make_pair("a", 1), // std::make_pair("b", 2), // std::make_pair("c", 3)}; -// TString s = y_absl::StrJoin(m, ",", y_absl::PairFormatter("=")); +// TString s = y_absl::StrJoin(m, ",", y_absl::PairFormatter("=")); // EXPECT_EQ("a=1,b=2,c=3", s); // // Example 7: -// // These examples show how `y_absl::StrJoin()` handles a few common edge +// // These examples show how `y_absl::StrJoin()` handles a few common edge // // cases: -// std::vector<TString> v_empty; -// EXPECT_EQ("", y_absl::StrJoin(v_empty, "-")); +// std::vector<TString> v_empty; +// EXPECT_EQ("", y_absl::StrJoin(v_empty, "-")); // -// std::vector<TString> v_one_item = {"foo"}; -// EXPECT_EQ("foo", y_absl::StrJoin(v_one_item, "-")); +// std::vector<TString> v_one_item = {"foo"}; +// EXPECT_EQ("foo", y_absl::StrJoin(v_one_item, "-")); // -// std::vector<TString> v_empty_string = {""}; -// EXPECT_EQ("", y_absl::StrJoin(v_empty_string, "-")); +// std::vector<TString> v_empty_string = {""}; +// EXPECT_EQ("", y_absl::StrJoin(v_empty_string, "-")); // -// std::vector<TString> v_one_item_empty_string = {"a", ""}; -// EXPECT_EQ("a-", y_absl::StrJoin(v_one_item_empty_string, "-")); +// std::vector<TString> v_one_item_empty_string = {"a", ""}; +// EXPECT_EQ("a-", y_absl::StrJoin(v_one_item_empty_string, "-")); // -// std::vector<TString> v_two_empty_string = {"", ""}; -// EXPECT_EQ("-", y_absl::StrJoin(v_two_empty_string, "-")); +// std::vector<TString> v_two_empty_string = {"", ""}; +// EXPECT_EQ("-", y_absl::StrJoin(v_two_empty_string, "-")); // // Example 8: // // Joins a `std::tuple<T...>` of heterogeneous types, converting each to -// // a TString using the `y_absl::AlphaNum` class. -// TString s = y_absl::StrJoin(std::make_tuple(123, "abc", 0.456), "-"); +// // a TString using the `y_absl::AlphaNum` class. +// TString s = y_absl::StrJoin(std::make_tuple(123, "abc", 0.456), "-"); // EXPECT_EQ("123-abc-0.456", s); template <typename Iterator, typename Formatter> -TString StrJoin(Iterator start, Iterator end, y_absl::string_view sep, +TString StrJoin(Iterator start, Iterator end, y_absl::string_view sep, Formatter&& fmt) { return strings_internal::JoinAlgorithm(start, end, sep, fmt); } template <typename Range, typename Formatter> -TString StrJoin(const Range& range, y_absl::string_view separator, +TString StrJoin(const Range& range, y_absl::string_view separator, Formatter&& fmt) { return strings_internal::JoinRange(range, separator, fmt); } template <typename T, typename Formatter> -TString StrJoin(std::initializer_list<T> il, y_absl::string_view separator, +TString StrJoin(std::initializer_list<T> il, y_absl::string_view separator, Formatter&& fmt) { return strings_internal::JoinRange(il, separator, fmt); } template <typename... T, typename Formatter> -TString StrJoin(const std::tuple<T...>& value, y_absl::string_view separator, +TString StrJoin(const std::tuple<T...>& value, y_absl::string_view separator, Formatter&& fmt) { return strings_internal::JoinAlgorithm(value, separator, fmt); } template <typename Iterator> -TString StrJoin(Iterator start, Iterator end, y_absl::string_view separator) { +TString StrJoin(Iterator start, Iterator end, y_absl::string_view separator) { return strings_internal::JoinRange(start, end, separator); } template <typename Range> -TString StrJoin(const Range& range, y_absl::string_view separator) { +TString StrJoin(const Range& range, y_absl::string_view separator) { return strings_internal::JoinRange(range, separator); } template <typename T> -TString StrJoin(std::initializer_list<T> il, - y_absl::string_view separator) { +TString StrJoin(std::initializer_list<T> il, + y_absl::string_view separator) { return strings_internal::JoinRange(il, separator); } template <typename... T> -TString StrJoin(const std::tuple<T...>& value, - y_absl::string_view separator) { +TString StrJoin(const std::tuple<T...>& value, + y_absl::string_view separator) { return strings_internal::JoinAlgorithm(value, separator, AlphaNumFormatter()); } ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_STR_JOIN_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_replace.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_replace.cc index 77b78c6c16..e6e3c9eba8 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_replace.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_replace.cc @@ -12,24 +12,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/str_replace.h" +#include "y_absl/strings/str_replace.h" -#include "y_absl/strings/str_cat.h" +#include "y_absl/strings/str_cat.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { using FixedMapping = - std::initializer_list<std::pair<y_absl::string_view, y_absl::string_view>>; + std::initializer_list<std::pair<y_absl::string_view, y_absl::string_view>>; -// Applies the ViableSubstitutions in subs_ptr to the y_absl::string_view s, and +// Applies the ViableSubstitutions in subs_ptr to the y_absl::string_view s, and // stores the result in *result_ptr. Returns the number of substitutions that // occurred. int ApplySubstitutions( - y_absl::string_view s, + y_absl::string_view s, std::vector<strings_internal::ViableSubstitution>* subs_ptr, - TString* result_ptr) { + TString* result_ptr) { auto& subs = *subs_ptr; int substitutions = 0; size_t pos = 0; @@ -68,15 +68,15 @@ int ApplySubstitutions( // Note that we implement them here, rather than in the header, so that they // aren't inlined. -TString StrReplaceAll(y_absl::string_view s, +TString StrReplaceAll(y_absl::string_view s, strings_internal::FixedMapping replacements) { return StrReplaceAll<strings_internal::FixedMapping>(s, replacements); } int StrReplaceAll(strings_internal::FixedMapping replacements, - TString* target) { + TString* target) { return StrReplaceAll<strings_internal::FixedMapping>(replacements, target); } ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_replace.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_replace.h index 42c85616a0..c9019646d7 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_replace.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_replace.h @@ -17,7 +17,7 @@ // File: str_replace.h // ----------------------------------------------------------------------------- // -// This file defines `y_absl::StrReplaceAll()`, a general-purpose string +// This file defines `y_absl::StrReplaceAll()`, a general-purpose string // replacement function designed for large, arbitrary text substitutions, // especially on strings which you are receiving from some other system for // further processing (e.g. processing regular expressions, escaping HTML @@ -25,11 +25,11 @@ // one substitution is being performed, or when substitution is rare. // // If the string being modified is known at compile-time, and the substitutions -// vary, `y_absl::Substitute()` may be a better choice. +// vary, `y_absl::Substitute()` may be a better choice. // // Example: // -// TString html_escaped = y_absl::StrReplaceAll(user_input, { +// TString html_escaped = y_absl::StrReplaceAll(user_input, { // {"&", "&"}, // {"<", "<"}, // {">", ">"}, @@ -42,10 +42,10 @@ #include <utility> #include <vector> -#include "y_absl/base/attributes.h" -#include "y_absl/strings/string_view.h" +#include "y_absl/base/attributes.h" +#include "y_absl/strings/string_view.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN // StrReplaceAll() @@ -59,15 +59,15 @@ ABSL_NAMESPACE_BEGIN // // Example: // -// TString s = y_absl::StrReplaceAll( +// TString s = y_absl::StrReplaceAll( // "$who bought $count #Noun. Thanks $who!", -// {{"$count", y_absl::StrCat(5)}, +// {{"$count", y_absl::StrCat(5)}, // {"$who", "Bob"}, // {"#Noun", "Apples"}}); // EXPECT_EQ("Bob bought 5 Apples. Thanks Bob!", s); -ABSL_MUST_USE_RESULT TString StrReplaceAll( - y_absl::string_view s, - std::initializer_list<std::pair<y_absl::string_view, y_absl::string_view>> +ABSL_MUST_USE_RESULT TString StrReplaceAll( + y_absl::string_view s, + std::initializer_list<std::pair<y_absl::string_view, y_absl::string_view>> replacements); // Overload of `StrReplaceAll()` to accept a container of key/value replacement @@ -76,25 +76,25 @@ ABSL_MUST_USE_RESULT TString StrReplaceAll( // // Examples: // -// std::map<const y_absl::string_view, const y_absl::string_view> replacements; +// std::map<const y_absl::string_view, const y_absl::string_view> replacements; // replacements["$who"] = "Bob"; // replacements["$count"] = "5"; // replacements["#Noun"] = "Apples"; -// TString s = y_absl::StrReplaceAll( +// TString s = y_absl::StrReplaceAll( // "$who bought $count #Noun. Thanks $who!", // replacements); // EXPECT_EQ("Bob bought 5 Apples. Thanks Bob!", s); // // // A std::vector of std::pair elements can be more efficient. -// std::vector<std::pair<const y_absl::string_view, TString>> replacements; +// std::vector<std::pair<const y_absl::string_view, TString>> replacements; // replacements.push_back({"&", "&"}); // replacements.push_back({"<", "<"}); // replacements.push_back({">", ">"}); -// TString s = y_absl::StrReplaceAll("if (ptr < &foo)", +// TString s = y_absl::StrReplaceAll("if (ptr < &foo)", // replacements); // EXPECT_EQ("if (ptr < &foo)", s); template <typename StrToStrMapping> -TString StrReplaceAll(y_absl::string_view s, +TString StrReplaceAll(y_absl::string_view s, const StrToStrMapping& replacements); // Overload of `StrReplaceAll()` to replace character sequences within a given @@ -103,17 +103,17 @@ TString StrReplaceAll(y_absl::string_view s, // // Example: // -// TString s = TString("$who bought $count #Noun. Thanks $who!"); +// TString s = TString("$who bought $count #Noun. Thanks $who!"); // int count; -// count = y_absl::StrReplaceAll({{"$count", y_absl::StrCat(5)}, +// count = y_absl::StrReplaceAll({{"$count", y_absl::StrCat(5)}, // {"$who", "Bob"}, // {"#Noun", "Apples"}}, &s); // EXPECT_EQ(count, 4); // EXPECT_EQ("Bob bought 5 Apples. Thanks Bob!", s); int StrReplaceAll( - std::initializer_list<std::pair<y_absl::string_view, y_absl::string_view>> + std::initializer_list<std::pair<y_absl::string_view, y_absl::string_view>> replacements, - TString* target); + TString* target); // Overload of `StrReplaceAll()` to replace patterns within a given output // string *in place* with replacements provided within a container of key/value @@ -121,25 +121,25 @@ int StrReplaceAll( // // Example: // -// TString s = TString("if (ptr < &foo)"); -// int count = y_absl::StrReplaceAll({{"&", "&"}, +// TString s = TString("if (ptr < &foo)"); +// int count = y_absl::StrReplaceAll({{"&", "&"}, // {"<", "<"}, // {">", ">"}}, &s); // EXPECT_EQ(count, 2); // EXPECT_EQ("if (ptr < &foo)", s); template <typename StrToStrMapping> -int StrReplaceAll(const StrToStrMapping& replacements, TString* target); +int StrReplaceAll(const StrToStrMapping& replacements, TString* target); // Implementation details only, past this point. namespace strings_internal { struct ViableSubstitution { - y_absl::string_view old; - y_absl::string_view replacement; + y_absl::string_view old; + y_absl::string_view replacement; size_t offset; - ViableSubstitution(y_absl::string_view old_str, - y_absl::string_view replacement_str, size_t offset_val) + ViableSubstitution(y_absl::string_view old_str, + y_absl::string_view replacement_str, size_t offset_val) : old(old_str), replacement(replacement_str), offset(offset_val) {} // One substitution occurs "before" another (takes priority) if either @@ -156,13 +156,13 @@ struct ViableSubstitution { // overhead of such a queue isn't worth it. template <typename StrToStrMapping> std::vector<ViableSubstitution> FindSubstitutions( - y_absl::string_view s, const StrToStrMapping& replacements) { + y_absl::string_view s, const StrToStrMapping& replacements) { std::vector<ViableSubstitution> subs; subs.reserve(replacements.size()); for (const auto& rep : replacements) { using std::get; - y_absl::string_view old(get<0>(rep)); + y_absl::string_view old(get<0>(rep)); size_t pos = s.find(old); if (pos == s.npos) continue; @@ -184,28 +184,28 @@ std::vector<ViableSubstitution> FindSubstitutions( return subs; } -int ApplySubstitutions(y_absl::string_view s, +int ApplySubstitutions(y_absl::string_view s, std::vector<ViableSubstitution>* subs_ptr, - TString* result_ptr); + TString* result_ptr); } // namespace strings_internal template <typename StrToStrMapping> -TString StrReplaceAll(y_absl::string_view s, +TString StrReplaceAll(y_absl::string_view s, const StrToStrMapping& replacements) { auto subs = strings_internal::FindSubstitutions(s, replacements); - TString result; + TString result; result.reserve(s.size()); strings_internal::ApplySubstitutions(s, &subs, &result); return result; } template <typename StrToStrMapping> -int StrReplaceAll(const StrToStrMapping& replacements, TString* target) { +int StrReplaceAll(const StrToStrMapping& replacements, TString* target) { auto subs = strings_internal::FindSubstitutions(*target, replacements); if (subs.empty()) return 0; - TString result; + TString result; result.reserve(target->size()); int substitutions = strings_internal::ApplySubstitutions(*target, &subs, &result); @@ -214,6 +214,6 @@ int StrReplaceAll(const StrToStrMapping& replacements, TString* target) { } ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_STR_REPLACE_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_split.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_split.cc index 5f9193e6ba..bf37503357 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_split.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_split.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/str_split.h" +#include "y_absl/strings/str_split.h" #include <algorithm> #include <cassert> @@ -23,10 +23,10 @@ #include <limits> #include <memory> -#include "y_absl/base/internal/raw_logging.h" -#include "y_absl/strings/ascii.h" +#include "y_absl/base/internal/raw_logging.h" +#include "y_absl/strings/ascii.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace { @@ -35,44 +35,44 @@ namespace { // shared between the ByString and ByAnyChar delimiters. The FindPolicy // template parameter allows each delimiter to customize the actual find // function to use and the length of the found delimiter. For example, the -// Literal delimiter will ultimately use y_absl::string_view::find(), and the -// AnyOf delimiter will use y_absl::string_view::find_first_of(). +// Literal delimiter will ultimately use y_absl::string_view::find(), and the +// AnyOf delimiter will use y_absl::string_view::find_first_of(). template <typename FindPolicy> -y_absl::string_view GenericFind(y_absl::string_view text, - y_absl::string_view delimiter, size_t pos, +y_absl::string_view GenericFind(y_absl::string_view text, + y_absl::string_view delimiter, size_t pos, FindPolicy find_policy) { if (delimiter.empty() && text.length() > 0) { // Special case for empty string delimiters: always return a zero-length - // y_absl::string_view referring to the item at position 1 past pos. - return y_absl::string_view(text.data() + pos + 1, 0); + // y_absl::string_view referring to the item at position 1 past pos. + return y_absl::string_view(text.data() + pos + 1, 0); } - size_t found_pos = y_absl::string_view::npos; - y_absl::string_view found(text.data() + text.size(), + size_t found_pos = y_absl::string_view::npos; + y_absl::string_view found(text.data() + text.size(), 0); // By default, not found found_pos = find_policy.Find(text, delimiter, pos); - if (found_pos != y_absl::string_view::npos) { - found = y_absl::string_view(text.data() + found_pos, + if (found_pos != y_absl::string_view::npos) { + found = y_absl::string_view(text.data() + found_pos, find_policy.Length(delimiter)); } return found; } -// Finds using y_absl::string_view::find(), therefore the length of the found +// Finds using y_absl::string_view::find(), therefore the length of the found // delimiter is delimiter.length(). struct LiteralPolicy { - size_t Find(y_absl::string_view text, y_absl::string_view delimiter, size_t pos) { + size_t Find(y_absl::string_view text, y_absl::string_view delimiter, size_t pos) { return text.find(delimiter, pos); } - size_t Length(y_absl::string_view delimiter) { return delimiter.length(); } + size_t Length(y_absl::string_view delimiter) { return delimiter.length(); } }; -// Finds using y_absl::string_view::find_first_of(), therefore the length of the +// Finds using y_absl::string_view::find_first_of(), therefore the length of the // found delimiter is 1. struct AnyOfPolicy { - size_t Find(y_absl::string_view text, y_absl::string_view delimiter, size_t pos) { + size_t Find(y_absl::string_view text, y_absl::string_view delimiter, size_t pos) { return text.find_first_of(delimiter, pos); } - size_t Length(y_absl::string_view /* delimiter */) { return 1; } + size_t Length(y_absl::string_view /* delimiter */) { return 1; } }; } // namespace @@ -81,15 +81,15 @@ struct AnyOfPolicy { // ByString // -ByString::ByString(y_absl::string_view sp) : delimiter_(sp) {} +ByString::ByString(y_absl::string_view sp) : delimiter_(sp) {} -y_absl::string_view ByString::Find(y_absl::string_view text, size_t pos) const { +y_absl::string_view ByString::Find(y_absl::string_view text, size_t pos) const { if (delimiter_.length() == 1) { // Much faster to call find on a single character than on an - // y_absl::string_view. + // y_absl::string_view. size_t found_pos = text.find(delimiter_[0], pos); - if (found_pos == y_absl::string_view::npos) - return y_absl::string_view(text.data() + text.size(), 0); + if (found_pos == y_absl::string_view::npos) + return y_absl::string_view(text.data() + text.size(), 0); return text.substr(found_pos, 1); } return GenericFind(text, delimiter_, pos, LiteralPolicy()); @@ -99,10 +99,10 @@ y_absl::string_view ByString::Find(y_absl::string_view text, size_t pos) const { // ByChar // -y_absl::string_view ByChar::Find(y_absl::string_view text, size_t pos) const { +y_absl::string_view ByChar::Find(y_absl::string_view text, size_t pos) const { size_t found_pos = text.find(c_, pos); - if (found_pos == y_absl::string_view::npos) - return y_absl::string_view(text.data() + text.size(), 0); + if (found_pos == y_absl::string_view::npos) + return y_absl::string_view(text.data() + text.size(), 0); return text.substr(found_pos, 1); } @@ -110,9 +110,9 @@ y_absl::string_view ByChar::Find(y_absl::string_view text, size_t pos) const { // ByAnyChar // -ByAnyChar::ByAnyChar(y_absl::string_view sp) : delimiters_(sp) {} +ByAnyChar::ByAnyChar(y_absl::string_view sp) : delimiters_(sp) {} -y_absl::string_view ByAnyChar::Find(y_absl::string_view text, size_t pos) const { +y_absl::string_view ByAnyChar::Find(y_absl::string_view text, size_t pos) const { return GenericFind(text, delimiters_, pos, AnyOfPolicy()); } @@ -123,17 +123,17 @@ ByLength::ByLength(ptrdiff_t length) : length_(length) { ABSL_RAW_CHECK(length > 0, ""); } -y_absl::string_view ByLength::Find(y_absl::string_view text, +y_absl::string_view ByLength::Find(y_absl::string_view text, size_t pos) const { pos = std::min(pos, text.size()); // truncate `pos` - y_absl::string_view substr = text.substr(pos); + y_absl::string_view substr = text.substr(pos); // If the string is shorter than the chunk size we say we // "can't find the delimiter" so this will be the last chunk. if (substr.length() <= static_cast<size_t>(length_)) - return y_absl::string_view(text.data() + text.size(), 0); + return y_absl::string_view(text.data() + text.size(), 0); - return y_absl::string_view(substr.data() + length_, 0); + return y_absl::string_view(substr.data() + length_, 0); } ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_split.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_split.h index d32d54813e..22176e418d 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_split.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/str_split.h @@ -27,7 +27,7 @@ // // // Splits the given string on commas. Returns the results in a // // vector of strings. -// std::vector<TString> v = y_absl::StrSplit("a,b,c", ','); +// std::vector<TString> v = y_absl::StrSplit("a,b,c", ','); // // Can also use "," // // v[0] == "a", v[1] == "b", v[2] == "c" // @@ -43,13 +43,13 @@ #include <utility> #include <vector> -#include "y_absl/base/internal/raw_logging.h" +#include "y_absl/base/internal/raw_logging.h" #include "y_absl/base/macros.h" -#include "y_absl/strings/internal/str_split_internal.h" -#include "y_absl/strings/string_view.h" -#include "y_absl/strings/strip.h" +#include "y_absl/strings/internal/str_split_internal.h" +#include "y_absl/strings/string_view.h" +#include "y_absl/strings/strip.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN //------------------------------------------------------------------------------ @@ -58,12 +58,12 @@ ABSL_NAMESPACE_BEGIN // // `StrSplit()` uses delimiters to define the boundaries between elements in the // provided input. Several `Delimiter` types are defined below. If a string -// (`const char*`, `TString`, or `y_absl::string_view`) is passed in place of +// (`const char*`, `TString`, or `y_absl::string_view`) is passed in place of // an explicit `Delimiter` object, `StrSplit()` treats it the same way as if it // were passed a `ByString` delimiter. // // A `Delimiter` is an object with a `Find()` function that knows how to find -// the first occurrence of itself in a given `y_absl::string_view`. +// the first occurrence of itself in a given `y_absl::string_view`. // // The following `Delimiter` types are available for use within `StrSplit()`: // @@ -75,16 +75,16 @@ ABSL_NAMESPACE_BEGIN // // A Delimiter's `Find()` member function will be passed an input `text` that is // to be split and a position (`pos`) to begin searching for the next delimiter -// in `text`. The returned y_absl::string_view should refer to the next occurrence -// (after `pos`) of the represented delimiter; this returned y_absl::string_view +// in `text`. The returned y_absl::string_view should refer to the next occurrence +// (after `pos`) of the represented delimiter; this returned y_absl::string_view // represents the next location where the input `text` should be broken. // -// The returned y_absl::string_view may be zero-length if the Delimiter does not +// The returned y_absl::string_view may be zero-length if the Delimiter does not // represent a part of the string (e.g., a fixed-length delimiter). If no -// delimiter is found in the input `text`, a zero-length y_absl::string_view +// delimiter is found in the input `text`, a zero-length y_absl::string_view // referring to `text.end()` should be returned (e.g., // `text.substr(text.size())`). It is important that the returned -// y_absl::string_view always be within the bounds of the input `text` given as an +// y_absl::string_view always be within the bounds of the input `text` given as an // argument--it must not refer to a string that is physically located outside of // the given string. // @@ -95,9 +95,9 @@ ABSL_NAMESPACE_BEGIN // struct SimpleDelimiter { // const char c_; // explicit SimpleDelimiter(char c) : c_(c) {} -// y_absl::string_view Find(y_absl::string_view text, size_t pos) { +// y_absl::string_view Find(y_absl::string_view text, size_t pos) { // auto found = text.find(c_, pos); -// if (found == y_absl::string_view::npos) +// if (found == y_absl::string_view::npos) // return text.substr(text.size()); // // return text.substr(found, 1); @@ -112,22 +112,22 @@ ABSL_NAMESPACE_BEGIN // // Example: // -// // Because a string literal is converted to an `y_absl::ByString`, +// // Because a string literal is converted to an `y_absl::ByString`, // // the following two splits are equivalent. // -// std::vector<TString> v1 = y_absl::StrSplit("a, b, c", ", "); +// std::vector<TString> v1 = y_absl::StrSplit("a, b, c", ", "); // -// using y_absl::ByString; -// std::vector<TString> v2 = y_absl::StrSplit("a, b, c", +// using y_absl::ByString; +// std::vector<TString> v2 = y_absl::StrSplit("a, b, c", // ByString(", ")); // // v[0] == "a", v[1] == "b", v[2] == "c" class ByString { public: - explicit ByString(y_absl::string_view sp); - y_absl::string_view Find(y_absl::string_view text, size_t pos) const; + explicit ByString(y_absl::string_view sp); + y_absl::string_view Find(y_absl::string_view text, size_t pos) const; private: - const TString delimiter_; + const TString delimiter_; }; // ByChar @@ -137,26 +137,26 @@ class ByString { // // Example: // -// // Because a char literal is converted to a y_absl::ByChar, +// // Because a char literal is converted to a y_absl::ByChar, // // the following two splits are equivalent. -// std::vector<TString> v1 = y_absl::StrSplit("a,b,c", ','); -// using y_absl::ByChar; -// std::vector<TString> v2 = y_absl::StrSplit("a,b,c", ByChar(',')); +// std::vector<TString> v1 = y_absl::StrSplit("a,b,c", ','); +// using y_absl::ByChar; +// std::vector<TString> v2 = y_absl::StrSplit("a,b,c", ByChar(',')); // // v[0] == "a", v[1] == "b", v[2] == "c" // // `ByChar` is also the default delimiter if a single character is given // as the delimiter to `StrSplit()`. For example, the following calls are // equivalent: // -// std::vector<TString> v = y_absl::StrSplit("a-b", '-'); +// std::vector<TString> v = y_absl::StrSplit("a-b", '-'); // -// using y_absl::ByChar; -// std::vector<TString> v = y_absl::StrSplit("a-b", ByChar('-')); +// using y_absl::ByChar; +// std::vector<TString> v = y_absl::StrSplit("a-b", ByChar('-')); // class ByChar { public: explicit ByChar(char c) : c_(c) {} - y_absl::string_view Find(y_absl::string_view text, size_t pos) const; + y_absl::string_view Find(y_absl::string_view text, size_t pos) const; private: char c_; @@ -172,8 +172,8 @@ class ByChar { // // Example: // -// using y_absl::ByAnyChar; -// std::vector<TString> v = y_absl::StrSplit("a,b=c", ByAnyChar(",=")); +// using y_absl::ByAnyChar; +// std::vector<TString> v = y_absl::StrSplit("a,b=c", ByAnyChar(",=")); // // v[0] == "a", v[1] == "b", v[2] == "c" // // If `ByAnyChar` is given the empty string, it behaves exactly like @@ -181,11 +181,11 @@ class ByChar { // class ByAnyChar { public: - explicit ByAnyChar(y_absl::string_view sp); - y_absl::string_view Find(y_absl::string_view text, size_t pos) const; + explicit ByAnyChar(y_absl::string_view sp); + y_absl::string_view Find(y_absl::string_view text, size_t pos) const; private: - const TString delimiters_; + const TString delimiters_; }; // ByLength @@ -198,22 +198,22 @@ class ByAnyChar { // // Example: // -// using y_absl::ByLength; -// std::vector<TString> v = y_absl::StrSplit("123456789", ByLength(3)); +// using y_absl::ByLength; +// std::vector<TString> v = y_absl::StrSplit("123456789", ByLength(3)); // // v[0] == "123", v[1] == "456", v[2] == "789" // // Note that the string does not have to be a multiple of the fixed split // length. In such a case, the last substring will be shorter. // -// using y_absl::ByLength; -// std::vector<TString> v = y_absl::StrSplit("12345", ByLength(2)); +// using y_absl::ByLength; +// std::vector<TString> v = y_absl::StrSplit("12345", ByLength(2)); // // // v[0] == "12", v[1] == "34", v[2] == "5" class ByLength { public: explicit ByLength(ptrdiff_t length); - y_absl::string_view Find(y_absl::string_view text, size_t pos) const; + y_absl::string_view Find(y_absl::string_view text, size_t pos) const; private: const ptrdiff_t length_; @@ -225,7 +225,7 @@ namespace strings_internal { // for a particular Delimiter type. The base case simply exposes type Delimiter // itself as the delimiter's Type. However, there are specializations for // string-like objects that map them to the ByString delimiter object. -// This allows functions like y_absl::StrSplit() and y_absl::MaxSplits() to accept +// This allows functions like y_absl::StrSplit() and y_absl::MaxSplits() to accept // string-like objects (e.g., ',') as delimiter arguments but they will be // treated as if a ByString delimiter was given. template <typename Delimiter> @@ -246,11 +246,11 @@ struct SelectDelimiter<const char*> { using type = ByString; }; template <> -struct SelectDelimiter<y_absl::string_view> { +struct SelectDelimiter<y_absl::string_view> { using type = ByString; }; template <> -struct SelectDelimiter<TString> { +struct SelectDelimiter<TString> { using type = ByString; }; @@ -260,9 +260,9 @@ class MaxSplitsImpl { public: MaxSplitsImpl(Delimiter delimiter, int limit) : delimiter_(delimiter), limit_(limit), count_(0) {} - y_absl::string_view Find(y_absl::string_view text, size_t pos) { + y_absl::string_view Find(y_absl::string_view text, size_t pos) { if (count_++ == limit_) { - return y_absl::string_view(text.data() + text.size(), + return y_absl::string_view(text.data() + text.size(), 0); // No more matches. } return delimiter_.Find(text, pos); @@ -284,8 +284,8 @@ class MaxSplitsImpl { // The collection will contain at most `limit` + 1 elements. // Example: // -// using y_absl::MaxSplits; -// std::vector<TString> v = y_absl::StrSplit("a,b,c", MaxSplits(',', 1)); +// using y_absl::MaxSplits; +// std::vector<TString> v = y_absl::StrSplit("a,b,c", MaxSplits(',', 1)); // // // v[0] == "a", v[1] == "b,c" template <typename Delimiter> @@ -307,7 +307,7 @@ MaxSplits(Delimiter delimiter, int limit) { // as an optional third argument to the `StrSplit()` function. // // Predicates are unary functions (or functors) that take a single -// `y_absl::string_view` argument and return a bool indicating whether the +// `y_absl::string_view` argument and return a bool indicating whether the // argument should be included (`true`) or excluded (`false`). // // Predicates are useful when filtering out empty substrings. By default, empty @@ -323,21 +323,21 @@ MaxSplits(Delimiter delimiter, int limit) { // // Example: // -// std::vector<TString> v = y_absl::StrSplit(" a , ,,b,", ',', AllowEmpty()); +// std::vector<TString> v = y_absl::StrSplit(" a , ,,b,", ',', AllowEmpty()); // // // v[0] == " a ", v[1] == " ", v[2] == "", v[3] = "b", v[4] == "" struct AllowEmpty { - bool operator()(y_absl::string_view) const { return true; } + bool operator()(y_absl::string_view) const { return true; } }; // SkipEmpty() // -// Returns `false` if the given `y_absl::string_view` is empty, indicating that +// Returns `false` if the given `y_absl::string_view` is empty, indicating that // `StrSplit()` should omit the empty string. // // Example: // -// std::vector<TString> v = y_absl::StrSplit(",a,,b,", ',', SkipEmpty()); +// std::vector<TString> v = y_absl::StrSplit(",a,,b,", ',', SkipEmpty()); // // // v[0] == "a", v[1] == "b" // @@ -345,26 +345,26 @@ struct AllowEmpty { // to be empty. To skip such whitespace as well, use the `SkipWhitespace()` // predicate. struct SkipEmpty { - bool operator()(y_absl::string_view sp) const { return !sp.empty(); } + bool operator()(y_absl::string_view sp) const { return !sp.empty(); } }; // SkipWhitespace() // -// Returns `false` if the given `y_absl::string_view` is empty *or* contains only +// Returns `false` if the given `y_absl::string_view` is empty *or* contains only // whitespace, indicating that `StrSplit()` should omit the string. // // Example: // -// std::vector<TString> v = y_absl::StrSplit(" a , ,,b,", +// std::vector<TString> v = y_absl::StrSplit(" a , ,,b,", // ',', SkipWhitespace()); // // v[0] == " a ", v[1] == "b" // // // SkipEmpty() would return whitespace elements -// std::vector<TString> v = y_absl::StrSplit(" a , ,,b,", ',', SkipEmpty()); +// std::vector<TString> v = y_absl::StrSplit(" a , ,,b,", ',', SkipEmpty()); // // v[0] == " a ", v[1] == " ", v[2] == "b" struct SkipWhitespace { - bool operator()(y_absl::string_view sp) const { - sp = y_absl::StripAsciiWhitespace(sp); + bool operator()(y_absl::string_view sp) const { + sp = y_absl::StripAsciiWhitespace(sp); return !sp.empty(); } }; @@ -389,15 +389,15 @@ using EnableSplitIfString = // // Example: // -// std::vector<TString> v = y_absl::StrSplit("a,b,c,d", ','); +// std::vector<TString> v = y_absl::StrSplit("a,b,c,d", ','); // // v[0] == "a", v[1] == "b", v[2] == "c", v[3] == "d" // // You can also provide an explicit `Delimiter` object: // // Example: // -// using y_absl::ByAnyChar; -// std::vector<TString> v = y_absl::StrSplit("a,b=c", ByAnyChar(",=")); +// using y_absl::ByAnyChar; +// std::vector<TString> v = y_absl::StrSplit("a,b=c", ByAnyChar(",=")); // // v[0] == "a", v[1] == "b", v[2] == "c" // // See above for more information on delimiters. @@ -408,7 +408,7 @@ using EnableSplitIfString = // // Example: // -// std::vector<TString> v = y_absl::StrSplit(" a , ,,b,", +// std::vector<TString> v = y_absl::StrSplit(" a , ,,b,", // ',', SkipWhitespace()); // // v[0] == " a ", v[1] == "b" // @@ -420,9 +420,9 @@ using EnableSplitIfString = // // The `StrSplit()` function adapts the returned collection to the collection // specified by the caller (e.g. `std::vector` above). The returned collections -// may contain `TString`, `y_absl::string_view` (in which case the original +// may contain `TString`, `y_absl::string_view` (in which case the original // string being split must ensure that it outlives the collection), or any -// object that can be explicitly created from an `y_absl::string_view`. This +// object that can be explicitly created from an `y_absl::string_view`. This // behavior works for: // // 1) All standard STL containers including `std::vector`, `std::list`, @@ -431,19 +431,19 @@ using EnableSplitIfString = // // Example: // -// // The results are returned as `y_absl::string_view` objects. Note that we +// // The results are returned as `y_absl::string_view` objects. Note that we // // have to ensure that the input string outlives any results. -// std::vector<y_absl::string_view> v = y_absl::StrSplit("a,b,c", ','); +// std::vector<y_absl::string_view> v = y_absl::StrSplit("a,b,c", ','); // -// // Stores results in a std::set<TString>, which also performs +// // Stores results in a std::set<TString>, which also performs // // de-duplication and orders the elements in ascending order. -// std::set<TString> a = y_absl::StrSplit("b,a,c,a,b", ','); +// std::set<TString> a = y_absl::StrSplit("b,a,c,a,b", ','); // // v[0] == "a", v[1] == "b", v[2] = "c" // // // `StrSplit()` can be used within a range-based for loop, in which case -// // each element will be of type `y_absl::string_view`. -// std::vector<TString> v; -// for (const auto sv : y_absl::StrSplit("a,b,c", ',')) { +// // each element will be of type `y_absl::string_view`. +// std::vector<TString> v; +// for (const auto sv : y_absl::StrSplit("a,b,c", ',')) { // if (sv != "b") v.emplace_back(sv); // } // // v[0] == "a", v[1] == "c" @@ -453,7 +453,7 @@ using EnableSplitIfString = // // resulting from the split will be stored as a key to the 1st element. If // // an odd number of elements are resolved, the last element is paired with // // a default-constructed value (e.g., empty string). -// std::map<TString, TString> m = y_absl::StrSplit("a,b,c", ','); +// std::map<TString, TString> m = y_absl::StrSplit("a,b,c", ','); // // m["a"] == "b", m["c"] == "" // last component value equals "" // // Splitting to `std::pair` is an interesting case because it can hold only two @@ -467,7 +467,7 @@ using EnableSplitIfString = // Example: // // // Stores first two split strings as the members in a std::pair. -// std::pair<TString, TString> p = y_absl::StrSplit("a,b,c", ','); +// std::pair<TString, TString> p = y_absl::StrSplit("a,b,c", ','); // // p.first == "a", p.second == "b" // "c" is omitted. // // The `StrSplit()` function can be used multiple times to perform more @@ -477,9 +477,9 @@ using EnableSplitIfString = // // // The input string "a=b=c,d=e,f=,g" becomes // // { "a" => "b=c", "d" => "e", "f" => "", "g" => "" } -// std::map<TString, TString> m; -// for (y_absl::string_view sp : y_absl::StrSplit("a=b=c,d=e,f=,g", ',')) { -// m.insert(y_absl::StrSplit(sp, y_absl::MaxSplits('=', 1))); +// std::map<TString, TString> m; +// for (y_absl::string_view sp : y_absl::StrSplit("a=b=c,d=e,f=,g", ',')) { +// m.insert(y_absl::StrSplit(sp, y_absl::MaxSplits('=', 1))); // } // EXPECT_EQ("b=c", m.find("a")->second); // EXPECT_EQ("e", m.find("d")->second); @@ -489,8 +489,8 @@ using EnableSplitIfString = // WARNING: Due to a legacy bug that is maintained for backward compatibility, // splitting the following empty string_views produces different results: // -// y_absl::StrSplit(y_absl::string_view(""), '-'); // {""} -// y_absl::StrSplit(y_absl::string_view(), '-'); // {}, but should be {""} +// y_absl::StrSplit(y_absl::string_view(""), '-'); // {""} +// y_absl::StrSplit(y_absl::string_view(), '-'); // {}, but should be {""} // // Try not to depend on this distinction because the bug may one day be fixed. template <typename Delimiter> @@ -543,6 +543,6 @@ StrSplit(StringType&& text, Delimiter d, Predicate p) { } ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_STR_SPLIT_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/string_view.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/string_view.cc index 9893c7ab99..aa7fcc318b 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/string_view.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/string_view.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/string_view.h" +#include "y_absl/strings/string_view.h" #ifndef ABSL_USES_STD_STRING_VIEW @@ -21,9 +21,9 @@ #include <cstring> #include <ostream> -#include "y_absl/strings/internal/memutil.h" +#include "y_absl/strings/internal/memutil.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace { @@ -225,6 +225,6 @@ ABSL_STRING_VIEW_SELECTANY constexpr string_view::size_type string_view::kMaxSize; ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_USES_STD_STRING_VIEW diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/string_view.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/string_view.h index c3906fe1c5..d1369e2d08 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/string_view.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/string_view.h @@ -17,12 +17,12 @@ // File: string_view.h // ----------------------------------------------------------------------------- // -// This file contains the definition of the `y_absl::string_view` class. A +// This file contains the definition of the `y_absl::string_view` class. A // `string_view` points to a contiguous span of characters, often part or all of -// another `TString`, double-quoted string literal, character array, or even +// another `TString`, double-quoted string literal, character array, or even // another `string_view`. // -// This `y_absl::string_view` abstraction is designed to be a drop-in +// This `y_absl::string_view` abstraction is designed to be a drop-in // replacement for the C++17 `std::string_view` abstraction. #ifndef ABSL_STRINGS_STRING_VIEW_H_ #define ABSL_STRINGS_STRING_VIEW_H_ @@ -37,7 +37,7 @@ #include <util/generic/string.h> #include "y_absl/base/attributes.h" -#include "y_absl/base/config.h" +#include "y_absl/base/config.h" #include "y_absl/base/internal/throw_delegate.h" #include "y_absl/base/macros.h" #include "y_absl/base/optimization.h" @@ -47,16 +47,16 @@ #include <string_view> // IWYU pragma: export -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN using string_view = std::string_view; ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #else // ABSL_USES_STD_STRING_VIEW -#error "std::string_view should be used in all configurations" - +#error "std::string_view should be used in all configurations" + #if ABSL_HAVE_BUILTIN(__builtin_memcmp) || \ (defined(__GNUC__) && !defined(__clang__)) #define ABSL_INTERNAL_STRING_VIEW_MEMCMP __builtin_memcmp @@ -70,29 +70,29 @@ ABSL_NAMESPACE_END #define ABSL_INTERNAL_STRING_VIEW_CXX14_CONSTEXPR #endif -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN -// y_absl::string_view +// y_absl::string_view // // A `string_view` provides a lightweight view into the string data provided by -// a `TString`, double-quoted string literal, character array, or even +// a `TString`, double-quoted string literal, character array, or even // another `string_view`. A `string_view` does *not* own the string to which it // points, and that data cannot be modified through the view. // // You can use `string_view` as a function or method parameter anywhere a // parameter can receive a double-quoted string literal, `const char*`, -// `TString`, or another `y_absl::string_view` argument with no need to copy +// `TString`, or another `y_absl::string_view` argument with no need to copy // the string data. Systematic use of `string_view` within function arguments // reduces data copies and `strlen()` calls. // // Because of its small size, prefer passing `string_view` by value: // -// void MyFunction(y_absl::string_view arg); +// void MyFunction(y_absl::string_view arg); // // If circumstances require, you may also pass one by const reference: // -// void MyFunction(const y_absl::string_view& arg); // not preferred +// void MyFunction(const y_absl::string_view& arg); // not preferred // // Passing by value generates slightly smaller code for many architectures. // @@ -105,11 +105,11 @@ ABSL_NAMESPACE_BEGIN // temporary value: // // // BAD use of string_view: lifetime problem -// y_absl::string_view sv = obj.ReturnAString(); +// y_absl::string_view sv = obj.ReturnAString(); // // // GOOD use of string_view: str outlives sv -// TString str = obj.ReturnAString(); -// y_absl::string_view sv = str; +// TString str = obj.ReturnAString(); +// y_absl::string_view sv = str; // // Due to lifetime issues, a `string_view` is sometimes a poor choice for a // return value and usually a poor choice for a data member. If you do use a @@ -117,7 +117,7 @@ ABSL_NAMESPACE_BEGIN // pointed to by the `string_view` outlives the `string_view`. // // A `string_view` may represent a whole string or just part of a string. For -// example, when splitting a string, `std::vector<y_absl::string_view>` is a +// example, when splitting a string, `std::vector<y_absl::string_view>` is a // natural data type for the output. // // For another example, a Cord is a non-contiguous, potentially very @@ -136,7 +136,7 @@ ABSL_NAMESPACE_BEGIN // You may create a null `string_view` in two ways: // // y_absl::string_view sv; -// y_absl::string_view sv(nullptr, 0); +// y_absl::string_view sv(nullptr, 0); // // For the above, `sv.data() == nullptr`, `sv.length() == 0`, and // `sv.empty() == true`. Also, if you create a `string_view` with a non-null @@ -154,17 +154,17 @@ ABSL_NAMESPACE_BEGIN // // const char* nullcp = nullptr; // // string_view.size() will return 0 in all cases. -// y_absl::string_view(); -// y_absl::string_view(nullcp, 0); -// y_absl::string_view(""); -// y_absl::string_view("", 0); -// y_absl::string_view("abcdef", 0); -// y_absl::string_view("abcdef" + 6, 0); +// y_absl::string_view(); +// y_absl::string_view(nullcp, 0); +// y_absl::string_view(""); +// y_absl::string_view("", 0); +// y_absl::string_view("abcdef", 0); +// y_absl::string_view("abcdef" + 6, 0); // // All empty `string_view` objects whether null or not, are equal: // -// y_absl::string_view() == y_absl::string_view("", 0) -// y_absl::string_view(nullptr, 0) == y_absl::string_view("abcdef"+6, 0) +// y_absl::string_view() == y_absl::string_view("", 0) +// y_absl::string_view(nullptr, 0) == y_absl::string_view("abcdef"+6, 0) class string_view { public: using traits_type = std::char_traits<char>; @@ -198,7 +198,7 @@ class string_view { : string_view(str.data(), str.size(), SkipCheckLengthTag{}) {} // Implicit constructor of a `string_view` from NUL-terminated `str`. When - // accepting possibly null strings, use `y_absl::NullSafeStringView(str)` + // accepting possibly null strings, use `y_absl::NullSafeStringView(str)` // instead (see below). // The length check is skipped since it is unnecessary and causes code bloat. constexpr string_view(const char* str) // NOLINT(runtime/explicit) @@ -309,7 +309,7 @@ class string_view { return ABSL_PREDICT_TRUE(i < size()) ? ptr_[i] : ((void)base_internal::ThrowStdOutOfRange( - "y_absl::string_view::at"), + "y_absl::string_view::at"), ptr_[i]); } @@ -381,7 +381,7 @@ class string_view { // into `buf`. size_type copy(char* buf, size_type n, size_type pos = 0) const { if (ABSL_PREDICT_FALSE(pos > length_)) { - base_internal::ThrowStdOutOfRange("y_absl::string_view::copy"); + base_internal::ThrowStdOutOfRange("y_absl::string_view::copy"); } size_type rlen = (std::min)(length_ - pos, n); if (rlen > 0) { @@ -420,13 +420,13 @@ class string_view { } // Overload of `string_view::compare()` for comparing a substring of the - // 'string_view` and another `y_absl::string_view`. + // 'string_view` and another `y_absl::string_view`. constexpr int compare(size_type pos1, size_type count1, string_view v) const { return substr(pos1, count1).compare(v); } // Overload of `string_view::compare()` for comparing a substring of the - // `string_view` and a substring of another `y_absl::string_view`. + // `string_view` and a substring of another `y_absl::string_view`. constexpr int compare(size_type pos1, size_type count1, string_view v, size_type pos2, size_type count2) const { return substr(pos1, count1).compare(v.substr(pos2, count2)); @@ -677,14 +677,14 @@ constexpr bool operator>=(string_view x, string_view y) noexcept { std::ostream& operator<<(std::ostream& o, string_view piece); ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #undef ABSL_INTERNAL_STRING_VIEW_CXX14_CONSTEXPR #undef ABSL_INTERNAL_STRING_VIEW_MEMCMP #endif // ABSL_USES_STD_STRING_VIEW -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN // ClippedSubstr() @@ -699,14 +699,14 @@ inline string_view ClippedSubstr(string_view s, size_t pos, // NullSafeStringView() // -// Creates an `y_absl::string_view` from a pointer `p` even if it's null-valued. -// This function should be used where an `y_absl::string_view` can be created from +// Creates an `y_absl::string_view` from a pointer `p` even if it's null-valued. +// This function should be used where an `y_absl::string_view` can be created from // a possibly-null pointer. constexpr string_view NullSafeStringView(const char* p) { return p ? string_view(p) : string_view(); } ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_STRING_VIEW_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/strip.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/strip.h index 3164ff1ebc..32558b3809 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/strip.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/strip.h @@ -24,12 +24,12 @@ #include <cstddef> #include <util/generic/string.h> -#include "y_absl/base/macros.h" -#include "y_absl/strings/ascii.h" -#include "y_absl/strings/match.h" -#include "y_absl/strings/string_view.h" +#include "y_absl/base/macros.h" +#include "y_absl/strings/ascii.h" +#include "y_absl/strings/match.h" +#include "y_absl/strings/string_view.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN // ConsumePrefix() @@ -39,11 +39,11 @@ ABSL_NAMESPACE_BEGIN // // Example: // -// y_absl::string_view input("abc"); -// EXPECT_TRUE(y_absl::ConsumePrefix(&input, "a")); +// y_absl::string_view input("abc"); +// EXPECT_TRUE(y_absl::ConsumePrefix(&input, "a")); // EXPECT_EQ(input, "bc"); -inline bool ConsumePrefix(y_absl::string_view* str, y_absl::string_view expected) { - if (!y_absl::StartsWith(*str, expected)) return false; +inline bool ConsumePrefix(y_absl::string_view* str, y_absl::string_view expected) { + if (!y_absl::StartsWith(*str, expected)) return false; str->remove_prefix(expected.size()); return true; } @@ -54,11 +54,11 @@ inline bool ConsumePrefix(y_absl::string_view* str, y_absl::string_view expected // // Example: // -// y_absl::string_view input("abcdef"); -// EXPECT_TRUE(y_absl::ConsumeSuffix(&input, "def")); +// y_absl::string_view input("abcdef"); +// EXPECT_TRUE(y_absl::ConsumeSuffix(&input, "def")); // EXPECT_EQ(input, "abc"); -inline bool ConsumeSuffix(y_absl::string_view* str, y_absl::string_view expected) { - if (!y_absl::EndsWith(*str, expected)) return false; +inline bool ConsumeSuffix(y_absl::string_view* str, y_absl::string_view expected) { + if (!y_absl::EndsWith(*str, expected)) return false; str->remove_suffix(expected.size()); return true; } @@ -68,9 +68,9 @@ inline bool ConsumeSuffix(y_absl::string_view* str, y_absl::string_view expected // Returns a view into the input string 'str' with the given 'prefix' removed, // but leaving the original string intact. If the prefix does not match at the // start of the string, returns the original string instead. -ABSL_MUST_USE_RESULT inline y_absl::string_view StripPrefix( - y_absl::string_view str, y_absl::string_view prefix) { - if (y_absl::StartsWith(str, prefix)) str.remove_prefix(prefix.size()); +ABSL_MUST_USE_RESULT inline y_absl::string_view StripPrefix( + y_absl::string_view str, y_absl::string_view prefix) { + if (y_absl::StartsWith(str, prefix)) str.remove_prefix(prefix.size()); return str; } @@ -79,13 +79,13 @@ ABSL_MUST_USE_RESULT inline y_absl::string_view StripPrefix( // Returns a view into the input string 'str' with the given 'suffix' removed, // but leaving the original string intact. If the suffix does not match at the // end of the string, returns the original string instead. -ABSL_MUST_USE_RESULT inline y_absl::string_view StripSuffix( - y_absl::string_view str, y_absl::string_view suffix) { - if (y_absl::EndsWith(str, suffix)) str.remove_suffix(suffix.size()); +ABSL_MUST_USE_RESULT inline y_absl::string_view StripSuffix( + y_absl::string_view str, y_absl::string_view suffix) { + if (y_absl::EndsWith(str, suffix)) str.remove_suffix(suffix.size()); return str; } ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_STRIP_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/substitute.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/substitute.cc index 177fba8cbe..ad6f1d1e75 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/substitute.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/substitute.cc @@ -12,22 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/strings/substitute.h" +#include "y_absl/strings/substitute.h" #include <algorithm> -#include "y_absl/base/internal/raw_logging.h" -#include "y_absl/strings/ascii.h" -#include "y_absl/strings/escaping.h" -#include "y_absl/strings/internal/resize_uninitialized.h" -#include "y_absl/strings/string_view.h" +#include "y_absl/base/internal/raw_logging.h" +#include "y_absl/strings/ascii.h" +#include "y_absl/strings/escaping.h" +#include "y_absl/strings/internal/resize_uninitialized.h" +#include "y_absl/strings/string_view.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace substitute_internal { -void SubstituteAndAppendArray(TString* output, y_absl::string_view format, - const y_absl::string_view* args_array, +void SubstituteAndAppendArray(TString* output, y_absl::string_view format, + const y_absl::string_view* args_array, size_t num_args) { // Determine total size needed. size_t size = 0; @@ -37,10 +37,10 @@ void SubstituteAndAppendArray(TString* output, y_absl::string_view format, #ifndef NDEBUG ABSL_RAW_LOG(FATAL, "Invalid y_absl::Substitute() format string: \"%s\".", - y_absl::CEscape(format).c_str()); + y_absl::CEscape(format).c_str()); #endif return; - } else if (y_absl::ascii_isdigit(format[i + 1])) { + } else if (y_absl::ascii_isdigit(format[i + 1])) { int index = format[i + 1] - '0'; if (static_cast<size_t>(index) >= num_args) { #ifndef NDEBUG @@ -49,7 +49,7 @@ void SubstituteAndAppendArray(TString* output, y_absl::string_view format, "Invalid y_absl::Substitute() format string: asked for \"$" "%d\", but only %d args were given. Full format string was: " "\"%s\".", - index, static_cast<int>(num_args), y_absl::CEscape(format).c_str()); + index, static_cast<int>(num_args), y_absl::CEscape(format).c_str()); #endif return; } @@ -62,7 +62,7 @@ void SubstituteAndAppendArray(TString* output, y_absl::string_view format, #ifndef NDEBUG ABSL_RAW_LOG(FATAL, "Invalid y_absl::Substitute() format string: \"%s\".", - y_absl::CEscape(format).c_str()); + y_absl::CEscape(format).c_str()); #endif return; } @@ -80,8 +80,8 @@ void SubstituteAndAppendArray(TString* output, y_absl::string_view format, char* target = &(*output)[original_size]; for (size_t i = 0; i < format.size(); i++) { if (format[i] == '$') { - if (y_absl::ascii_isdigit(format[i + 1])) { - const y_absl::string_view src = args_array[format[i + 1] - '0']; + if (y_absl::ascii_isdigit(format[i + 1])) { + const y_absl::string_view src = args_array[format[i + 1] - '0']; target = std::copy(src.begin(), src.end(), target); ++i; // Skip next char. } else if (format[i + 1] == '$') { @@ -105,12 +105,12 @@ Arg::Arg(const void* value) { char* ptr = scratch_ + sizeof(scratch_); uintptr_t num = reinterpret_cast<uintptr_t>(value); do { - *--ptr = y_absl::numbers_internal::kHexChar[num & 0xf]; + *--ptr = y_absl::numbers_internal::kHexChar[num & 0xf]; num >>= 4; } while (num != 0); *--ptr = 'x'; *--ptr = '0'; - piece_ = y_absl::string_view(ptr, scratch_ + sizeof(scratch_) - ptr); + piece_ = y_absl::string_view(ptr, scratch_ + sizeof(scratch_) - ptr); } } @@ -120,7 +120,7 @@ Arg::Arg(Hex hex) { char* writer = end; uint64_t value = hex.value; do { - *--writer = y_absl::numbers_internal::kHexChar[value & 0xF]; + *--writer = y_absl::numbers_internal::kHexChar[value & 0xF]; value >>= 4; } while (value != 0); @@ -132,7 +132,7 @@ Arg::Arg(Hex hex) { beg = writer; } - piece_ = y_absl::string_view(beg, end - beg); + piece_ = y_absl::string_view(beg, end - beg); } // TODO(jorg): Don't duplicate so much code between here and str_cat.cc @@ -164,9 +164,9 @@ Arg::Arg(Dec dec) { if (add_sign_again) *--writer = '-'; } - piece_ = y_absl::string_view(writer, end - writer); + piece_ = y_absl::string_view(writer, end - writer); } } // namespace substitute_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/substitute.h b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/substitute.h index c31191fbda..f92369d2e2 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/substitute.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/substitute.h @@ -39,17 +39,17 @@ // output. // // Example 1: -// TString s = Substitute("$1 purchased $0 $2 for $$10. Thanks $1!", +// TString s = Substitute("$1 purchased $0 $2 for $$10. Thanks $1!", // 5, "Bob", "Apples"); // EXPECT_EQ("Bob purchased 5 Apples for $10. Thanks Bob!", s); // // Example 2: -// TString s = "Hi. "; +// TString s = "Hi. "; // SubstituteAndAppend(&s, "My name is $0 and I am $1 years old.", "Bob", 5); // EXPECT_EQ("Hi. My name is Bob and I am 5 years old.", s); // // Supported types: -// * y_absl::string_view, TString, const char* (null is equivalent to "") +// * y_absl::string_view, TString, const char* (null is equivalent to "") // * int32_t, int64_t, uint32_t, uint64_t // * float, double // * bool (Printed as "true" or "false") @@ -75,24 +75,24 @@ #include <type_traits> #include <vector> -#include "y_absl/base/macros.h" -#include "y_absl/base/port.h" -#include "y_absl/strings/ascii.h" -#include "y_absl/strings/escaping.h" -#include "y_absl/strings/numbers.h" -#include "y_absl/strings/str_cat.h" -#include "y_absl/strings/str_split.h" -#include "y_absl/strings/string_view.h" -#include "y_absl/strings/strip.h" - -namespace y_absl { +#include "y_absl/base/macros.h" +#include "y_absl/base/port.h" +#include "y_absl/strings/ascii.h" +#include "y_absl/strings/escaping.h" +#include "y_absl/strings/numbers.h" +#include "y_absl/strings/str_cat.h" +#include "y_absl/strings/str_split.h" +#include "y_absl/strings/string_view.h" +#include "y_absl/strings/strip.h" + +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace substitute_internal { // Arg // -// This class provides an argument type for `y_absl::Substitute()` and -// `y_absl::SubstituteAndAppend()`. `Arg` handles implicit conversion of various +// This class provides an argument type for `y_absl::Substitute()` and +// `y_absl::SubstituteAndAppend()`. `Arg` handles implicit conversion of various // types to a string. (`Arg` is very similar to the `AlphaNum` class in // `StrCat()`.) // @@ -103,16 +103,16 @@ class Arg { // // Explicitly overload `const char*` so the compiler doesn't cast to `bool`. Arg(const char* value) // NOLINT(runtime/explicit) - : piece_(y_absl::NullSafeStringView(value)) {} + : piece_(y_absl::NullSafeStringView(value)) {} template <typename Allocator> Arg( // NOLINT const std::basic_string<char, std::char_traits<char>, Allocator>& value) noexcept : piece_(value) {} - Arg(y_absl::string_view value) // NOLINT(runtime/explicit) + Arg(y_absl::string_view value) // NOLINT(runtime/explicit) : piece_(value) {} - Arg(const TString& s) - : piece_(s.data(), s.size()) {} + Arg(const TString& s) + : piece_(s.data(), s.size()) {} // Overloads for primitives // @@ -164,7 +164,7 @@ class Arg { // vector<bool>::reference and const_reference require special help to // convert to `AlphaNum` because it requires two user defined conversions. template <typename T, - y_absl::enable_if_t< + y_absl::enable_if_t< std::is_class<T>::value && (std::is_same<T, std::vector<bool>::reference>::value || std::is_same<T, std::vector<bool>::const_reference>::value)>* = @@ -179,17 +179,17 @@ class Arg { Arg(const Arg&) = delete; Arg& operator=(const Arg&) = delete; - y_absl::string_view piece() const { return piece_; } + y_absl::string_view piece() const { return piece_; } private: - y_absl::string_view piece_; + y_absl::string_view piece_; char scratch_[numbers_internal::kFastToBufferSize]; }; // Internal helper function. Don't call this from outside this implementation. // This interface may change without notice. -void SubstituteAndAppendArray(TString* output, y_absl::string_view format, - const y_absl::string_view* args_array, +void SubstituteAndAppendArray(TString* output, y_absl::string_view format, + const y_absl::string_view* args_array, size_t num_args); #if defined(ABSL_BAD_CALL_IF) @@ -234,76 +234,76 @@ constexpr int PlaceholderBitmask(const char* format) { // // Example: // template <typename... Args> -// void VarMsg(TString* boilerplate, y_absl::string_view format, +// void VarMsg(TString* boilerplate, y_absl::string_view format, // const Args&... args) { -// y_absl::SubstituteAndAppend(boilerplate, format, args...); +// y_absl::SubstituteAndAppend(boilerplate, format, args...); // } // -inline void SubstituteAndAppend(TString* output, y_absl::string_view format) { +inline void SubstituteAndAppend(TString* output, y_absl::string_view format) { substitute_internal::SubstituteAndAppendArray(output, format, nullptr, 0); } -inline void SubstituteAndAppend(TString* output, y_absl::string_view format, +inline void SubstituteAndAppend(TString* output, y_absl::string_view format, const substitute_internal::Arg& a0) { - const y_absl::string_view args[] = {a0.piece()}; + const y_absl::string_view args[] = {a0.piece()}; substitute_internal::SubstituteAndAppendArray(output, format, args, ABSL_ARRAYSIZE(args)); } -inline void SubstituteAndAppend(TString* output, y_absl::string_view format, +inline void SubstituteAndAppend(TString* output, y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1) { - const y_absl::string_view args[] = {a0.piece(), a1.piece()}; + const y_absl::string_view args[] = {a0.piece(), a1.piece()}; substitute_internal::SubstituteAndAppendArray(output, format, args, ABSL_ARRAYSIZE(args)); } -inline void SubstituteAndAppend(TString* output, y_absl::string_view format, +inline void SubstituteAndAppend(TString* output, y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2) { - const y_absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece()}; + const y_absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece()}; substitute_internal::SubstituteAndAppendArray(output, format, args, ABSL_ARRAYSIZE(args)); } -inline void SubstituteAndAppend(TString* output, y_absl::string_view format, +inline void SubstituteAndAppend(TString* output, y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3) { - const y_absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(), + const y_absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(), a3.piece()}; substitute_internal::SubstituteAndAppendArray(output, format, args, ABSL_ARRAYSIZE(args)); } -inline void SubstituteAndAppend(TString* output, y_absl::string_view format, +inline void SubstituteAndAppend(TString* output, y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, const substitute_internal::Arg& a4) { - const y_absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(), + const y_absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(), a3.piece(), a4.piece()}; substitute_internal::SubstituteAndAppendArray(output, format, args, ABSL_ARRAYSIZE(args)); } -inline void SubstituteAndAppend(TString* output, y_absl::string_view format, +inline void SubstituteAndAppend(TString* output, y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, const substitute_internal::Arg& a4, const substitute_internal::Arg& a5) { - const y_absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(), + const y_absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(), a3.piece(), a4.piece(), a5.piece()}; substitute_internal::SubstituteAndAppendArray(output, format, args, ABSL_ARRAYSIZE(args)); } -inline void SubstituteAndAppend(TString* output, y_absl::string_view format, +inline void SubstituteAndAppend(TString* output, y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, @@ -311,7 +311,7 @@ inline void SubstituteAndAppend(TString* output, y_absl::string_view format, const substitute_internal::Arg& a4, const substitute_internal::Arg& a5, const substitute_internal::Arg& a6) { - const y_absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(), + const y_absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(), a3.piece(), a4.piece(), a5.piece(), a6.piece()}; substitute_internal::SubstituteAndAppendArray(output, format, args, @@ -319,12 +319,12 @@ inline void SubstituteAndAppend(TString* output, y_absl::string_view format, } inline void SubstituteAndAppend( - TString* output, y_absl::string_view format, + TString* output, y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, const substitute_internal::Arg& a4, const substitute_internal::Arg& a5, const substitute_internal::Arg& a6, const substitute_internal::Arg& a7) { - const y_absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(), + const y_absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(), a3.piece(), a4.piece(), a5.piece(), a6.piece(), a7.piece()}; substitute_internal::SubstituteAndAppendArray(output, format, args, @@ -332,13 +332,13 @@ inline void SubstituteAndAppend( } inline void SubstituteAndAppend( - TString* output, y_absl::string_view format, + TString* output, y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, const substitute_internal::Arg& a4, const substitute_internal::Arg& a5, const substitute_internal::Arg& a6, const substitute_internal::Arg& a7, const substitute_internal::Arg& a8) { - const y_absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(), + const y_absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(), a3.piece(), a4.piece(), a5.piece(), a6.piece(), a7.piece(), a8.piece()}; substitute_internal::SubstituteAndAppendArray(output, format, args, @@ -346,13 +346,13 @@ inline void SubstituteAndAppend( } inline void SubstituteAndAppend( - TString* output, y_absl::string_view format, + TString* output, y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, const substitute_internal::Arg& a4, const substitute_internal::Arg& a5, const substitute_internal::Arg& a6, const substitute_internal::Arg& a7, const substitute_internal::Arg& a8, const substitute_internal::Arg& a9) { - const y_absl::string_view args[] = { + const y_absl::string_view args[] = { a0.piece(), a1.piece(), a2.piece(), a3.piece(), a4.piece(), a5.piece(), a6.piece(), a7.piece(), a8.piece(), a9.piece()}; substitute_internal::SubstituteAndAppendArray(output, format, args, @@ -362,14 +362,14 @@ inline void SubstituteAndAppend( #if defined(ABSL_BAD_CALL_IF) // This body of functions catches cases where the number of placeholders // doesn't match the number of data arguments. -void SubstituteAndAppend(TString* output, const char* format) +void SubstituteAndAppend(TString* output, const char* format) ABSL_BAD_CALL_IF( substitute_internal::PlaceholderBitmask(format) != 0, "There were no substitution arguments " "but this format string either has a $[0-9] in it or contains " "an unescaped $ character (use $$ instead)"); -void SubstituteAndAppend(TString* output, const char* format, +void SubstituteAndAppend(TString* output, const char* format, const substitute_internal::Arg& a0) ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 1, "There was 1 substitution argument given, but " @@ -377,7 +377,7 @@ void SubstituteAndAppend(TString* output, const char* format, "one of $1-$9, or contains an unescaped $ character (use " "$$ instead)"); -void SubstituteAndAppend(TString* output, const char* format, +void SubstituteAndAppend(TString* output, const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1) ABSL_BAD_CALL_IF( @@ -386,7 +386,7 @@ void SubstituteAndAppend(TString* output, const char* format, "missing its $0/$1, contains one of $2-$9, or contains an " "unescaped $ character (use $$ instead)"); -void SubstituteAndAppend(TString* output, const char* format, +void SubstituteAndAppend(TString* output, const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2) @@ -396,7 +396,7 @@ void SubstituteAndAppend(TString* output, const char* format, "this format string is missing its $0/$1/$2, contains one of " "$3-$9, or contains an unescaped $ character (use $$ instead)"); -void SubstituteAndAppend(TString* output, const char* format, +void SubstituteAndAppend(TString* output, const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, @@ -407,7 +407,7 @@ void SubstituteAndAppend(TString* output, const char* format, "this format string is missing its $0-$3, contains one of " "$4-$9, or contains an unescaped $ character (use $$ instead)"); -void SubstituteAndAppend(TString* output, const char* format, +void SubstituteAndAppend(TString* output, const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, @@ -419,7 +419,7 @@ void SubstituteAndAppend(TString* output, const char* format, "this format string is missing its $0-$4, contains one of " "$5-$9, or contains an unescaped $ character (use $$ instead)"); -void SubstituteAndAppend(TString* output, const char* format, +void SubstituteAndAppend(TString* output, const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, @@ -433,7 +433,7 @@ void SubstituteAndAppend(TString* output, const char* format, "$6-$9, or contains an unescaped $ character (use $$ instead)"); void SubstituteAndAppend( - TString* output, const char* format, const substitute_internal::Arg& a0, + TString* output, const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, const substitute_internal::Arg& a4, const substitute_internal::Arg& a5, const substitute_internal::Arg& a6) @@ -444,7 +444,7 @@ void SubstituteAndAppend( "$7-$9, or contains an unescaped $ character (use $$ instead)"); void SubstituteAndAppend( - TString* output, const char* format, const substitute_internal::Arg& a0, + TString* output, const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, const substitute_internal::Arg& a4, const substitute_internal::Arg& a5, const substitute_internal::Arg& a6, @@ -456,7 +456,7 @@ void SubstituteAndAppend( "$8-$9, or contains an unescaped $ character (use $$ instead)"); void SubstituteAndAppend( - TString* output, const char* format, const substitute_internal::Arg& a0, + TString* output, const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, const substitute_internal::Arg& a4, const substitute_internal::Arg& a5, const substitute_internal::Arg& a6, @@ -468,7 +468,7 @@ void SubstituteAndAppend( "contains an unescaped $ character (use $$ instead)"); void SubstituteAndAppend( - TString* output, const char* format, const substitute_internal::Arg& a0, + TString* output, const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, const substitute_internal::Arg& a4, const substitute_internal::Arg& a5, const substitute_internal::Arg& a6, @@ -494,106 +494,106 @@ void SubstituteAndAppend( // // Example: // template <typename... Args> -// void VarMsg(y_absl::string_view format, const Args&... args) { -// TString s = y_absl::Substitute(format, args...); +// void VarMsg(y_absl::string_view format, const Args&... args) { +// TString s = y_absl::Substitute(format, args...); -ABSL_MUST_USE_RESULT inline TString Substitute(y_absl::string_view format) { - TString result; +ABSL_MUST_USE_RESULT inline TString Substitute(y_absl::string_view format) { + TString result; SubstituteAndAppend(&result, format); return result; } -ABSL_MUST_USE_RESULT inline TString Substitute( - y_absl::string_view format, const substitute_internal::Arg& a0) { - TString result; +ABSL_MUST_USE_RESULT inline TString Substitute( + y_absl::string_view format, const substitute_internal::Arg& a0) { + TString result; SubstituteAndAppend(&result, format, a0); return result; } -ABSL_MUST_USE_RESULT inline TString Substitute( - y_absl::string_view format, const substitute_internal::Arg& a0, +ABSL_MUST_USE_RESULT inline TString Substitute( + y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1) { - TString result; + TString result; SubstituteAndAppend(&result, format, a0, a1); return result; } -ABSL_MUST_USE_RESULT inline TString Substitute( - y_absl::string_view format, const substitute_internal::Arg& a0, +ABSL_MUST_USE_RESULT inline TString Substitute( + y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2) { - TString result; + TString result; SubstituteAndAppend(&result, format, a0, a1, a2); return result; } -ABSL_MUST_USE_RESULT inline TString Substitute( - y_absl::string_view format, const substitute_internal::Arg& a0, +ABSL_MUST_USE_RESULT inline TString Substitute( + y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3) { - TString result; + TString result; SubstituteAndAppend(&result, format, a0, a1, a2, a3); return result; } -ABSL_MUST_USE_RESULT inline TString Substitute( - y_absl::string_view format, const substitute_internal::Arg& a0, +ABSL_MUST_USE_RESULT inline TString Substitute( + y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, const substitute_internal::Arg& a4) { - TString result; + TString result; SubstituteAndAppend(&result, format, a0, a1, a2, a3, a4); return result; } -ABSL_MUST_USE_RESULT inline TString Substitute( - y_absl::string_view format, const substitute_internal::Arg& a0, +ABSL_MUST_USE_RESULT inline TString Substitute( + y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, const substitute_internal::Arg& a4, const substitute_internal::Arg& a5) { - TString result; + TString result; SubstituteAndAppend(&result, format, a0, a1, a2, a3, a4, a5); return result; } -ABSL_MUST_USE_RESULT inline TString Substitute( - y_absl::string_view format, const substitute_internal::Arg& a0, +ABSL_MUST_USE_RESULT inline TString Substitute( + y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, const substitute_internal::Arg& a4, const substitute_internal::Arg& a5, const substitute_internal::Arg& a6) { - TString result; + TString result; SubstituteAndAppend(&result, format, a0, a1, a2, a3, a4, a5, a6); return result; } -ABSL_MUST_USE_RESULT inline TString Substitute( - y_absl::string_view format, const substitute_internal::Arg& a0, +ABSL_MUST_USE_RESULT inline TString Substitute( + y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, const substitute_internal::Arg& a4, const substitute_internal::Arg& a5, const substitute_internal::Arg& a6, const substitute_internal::Arg& a7) { - TString result; + TString result; SubstituteAndAppend(&result, format, a0, a1, a2, a3, a4, a5, a6, a7); return result; } -ABSL_MUST_USE_RESULT inline TString Substitute( - y_absl::string_view format, const substitute_internal::Arg& a0, +ABSL_MUST_USE_RESULT inline TString Substitute( + y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, const substitute_internal::Arg& a4, const substitute_internal::Arg& a5, const substitute_internal::Arg& a6, const substitute_internal::Arg& a7, const substitute_internal::Arg& a8) { - TString result; + TString result; SubstituteAndAppend(&result, format, a0, a1, a2, a3, a4, a5, a6, a7, a8); return result; } -ABSL_MUST_USE_RESULT inline TString Substitute( - y_absl::string_view format, const substitute_internal::Arg& a0, +ABSL_MUST_USE_RESULT inline TString Substitute( + y_absl::string_view format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, const substitute_internal::Arg& a4, const substitute_internal::Arg& a5, const substitute_internal::Arg& a6, const substitute_internal::Arg& a7, const substitute_internal::Arg& a8, const substitute_internal::Arg& a9) { - TString result; + TString result; SubstituteAndAppend(&result, format, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); return result; } @@ -601,20 +601,20 @@ ABSL_MUST_USE_RESULT inline TString Substitute( #if defined(ABSL_BAD_CALL_IF) // This body of functions catches cases where the number of placeholders // doesn't match the number of data arguments. -TString Substitute(const char* format) +TString Substitute(const char* format) ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 0, "There were no substitution arguments " "but this format string either has a $[0-9] in it or " "contains an unescaped $ character (use $$ instead)"); -TString Substitute(const char* format, const substitute_internal::Arg& a0) +TString Substitute(const char* format, const substitute_internal::Arg& a0) ABSL_BAD_CALL_IF( substitute_internal::PlaceholderBitmask(format) != 1, "There was 1 substitution argument given, but " "this format string is missing its $0, contains one of $1-$9, " "or contains an unescaped $ character (use $$ instead)"); -TString Substitute(const char* format, const substitute_internal::Arg& a0, +TString Substitute(const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1) ABSL_BAD_CALL_IF( substitute_internal::PlaceholderBitmask(format) != 3, @@ -622,7 +622,7 @@ TString Substitute(const char* format, const substitute_internal::Arg& a0, "this format string is missing its $0/$1, contains one of " "$2-$9, or contains an unescaped $ character (use $$ instead)"); -TString Substitute(const char* format, const substitute_internal::Arg& a0, +TString Substitute(const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2) ABSL_BAD_CALL_IF( @@ -631,7 +631,7 @@ TString Substitute(const char* format, const substitute_internal::Arg& a0, "this format string is missing its $0/$1/$2, contains one of " "$3-$9, or contains an unescaped $ character (use $$ instead)"); -TString Substitute(const char* format, const substitute_internal::Arg& a0, +TString Substitute(const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3) @@ -641,7 +641,7 @@ TString Substitute(const char* format, const substitute_internal::Arg& a0, "this format string is missing its $0-$3, contains one of " "$4-$9, or contains an unescaped $ character (use $$ instead)"); -TString Substitute(const char* format, const substitute_internal::Arg& a0, +TString Substitute(const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, @@ -652,7 +652,7 @@ TString Substitute(const char* format, const substitute_internal::Arg& a0, "this format string is missing its $0-$4, contains one of " "$5-$9, or contains an unescaped $ character (use $$ instead)"); -TString Substitute(const char* format, const substitute_internal::Arg& a0, +TString Substitute(const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, @@ -664,7 +664,7 @@ TString Substitute(const char* format, const substitute_internal::Arg& a0, "this format string is missing its $0-$5, contains one of " "$6-$9, or contains an unescaped $ character (use $$ instead)"); -TString Substitute(const char* format, const substitute_internal::Arg& a0, +TString Substitute(const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, @@ -677,7 +677,7 @@ TString Substitute(const char* format, const substitute_internal::Arg& a0, "this format string is missing its $0-$6, contains one of " "$7-$9, or contains an unescaped $ character (use $$ instead)"); -TString Substitute(const char* format, const substitute_internal::Arg& a0, +TString Substitute(const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, @@ -691,7 +691,7 @@ TString Substitute(const char* format, const substitute_internal::Arg& a0, "this format string is missing its $0-$7, contains one of " "$8-$9, or contains an unescaped $ character (use $$ instead)"); -TString Substitute( +TString Substitute( const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, const substitute_internal::Arg& a4, @@ -703,7 +703,7 @@ TString Substitute( "this format string is missing its $0-$8, contains a $9, or " "contains an unescaped $ character (use $$ instead)"); -TString Substitute( +TString Substitute( const char* format, const substitute_internal::Arg& a0, const substitute_internal::Arg& a1, const substitute_internal::Arg& a2, const substitute_internal::Arg& a3, const substitute_internal::Arg& a4, @@ -718,6 +718,6 @@ TString Substitute( #endif // ABSL_BAD_CALL_IF ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_STRINGS_SUBSTITUTE_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/ya.make b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/ya.make index 77c5a47dc9..33ccf33bac 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/strings/ya.make +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/strings/ya.make @@ -12,12 +12,12 @@ LICENSE(Apache-2.0) LICENSE_TEXTS(.yandex_meta/licenses.list.txt) PEERDIR( - contrib/restricted/abseil-cpp-tstring/y_absl/base - contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/raw_logging - contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/spinlock_wait - contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/throw_delegate - contrib/restricted/abseil-cpp-tstring/y_absl/base/log_severity - contrib/restricted/abseil-cpp-tstring/y_absl/numeric + contrib/restricted/abseil-cpp-tstring/y_absl/base + contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/raw_logging + contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/spinlock_wait + contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/throw_delegate + contrib/restricted/abseil-cpp-tstring/y_absl/base/log_severity + contrib/restricted/abseil-cpp-tstring/y_absl/numeric contrib/restricted/abseil-cpp-tstring/y_absl/strings/internal/absl_strings_internal ) |