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

Method AppendToCord

common/internal/byte_string.cc:600–621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

598}
599
600void ByteString::AppendToCord(absl::Cord* absl_nonnull out) const {
601 ABSL_DCHECK(out != nullptr);
602
603 switch (GetKind()) {
604 case ByteStringKind::kSmall:
605 out->Append(GetSmall());
606 break;
607 case ByteStringKind::kMedium: {
608 const auto* refcount = GetMediumReferenceCount();
609 if (refcount != nullptr) {
610 StrongRef(*refcount);
611 out->Append(absl::MakeCordFromExternal(
612 GetMedium(), ReferenceCountReleaser{refcount}));
613 } else {
614 out->Append(GetMedium());
615 }
616 } break;
617 case ByteStringKind::kLarge:
618 out->Append(GetLarge());
619 break;
620 }
621}
622
623absl::string_view ByteString::ToStringView(
624 std::string* absl_nonnull scratch) const {

Callers 5

TEST_PFunction · 0.80
AppendToCordFunction · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80
AppendToCordFunction · 0.80

Calls 5

GetKindFunction · 0.85
GetSmallFunction · 0.85
StrongRefFunction · 0.85
GetMediumFunction · 0.85
AppendMethod · 0.45

Tested by 3

TEST_PFunction · 0.64
TEST_FFunction · 0.64
TEST_FFunction · 0.64