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

Method CopyToCord

common/internal/byte_string.cc:577–598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

575}
576
577void ByteString::CopyToCord(absl::Cord* absl_nonnull out) const {
578 ABSL_DCHECK(out != nullptr);
579
580 switch (GetKind()) {
581 case ByteStringKind::kSmall:
582 *out = absl::Cord(GetSmall());
583 break;
584 case ByteStringKind::kMedium: {
585 const auto* refcount = GetMediumReferenceCount();
586 if (refcount != nullptr) {
587 StrongRef(*refcount);
588 *out = absl::MakeCordFromExternal(GetMedium(),
589 ReferenceCountReleaser{refcount});
590 } else {
591 *out = absl::Cord(GetMedium());
592 }
593 } break;
594 case ByteStringKind::kLarge:
595 *out = GetLarge();
596 break;
597 }
598}
599
600void ByteString::AppendToCord(absl::Cord* absl_nonnull out) const {
601 ABSL_DCHECK(out != nullptr);

Callers 5

TEST_PFunction · 0.80
CopyToCordFunction · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80
CopyToCordFunction · 0.80

Calls 4

GetKindFunction · 0.85
GetSmallFunction · 0.85
StrongRefFunction · 0.85
GetMediumFunction · 0.85

Tested by 3

TEST_PFunction · 0.64
TEST_FFunction · 0.64
TEST_FFunction · 0.64