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

Method CopyFrom

common/internal/byte_string.cc:729–779  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

727}
728
729void ByteString::CopyFrom(const ByteString& other) {
730 ABSL_DCHECK_NE(&other, this);
731
732 switch (other.GetKind()) {
733 case ByteStringKind::kSmall:
734 switch (GetKind()) {
735 case ByteStringKind::kSmall:
736 break;
737 case ByteStringKind::kMedium:
738 DestroyMedium();
739 break;
740 case ByteStringKind::kLarge:
741 DestroyLarge();
742 break;
743 }
744 rep_.small = other.rep_.small;
745 break;
746 case ByteStringKind::kMedium:
747 switch (GetKind()) {
748 case ByteStringKind::kSmall:
749 rep_.medium = other.rep_.medium;
750 StrongRef(GetMediumReferenceCount());
751 break;
752 case ByteStringKind::kMedium:
753 StrongRef(other.GetMediumReferenceCount());
754 DestroyMedium();
755 rep_.medium = other.rep_.medium;
756 break;
757 case ByteStringKind::kLarge:
758 DestroyLarge();
759 rep_.medium = other.rep_.medium;
760 StrongRef(GetMediumReferenceCount());
761 break;
762 }
763 break;
764 case ByteStringKind::kLarge:
765 switch (GetKind()) {
766 case ByteStringKind::kSmall:
767 SetLarge(other.GetLarge());
768 break;
769 case ByteStringKind::kMedium:
770 DestroyMedium();
771 SetLarge(other.GetLarge());
772 break;
773 case ByteStringKind::kLarge:
774 GetLarge() = other.GetLarge();
775 break;
776 }
777 break;
778 }
779}
780
781void ByteString::MoveFrom(ByteString& other) {
782 ABSL_DCHECK_NE(&other, this);

Callers 15

ReflectedCopyMethod · 0.80
ReflectedCopyMethod · 0.80
ProtoMatcherMethod · 0.80
operator()Method · 0.80
operator()Method · 0.80
FromMessageMethod · 0.80
WrapMessageMethod · 0.80
ConvertToJsonMethod · 0.80
ConvertToJsonArrayMethod · 0.80
ConvertToJsonObjectMethod · 0.80
CloneMethod · 0.80
ProtoMessageCopyFunction · 0.80

Calls 6

GetKindFunction · 0.85
DestroyMediumFunction · 0.85
DestroyLargeFunction · 0.85
StrongRefFunction · 0.85
GetKindMethod · 0.80

Tested by 2

ReflectedCopyMethod · 0.64
ReflectedCopyMethod · 0.64