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

Method MoveFrom

common/internal/byte_string.cc:781–829  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

779}
780
781void ByteString::MoveFrom(ByteString& other) {
782 ABSL_DCHECK_NE(&other, this);
783
784 switch (other.GetKind()) {
785 case ByteStringKind::kSmall:
786 switch (GetKind()) {
787 case ByteStringKind::kSmall:
788 break;
789 case ByteStringKind::kMedium:
790 DestroyMedium();
791 break;
792 case ByteStringKind::kLarge:
793 DestroyLarge();
794 break;
795 }
796 rep_.small = other.rep_.small;
797 break;
798 case ByteStringKind::kMedium:
799 switch (GetKind()) {
800 case ByteStringKind::kSmall:
801 rep_.medium = other.rep_.medium;
802 break;
803 case ByteStringKind::kMedium:
804 DestroyMedium();
805 rep_.medium = other.rep_.medium;
806 break;
807 case ByteStringKind::kLarge:
808 DestroyLarge();
809 rep_.medium = other.rep_.medium;
810 break;
811 }
812 other.rep_.medium.owner = 0;
813 break;
814 case ByteStringKind::kLarge:
815 switch (GetKind()) {
816 case ByteStringKind::kSmall:
817 SetLarge(std::move(other.GetLarge()));
818 break;
819 case ByteStringKind::kMedium:
820 DestroyMedium();
821 SetLarge(std::move(other.GetLarge()));
822 break;
823 case ByteStringKind::kLarge:
824 GetLarge() = std::move(other.GetLarge());
825 break;
826 }
827 break;
828 }
829}
830
831ByteString ByteString::Clone(google::protobuf::Arena* absl_nonnull arena) const {
832 ABSL_DCHECK(arena != nullptr);

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected