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

Method Construct

common/internal/byte_string.cc:673–699  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

671}
672
673void ByteString::Construct(const ByteString& other,
674 absl::optional<Allocator<>> allocator) {
675 switch (other.GetKind()) {
676 case ByteStringKind::kSmall:
677 rep_.small = other.rep_.small;
678 if (allocator.has_value()) {
679 rep_.small.arena = allocator->arena();
680 }
681 break;
682 case ByteStringKind::kMedium:
683 if (allocator.has_value() &&
684 allocator->arena() != other.GetMediumArena()) {
685 SetMedium(allocator->arena(), other.GetMedium());
686 } else {
687 rep_.medium = other.rep_.medium;
688 StrongRef(GetMediumReferenceCount());
689 }
690 break;
691 case ByteStringKind::kLarge:
692 if (allocator.has_value() && allocator->arena() != nullptr) {
693 SetMedium(allocator->arena(), other.GetLarge());
694 } else {
695 SetLarge(other.GetLarge());
696 }
697 break;
698 }
699}
700
701void ByteString::Construct(ByteString& other,
702 absl::optional<Allocator<>> allocator) {

Callers

nothing calls this directly

Calls 5

StrongRefFunction · 0.85
GetKindMethod · 0.80
GetMediumArenaMethod · 0.80
has_valueMethod · 0.45
arenaMethod · 0.45

Tested by

no test coverage detected