Export of internal Abseil changes

--
c99f979ad34f155fbeeea69b88bdc7458d89a21c by Derek Mauro <dmauro@google.com>:

Remove a floating point division by zero test.

This isn't testing behavior related to the library, and MSVC warns
about it in opt mode.

PiperOrigin-RevId: 285220804

--
68b015491f0dbf1ab547994673281abd1f34cd4b by Gennadiy Rozental <rogeeff@google.com>:

This CL introduces following changes to the class FlagImpl:
* We eliminate the CommandLineFlagLocks struct. Instead callback guard and callback function are combined into a single CallbackData struct, while primary data lock is stored separately.
* CallbackData member of class FlagImpl is initially set to be nullptr and is only allocated and initialized when a flag's callback is being set. For most flags we do not pay for the extra space and extra absl::Mutex now.
* Primary data guard is stored in data_guard_ data member. This is a properly aligned character buffer of necessary size. During initialization of the flag we construct absl::Mutex in this space using placement new call.
* We now avoid extra value copy after successful attempt to parse value out of string. Instead we swap flag's current value with tentative value we just produced.

PiperOrigin-RevId: 285132636

--
ed45d118fb818969eb13094cf7827c885dfc562c by Tom Manshreck <shreck@google.com>:

Change null-term* (and nul-term*) to NUL-term* in comments

PiperOrigin-RevId: 285036610

--
729619017944db895ce8d6d29c1995aa2e5628a5 by Derek Mauro <dmauro@google.com>:

Use the Posix implementation of thread identity on MinGW.
Some versions of MinGW suffer from thread_local bugs.

PiperOrigin-RevId: 285022920

--
39a25493503c76885bc3254c28f66a251c5b5bb0 by Greg Falcon <gfalcon@google.com>:

Implementation detail change.

Add further ABSL_NAMESPACE_BEGIN and _END annotation macros to files in Abseil.

PiperOrigin-RevId: 285012012
GitOrigin-RevId: c99f979ad34f155fbeeea69b88bdc7458d89a21c
Change-Id: I4c85d3704e45d11a9ac50d562f39640a6adbedc1
This commit is contained in:
Abseil Team 2019-12-12 10:36:03 -08:00 committed by Matt Calabrese
parent 1e39f8626a
commit 12bc53e031
339 changed files with 948 additions and 82 deletions

View file

@ -94,6 +94,7 @@ cc_library(
],
copts = ABSL_DEFAULT_COPTS,
deps = [
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:endian",
"//absl/meta:type_traits",
@ -413,6 +414,7 @@ cc_test(
deps = [
":pow10_helper",
":strings",
"//absl/base:config",
"//absl/base:raw_logging_internal",
"//absl/random",
"//absl/random:distributions",
@ -489,6 +491,7 @@ cc_test(
copts = ABSL_TEST_COPTS,
deps = [
":strings",
"//absl/base:config",
"//absl/base:raw_logging_internal",
"@com_google_googletest//:gtest_main",
],
@ -504,6 +507,7 @@ cc_test(
copts = ABSL_TEST_COPTS,
deps = [
":strings",
"//absl/base:config",
"@com_google_googletest//:gtest_main",
],
)
@ -668,6 +672,7 @@ cc_library(
srcs = ["internal/pow10_helper.cc"],
hdrs = ["internal/pow10_helper.h"],
visibility = ["//visibility:private"],
deps = ["//absl/base:config"],
)
cc_test(

View file

@ -81,6 +81,7 @@ absl_cc_library(
COPTS
${ABSL_DEFAULT_COPTS}
DEPS
absl::config
absl::core_headers
absl::endian
absl::type_traits
@ -276,6 +277,7 @@ absl_cc_test(
absl::strings
absl::core_headers
absl::pow10_helper
absl::config
absl::raw_logging_internal
absl::random_random
absl::random_distributions
@ -331,6 +333,7 @@ absl_cc_test(
${ABSL_TEST_COPTS}
DEPS
absl::strings
absl::config
absl::raw_logging_internal
gmock_main
)
@ -346,6 +349,7 @@ absl_cc_test(
${ABSL_TEST_COPTS}
DEPS
absl::strings
absl::config
gmock_main
)
@ -502,6 +506,8 @@ absl_cc_library(
"internal/pow10_helper.cc"
COPTS
${ABSL_TEST_COPTS}
DEPS
absl::config
TESTONLY
)

View file

@ -15,6 +15,7 @@
#include "absl/strings/ascii.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace ascii_internal {
// # Table generated by this Python code (bit 0x02 is currently unused):
@ -195,4 +196,5 @@ void RemoveExtraAsciiWhitespace(std::string* str) {
str->erase(output_it - &(*str)[0]);
}
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -59,6 +59,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace ascii_internal {
// Declaration for an array of bitfields holding character information.
@ -234,6 +235,7 @@ inline void StripAsciiWhitespace(std::string* str) {
// Removes leading, trailing, and consecutive internal whitespace.
void RemoveExtraAsciiWhitespace(std::string*);
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_ASCII_H_

View file

@ -57,6 +57,7 @@
// narrower mantissas.
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace {
template <typename FloatType>
@ -980,4 +981,5 @@ const int16_t kPower10ExponentTable[] = {
};
} // namespace
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -17,7 +17,10 @@
#include <system_error> // NOLINT(build/c++11)
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// Workalike compatibilty version of std::chars_format from C++17.
//
@ -110,6 +113,7 @@ inline chars_format& operator^=(chars_format& lhs, chars_format rhs) {
return lhs;
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_CHARCONV_H_

View file

@ -33,6 +33,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace {
// These are used for the leave_nulls_escaped argument to CUnescapeInternal().
@ -1106,4 +1107,5 @@ std::string BytesToHexString(absl::string_view from) {
return result;
}
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -33,6 +33,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// CUnescape()
//
@ -157,6 +158,7 @@ std::string HexStringToBytes(absl::string_view from);
// `2*from.size()`.
std::string BytesToHexString(absl::string_view from);
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_ESCAPING_H_

View file

@ -28,6 +28,7 @@
#include "absl/base/port.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
class Charmap {
@ -149,6 +150,7 @@ constexpr Charmap GraphCharmap() { return PrintCharmap() & ~SpaceCharmap(); }
constexpr Charmap PunctCharmap() { return GraphCharmap() & ~AlnumCharmap(); }
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_CHAR_MAP_H_

View file

@ -19,6 +19,7 @@
#include <string>
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
namespace {
@ -354,4 +355,5 @@ template class BigUnsigned<4>;
template class BigUnsigned<84>;
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -25,6 +25,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
// The largest power that 5 that can be raised to, and still fit in a uint32_t.
@ -414,6 +415,7 @@ extern template class BigUnsigned<4>;
extern template class BigUnsigned<84>;
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_CHARCONV_BIGINT_H_

View file

@ -19,6 +19,7 @@
#include "gtest/gtest.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
TEST(BigUnsigned, ShiftLeft) {
@ -200,4 +201,5 @@ TEST(BigUnsigned, TenToTheNth) {
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -22,6 +22,7 @@
#include "absl/strings/internal/memutil.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace {
// ParseFloat<10> will read the first 19 significant digits of the mantissa.
@ -499,4 +500,5 @@ template ParsedFloat ParseFloat<16>(const char* begin, const char* end,
chars_format format_flags);
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -17,9 +17,11 @@
#include <cstdint>
#include "absl/base/config.h"
#include "absl/strings/charconv.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
// Enum indicating whether a parsed float is a number or special value.
@ -92,5 +94,6 @@ extern template ParsedFloat ParseFloat<16>(const char* begin, const char* end,
absl::chars_format format_flags);
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_CHARCONV_PARSE_H_

View file

@ -22,6 +22,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
struct base64_testcase {
@ -126,6 +127,7 @@ inline const std::array<base64_testcase, 5>& base64_strings() {
}
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_

View file

@ -17,6 +17,7 @@
#include <cstdlib>
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
int memcasecmp(const char* s1, const char* s2, size_t len) {
@ -107,4 +108,5 @@ const char* memmatch(const char* phaystack, size_t haylen, const char* pneedle,
}
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -69,6 +69,7 @@
#include "absl/strings/ascii.h" // for absl::ascii_tolower
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
inline char* memcat(char* dest, size_t destlen, const char* src,
@ -141,6 +142,7 @@ const char* memmatch(const char* phaystack, size_t haylen, const char* pneedle,
size_t neelen);
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_MEMUTIL_H_

View file

@ -23,7 +23,10 @@
#include <limits>
#include <string>
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
template <typename IntType>
@ -175,6 +178,7 @@ inline const std::array<uint64_test_case, 34>& strtouint64_test_cases() {
}
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_NUMBERS_TEST_COMMON_H_

View file

@ -15,6 +15,7 @@
#include "absl/strings/internal/ostringstream.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
OStringStream::Buf::int_type OStringStream::overflow(int c) {
@ -31,4 +32,5 @@ std::streamsize OStringStream::xsputn(const char* s, std::streamsize n) {
}
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -23,6 +23,7 @@
#include "absl/base/port.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
// The same as std::ostringstream but appends to a user-specified std::string,
@ -82,6 +83,7 @@ class OStringStream : private std::basic_streambuf<char>, public std::ostream {
};
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_OSTRINGSTREAM_H_

View file

@ -17,6 +17,7 @@
#include <cmath>
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
namespace {
@ -117,4 +118,5 @@ double Pow10(int exp) {
}
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -22,7 +22,10 @@
#include <vector>
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
// Computes the precise value of 10^exp. (I.e. the nearest representable
@ -31,6 +34,7 @@ namespace strings_internal {
double Pow10(int exp);
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_POW10_HELPER_H_

View file

@ -20,6 +20,7 @@
#include "absl/strings/str_format.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
namespace {
@ -117,4 +118,5 @@ TEST(Pow10HelperTest, Works) {
} // namespace
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -25,6 +25,7 @@
#include "absl/meta/type_traits.h" // for void_t
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
// Is a subclass of true_type or false_type, depending on whether or not
@ -66,6 +67,7 @@ inline void STLStringResizeUninitialized(string_type* s, size_t new_size) {
}
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_RESIZE_UNINITIALIZED_H_

View file

@ -40,6 +40,7 @@
#include "absl/meta/type_traits.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
template <typename C, template <typename...> class T>
@ -242,5 +243,6 @@ struct IsStrictlyBaseOfAndConvertibleToSTLContainer
IsConvertibleToSTLContainer<C>> {};
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_STL_TYPE_TRAITS_H_

View file

@ -14,6 +14,7 @@
#include "absl/strings/internal/str_format/float_conversion.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace str_format_internal {
namespace {
@ -386,4 +387,5 @@ ABSL_INTERNAL_FORMAT_DISPATCH_OVERLOADS_EXPAND_();
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -19,6 +19,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
class Cord;
class FormatCountCapture;
@ -426,6 +427,7 @@ ABSL_INTERNAL_FORMAT_DISPATCH_OVERLOADS_EXPAND_(extern);
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_STR_FORMAT_ARG_H_

View file

@ -14,6 +14,7 @@
#include "absl/strings/str_format.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace str_format_internal {
namespace {
@ -108,4 +109,5 @@ const char kMyArray[] = "ABCDE";
} // namespace
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -6,6 +6,7 @@
#include <string>
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace str_format_internal {
namespace {
@ -236,4 +237,5 @@ int SnprintF(char* output, size_t size, const UntypedFormatSpecImpl format,
}
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -13,6 +13,7 @@
#include "absl/types/span.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
class UntypedFormatSpec;
@ -202,6 +203,7 @@ class StreamedWrapper {
};
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_STR_FORMAT_BIND_H_

View file

@ -6,6 +6,7 @@
#include "gtest/gtest.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace str_format_internal {
namespace {
@ -138,4 +139,5 @@ TEST_F(FormatBindTest, FormatPack) {
} // namespace
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -14,6 +14,7 @@
#endif // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace str_format_internal {
constexpr bool AllOf() { return true; }
@ -319,6 +320,7 @@ constexpr bool ValidFormatImpl(string_view format) {
#endif // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_STR_FORMAT_CHECKER_H_

View file

@ -5,6 +5,7 @@
#include "absl/strings/str_format.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace str_format_internal {
namespace {
@ -147,4 +148,5 @@ TEST(StrFormatChecker, LongFormat) {
} // namespace
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -11,6 +11,7 @@
#include "absl/strings/internal/str_format/bind.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace str_format_internal {
namespace {
@ -646,4 +647,5 @@ TEST_F(FormatConvertTest, ExpectedFailures) {
} // namespace
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -20,6 +20,7 @@
#include <string>
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace str_format_internal {
namespace {
// clang-format off
@ -81,4 +82,5 @@ bool FormatSinkImpl::PutPaddedString(string_view v, int w, int p, bool l) {
}
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -26,6 +26,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
class Cord;
@ -406,6 +407,7 @@ inline size_t Excess(size_t used, size_t capacity) {
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_STR_FORMAT_EXTENSION_H_

View file

@ -9,6 +9,7 @@
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace str_format_internal {
namespace {
@ -482,4 +483,5 @@ bool ConvertFloatImpl(double v, const ConversionSpec &conv,
}
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -4,6 +4,7 @@
#include "absl/strings/internal/str_format/extension.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace str_format_internal {
bool ConvertFloatImpl(float v, const ConversionSpec &conv,
@ -16,6 +17,7 @@ bool ConvertFloatImpl(long double v, const ConversionSpec &conv,
FormatSinkImpl *sink);
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_STR_FORMAT_FLOAT_CONVERSION_H_

View file

@ -18,6 +18,7 @@
#include <cstring>
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace str_format_internal {
namespace {
@ -67,4 +68,5 @@ void FILERawSink::Write(string_view v) {
}
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -29,6 +29,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
class Cord;
@ -97,6 +98,7 @@ auto InvokeFlush(T* out, string_view s)
}
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_STR_FORMAT_OUTPUT_H_

View file

@ -21,6 +21,7 @@
#include "gtest/gtest.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace {
TEST(InvokeFlush, String) {
@ -67,5 +68,6 @@ TEST(BufferRawSink, Limits) {
}
} // namespace
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -14,6 +14,7 @@
#include <unordered_set>
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace str_format_internal {
using CC = ConversionChar::Id;
@ -300,4 +301,5 @@ bool ParsedFormatBase::MatchesConversions(
}
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -16,6 +16,7 @@
#include "absl/strings/internal/str_format/extension.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace str_format_internal {
// The analyzed properties of a single specified conversion.
@ -317,6 +318,7 @@ class ExtendedParsedFormat : public str_format_internal::ParsedFormatBase {
: ParsedFormatBase(s, allow_ignored, {C...}) {}
};
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_STR_FORMAT_PARSER_H_

View file

@ -7,6 +7,7 @@
#include "absl/base/macros.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace str_format_internal {
namespace {
@ -389,4 +390,5 @@ TEST_F(ParsedFormatTest, ParsingFlagOrder) {
} // namespace
} // namespace str_format_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -43,6 +43,7 @@
#include "absl/strings/str_cat.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
//
@ -307,6 +308,7 @@ std::string JoinRange(const Range& range, absl::string_view separator) {
}
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_STR_JOIN_INTERNAL_H_

View file

@ -47,6 +47,7 @@
#endif // _GLIBCXX_DEBUG
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
// This class is implicitly constructible from everything that absl::string_view
@ -448,6 +449,7 @@ class Splitter {
};
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_STR_SPLIT_INTERNAL_H_

View file

@ -17,6 +17,7 @@
#include "absl/strings/internal/utf8.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
size_t EncodeUTF8Char(char *buffer, char32_t utf8_char) {
@ -48,4 +49,5 @@ size_t EncodeUTF8Char(char *buffer, char32_t utf8_char) {
}
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -20,7 +20,10 @@
#include <cstddef>
#include <cstdint>
#include "absl/base/config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
// For Unicode code points 0 through 0x10FFFF, EncodeUTF8Char writes
@ -41,6 +44,7 @@ enum { kMaxEncodedUTF8Size = 4 };
size_t EncodeUTF8Char(char *buffer, char32_t utf8_char);
} // namespace strings_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_UTF8_H_

View file

@ -17,6 +17,7 @@
#include "absl/strings/internal/memutil.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
bool EqualsIgnoreCase(absl::string_view piece1, absl::string_view piece2) {
return (piece1.size() == piece2.size() &&
@ -35,4 +36,5 @@ bool EndsWithIgnoreCase(absl::string_view text, absl::string_view suffix) {
EqualsIgnoreCase(text.substr(text.size() - suffix.size()), suffix);
}
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -20,7 +20,7 @@
// This file contains simple utilities for performing string matching checks.
// All of these function parameters are specified as `absl::string_view`,
// meaning that these functions can accept `std::string`, `absl::string_view` or
// nul-terminated C-style strings.
// NUL-terminated C-style strings.
//
// Examples:
// std::string s = "foo";
@ -38,6 +38,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// StrContains()
//
@ -83,6 +84,7 @@ bool StartsWithIgnoreCase(absl::string_view text, absl::string_view prefix);
// case in the comparison.
bool EndsWithIgnoreCase(absl::string_view text, absl::string_view suffix);
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_MATCH_H_

View file

@ -40,6 +40,7 @@
#include "absl/strings/str_cat.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
bool SimpleAtof(absl::string_view str, float* out) {
*out = 0.0;
@ -911,4 +912,5 @@ bool safe_strtou128_base(absl::string_view text, uint128* value, int base) {
}
} // namespace numbers_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -51,6 +51,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// SimpleAtoi()
//
@ -95,11 +96,13 @@ ABSL_MUST_USE_RESULT bool SimpleAtod(absl::string_view str, double* out);
// unspecified state.
ABSL_MUST_USE_RESULT bool SimpleAtob(absl::string_view str, bool* out);
ABSL_NAMESPACE_END
} // namespace absl
// End of public API. Implementation details follow.
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace numbers_internal {
// Digit conversion.
@ -254,6 +257,7 @@ ABSL_MUST_USE_RESULT inline bool SimpleAtoi(absl::string_view str,
return numbers_internal::safe_strtou128_base(str, out, 10);
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_NUMBERS_H_

View file

@ -25,6 +25,7 @@
#include "absl/strings/numbers.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
AlphaNum::AlphaNum(Hex hex) {
static_assert(numbers_internal::kFastToBufferSize >= 32,
@ -241,4 +242,5 @@ void StrAppend(std::string* dest, const AlphaNum& a, const AlphaNum& b,
assert(out == begin + dest->size());
}
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -64,6 +64,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
// AlphaNumBuffer allows a way to pass a string to StrCat without having to do
@ -401,6 +402,7 @@ SixDigits(double d) {
return result;
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_STR_CAT_H_

View file

@ -82,6 +82,7 @@
#include "absl/strings/internal/str_format/parser.h" // IWYU pragma: export
namespace absl {
ABSL_NAMESPACE_BEGIN
// UntypedFormatSpec
//
@ -530,6 +531,7 @@ ABSL_MUST_USE_RESULT inline bool FormatUntyped(
str_format_internal::UntypedFormatSpecImpl::Extract(format), args);
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_STR_FORMAT_H_

View file

@ -10,6 +10,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace {
using str_format_internal::FormatArgImpl;
@ -622,6 +623,7 @@ TEST_F(FormatWrapperTest, ParsedFormat) {
}
} // namespace
ABSL_NAMESPACE_END
} // namespace absl
// Some codegen thunks that we can use to easily dump the generated assembly for

View file

@ -60,6 +60,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// -----------------------------------------------------------------------------
// Concept: Formatter
@ -286,6 +287,7 @@ std::string StrJoin(const std::tuple<T...>& value,
return strings_internal::JoinAlgorithm(value, separator, AlphaNumFormatter());
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_STR_JOIN_H_

View file

@ -17,6 +17,7 @@
#include "absl/strings/str_cat.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace strings_internal {
using FixedMapping =
@ -77,4 +78,5 @@ int StrReplaceAll(strings_internal::FixedMapping replacements,
return StrReplaceAll<strings_internal::FixedMapping>(replacements, target);
}
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -46,6 +46,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// StrReplaceAll()
//
@ -212,6 +213,7 @@ int StrReplaceAll(const StrToStrMapping& replacements, std::string* target) {
return substitutions;
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_STR_REPLACE_H_

View file

@ -27,6 +27,7 @@
#include "absl/strings/ascii.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace {
@ -134,4 +135,5 @@ absl::string_view ByLength::Find(absl::string_view text,
return absl::string_view(substr.data() + length_, 0);
}
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -49,6 +49,7 @@
#include "absl/strings/strip.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
//------------------------------------------------------------------------------
// Delimiters
@ -506,6 +507,7 @@ StrSplit(strings_internal::ConvertibleToStringView text, Delimiter d,
std::move(text), DelimiterType(d), std::move(p));
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_STR_SPLIT_H_

View file

@ -24,6 +24,7 @@
#include "absl/strings/internal/memutil.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace {
void WritePadding(std::ostream& o, size_t pad) {
@ -228,6 +229,7 @@ constexpr string_view::size_type string_view::npos;
ABSL_STRING_VIEW_SELECTANY
constexpr string_view::size_type string_view::kMaxSize;
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_USES_STD_STRING_VIEW

View file

@ -35,7 +35,9 @@
#include <string_view> // IWYU pragma: export
namespace absl {
ABSL_NAMESPACE_BEGIN
using std::string_view;
ABSL_NAMESPACE_END
} // namespace absl
#else // ABSL_USES_STD_STRING_VIEW
@ -61,6 +63,7 @@ using std::string_view;
#include "absl/base/port.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// absl::string_view
//
@ -109,10 +112,10 @@ namespace absl {
// example, when splitting a string, `std::vector<absl::string_view>` is a
// natural data type for the output.
//
// When constructed from a source which is nul-terminated, the `string_view`
// itself will not include the nul-terminator unless a specific size (including
// the nul) is passed to the constructor. As a result, common idioms that work
// on nul-terminated strings do not work on `string_view` objects. If you write
// When constructed from a source which is NUL-terminated, the `string_view`
// itself will not include the NUL-terminator unless a specific size (including
// the NUL) is passed to the constructor. As a result, common idioms that work
// on NUL-terminated strings do not work on `string_view` objects. If you write
// code that scans a `string_view`, you must check its length rather than test
// for nul, for example. Note, however, that nuls may still be embedded within
// a `string_view` explicitly.
@ -179,7 +182,7 @@ class string_view {
// doesn't need to be reevaluated after `ptr_` is set.
: string_view(str.data(), str.size()) {}
// Implicit constructor of a `string_view` from nul-terminated `str`. When
// Implicit constructor of a `string_view` from NUL-terminated `str`. When
// accepting possibly null strings, use `absl::NullSafeStringView(str)`
// instead (see below).
constexpr string_view(const char* str) // NOLINT(runtime/explicit)
@ -309,8 +312,8 @@ class string_view {
//
// Returns a pointer to the underlying character array (which is of course
// stored elsewhere). Note that `string_view::data()` may contain embedded nul
// characters, but the returned buffer may or may not be nul-terminated;
// therefore, do not pass `data()` to a routine that expects a nul-terminated
// characters, but the returned buffer may or may not be NUL-terminated;
// therefore, do not pass `data()` to a routine that expects a NUL-terminated
// std::string.
constexpr const_pointer data() const noexcept { return ptr_; }
@ -577,6 +580,7 @@ constexpr bool operator>=(string_view x, string_view y) noexcept {
// IO Insertion Operator
std::ostream& operator<<(std::ostream& o, string_view piece);
ABSL_NAMESPACE_END
} // namespace absl
#undef ABSL_INTERNAL_STRING_VIEW_MEMCMP
@ -584,6 +588,7 @@ std::ostream& operator<<(std::ostream& o, string_view piece);
#endif // ABSL_USES_STD_STRING_VIEW
namespace absl {
ABSL_NAMESPACE_BEGIN
// ClippedSubstr()
//
@ -604,6 +609,7 @@ inline string_view NullSafeStringView(const char* p) {
return p ? string_view(p) : string_view();
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_STRING_VIEW_H_

View file

@ -30,6 +30,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// ConsumePrefix()
//
@ -84,6 +85,7 @@ ABSL_MUST_USE_RESULT inline absl::string_view StripSuffix(
return str;
}
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_STRIP_H_

View file

@ -23,6 +23,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace substitute_internal {
void SubstituteAndAppendArray(std::string* output, absl::string_view format,
@ -166,4 +167,5 @@ Arg::Arg(Dec dec) {
}
} // namespace substitute_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -86,6 +86,7 @@
#include "absl/strings/strip.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace substitute_internal {
// Arg
@ -681,6 +682,7 @@ std::string Substitute(
"format std::string doesn't contain all of $0 through $9");
#endif // ABSL_BAD_CALL_IF
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_STRINGS_SUBSTITUTE_H_