Merge branch 'master' into master
This commit is contained in:
commit
200b5a7cb0
38 changed files with 461 additions and 191 deletions
|
|
@ -103,6 +103,7 @@ cc_test(
|
|||
size = "small",
|
||||
srcs = ["match_test.cc"],
|
||||
copts = ABSL_TEST_COPTS,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":strings",
|
||||
"@com_google_googletest//:gtest_main",
|
||||
|
|
@ -117,6 +118,7 @@ cc_test(
|
|||
"internal/escaping_test_common.inc",
|
||||
],
|
||||
copts = ABSL_TEST_COPTS,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":strings",
|
||||
"//absl/base:core_headers",
|
||||
|
|
@ -130,6 +132,7 @@ cc_test(
|
|||
size = "small",
|
||||
srcs = ["ascii_test.cc"],
|
||||
copts = ABSL_TEST_COPTS,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":strings",
|
||||
"//absl/base:core_headers",
|
||||
|
|
@ -145,6 +148,7 @@ cc_test(
|
|||
"internal/memutil_test.cc",
|
||||
],
|
||||
copts = ABSL_TEST_COPTS,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":strings",
|
||||
"//absl/base:core_headers",
|
||||
|
|
@ -159,6 +163,7 @@ cc_test(
|
|||
"internal/utf8_test.cc",
|
||||
],
|
||||
copts = ABSL_TEST_COPTS,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":internal",
|
||||
":strings",
|
||||
|
|
@ -172,6 +177,7 @@ cc_test(
|
|||
size = "small",
|
||||
srcs = ["string_view_test.cc"],
|
||||
copts = ABSL_TEST_COPTS + ABSL_EXCEPTIONS_FLAG,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":strings",
|
||||
"//absl/base:config",
|
||||
|
|
@ -186,6 +192,7 @@ cc_test(
|
|||
size = "small",
|
||||
srcs = ["substitute_test.cc"],
|
||||
copts = ABSL_TEST_COPTS,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":strings",
|
||||
"//absl/base:core_headers",
|
||||
|
|
@ -198,6 +205,7 @@ cc_test(
|
|||
size = "small",
|
||||
srcs = ["str_replace_test.cc"],
|
||||
copts = ABSL_TEST_COPTS,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":strings",
|
||||
"@com_google_googletest//:gtest_main",
|
||||
|
|
@ -208,6 +216,7 @@ cc_test(
|
|||
name = "str_split_test",
|
||||
srcs = ["str_split_test.cc"],
|
||||
copts = ABSL_TEST_COPTS,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":strings",
|
||||
"//absl/base:core_headers",
|
||||
|
|
@ -221,6 +230,7 @@ cc_test(
|
|||
size = "small",
|
||||
srcs = ["internal/ostringstream_test.cc"],
|
||||
copts = ABSL_TEST_COPTS,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":internal",
|
||||
"@com_google_googletest//:gtest_main",
|
||||
|
|
@ -235,6 +245,7 @@ cc_test(
|
|||
"internal/resize_uninitialized_test.cc",
|
||||
],
|
||||
copts = ABSL_TEST_COPTS,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
"//absl/base:core_headers",
|
||||
"//absl/meta:type_traits",
|
||||
|
|
@ -247,6 +258,7 @@ cc_test(
|
|||
size = "small",
|
||||
srcs = ["str_join_test.cc"],
|
||||
copts = ABSL_TEST_COPTS,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":strings",
|
||||
"//absl/base:core_headers",
|
||||
|
|
@ -260,6 +272,7 @@ cc_test(
|
|||
size = "small",
|
||||
srcs = ["str_cat_test.cc"],
|
||||
copts = ABSL_TEST_COPTS,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":strings",
|
||||
"//absl/base:core_headers",
|
||||
|
|
@ -278,6 +291,7 @@ cc_test(
|
|||
tags = [
|
||||
"no_test_loonix",
|
||||
],
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":strings",
|
||||
"//absl/base",
|
||||
|
|
@ -291,6 +305,7 @@ cc_test(
|
|||
size = "small",
|
||||
srcs = ["strip_test.cc"],
|
||||
copts = ABSL_TEST_COPTS,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":strings",
|
||||
"@com_google_googletest//:gtest_main",
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
namespace absl {
|
||||
namespace strings_internal {
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ inline bool StrContains(absl::string_view haystack, absl::string_view needle) {
|
|||
inline bool StartsWith(absl::string_view text, absl::string_view prefix) {
|
||||
return prefix.empty() ||
|
||||
(text.size() >= prefix.size() &&
|
||||
memcmp(text.data(), prefix.data(), prefix.size()) == 0);
|
||||
memcmp(text.data(), prefix.data(), prefix.size()) == 0);
|
||||
}
|
||||
|
||||
// EndsWith()
|
||||
|
|
@ -63,7 +63,8 @@ inline bool EndsWith(absl::string_view text, absl::string_view suffix) {
|
|||
return suffix.empty() ||
|
||||
(text.size() >= suffix.size() &&
|
||||
memcmp(text.data() + (text.size() - suffix.size()), suffix.data(),
|
||||
suffix.size()) == 0);
|
||||
suffix.size()) == 0
|
||||
);
|
||||
}
|
||||
|
||||
// StartsWithIgnoreCase()
|
||||
|
|
|
|||
|
|
@ -62,9 +62,9 @@ ABSL_MUST_USE_RESULT bool SimpleAtod(absl::string_view str, double* value);
|
|||
|
||||
// SimpleAtob()
|
||||
//
|
||||
// Converts the given std::string into into a boolean, returning `true` if
|
||||
// successful. The following case-insensitive strings are interpreted as boolean
|
||||
// `true`: "true", "t", "yes", "y", "1". The following case-insensitive strings
|
||||
// Converts the given std::string into a boolean, returning `true` if successful.
|
||||
// The following case-insensitive strings are interpreted as boolean `true`:
|
||||
// "true", "t", "yes", "y", "1". The following case-insensitive strings
|
||||
// are interpreted as boolean `false`: "false", "f", "no", "n", "0".
|
||||
ABSL_MUST_USE_RESULT bool SimpleAtob(absl::string_view str, bool* value);
|
||||
|
||||
|
|
|
|||
|
|
@ -295,9 +295,8 @@ class string_view {
|
|||
|
||||
// string_view::remove_prefix()
|
||||
//
|
||||
// Removes the first `n` characters from the `string_view`, returning a
|
||||
// pointer to the new first character. Note that the underlying std::string is not
|
||||
// changed, only the view.
|
||||
// Removes the first `n` characters from the `string_view`. Note that the
|
||||
// underlying std::string is not changed, only the view.
|
||||
void remove_prefix(size_type n) {
|
||||
assert(n <= length_);
|
||||
ptr_ += n;
|
||||
|
|
|
|||
|
|
@ -922,6 +922,10 @@ TEST(StringViewTest, ConstexprCompiles) {
|
|||
constexpr absl::string_view::iterator const_begin_empty = sp.begin();
|
||||
constexpr absl::string_view::iterator const_end_empty = sp.end();
|
||||
EXPECT_EQ(const_begin_empty, const_end_empty);
|
||||
|
||||
constexpr absl::string_view::iterator const_begin_nullptr = cstr.begin();
|
||||
constexpr absl::string_view::iterator const_end_nullptr = cstr.end();
|
||||
EXPECT_EQ(const_begin_nullptr, const_end_nullptr);
|
||||
#endif
|
||||
|
||||
constexpr absl::string_view::iterator const_begin = cstr_len.begin();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue