MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / ToStringView

Method ToStringView

common/internal/byte_string.cc:623–639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

621}
622
623absl::string_view ByteString::ToStringView(
624 std::string* absl_nonnull scratch) const {
625 ABSL_DCHECK(scratch != nullptr);
626
627 switch (GetKind()) {
628 case ByteStringKind::kSmall:
629 return GetSmall();
630 case ByteStringKind::kMedium:
631 return GetMedium();
632 case ByteStringKind::kLarge:
633 if (auto flat = GetLarge().TryFlat(); flat) {
634 return *flat;
635 }
636 absl::CopyCordToString(GetLarge(), scratch);
637 return absl::string_view(*scratch);
638 }
639}
640
641absl::string_view ByteString::AsStringView() const {
642 const ByteStringKind kind = GetKind();

Callers 15

TEST_PFunction · 0.80
NativeStringFunction · 0.80
ToStringViewFunction · 0.80
NativeStringFunction · 0.80
ToStringViewFunction · 0.80
ExtractStringFunction · 0.80
CaptureStringFunction · 0.80
CaptureStringNFunction · 0.80
ExtractFunction · 0.80
ExtractAllFunction · 0.80
ReplaceAllFunction · 0.80
ReplaceNFunction · 0.80

Calls 4

GetKindFunction · 0.85
GetSmallFunction · 0.85
GetMediumFunction · 0.85
TryFlatMethod · 0.80

Tested by 3

TEST_PFunction · 0.64
IsPrivateIpv4ImplFunction · 0.64
TEST_FFunction · 0.64