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

Method Clone

common/values/parsed_repeated_field_value.cc:150–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148bool ParsedRepeatedFieldValue::IsZeroValue() const { return IsEmpty(); }
149
150ParsedRepeatedFieldValue ParsedRepeatedFieldValue::Clone(
151 google::protobuf::Arena* absl_nonnull arena) const {
152 ABSL_DCHECK(arena != nullptr);
153 ABSL_DCHECK(*this);
154
155 if (ABSL_PREDICT_FALSE(field_ == nullptr)) {
156 return ParsedRepeatedFieldValue();
157 }
158 if (arena_ == arena) {
159 return *this;
160 }
161 auto field = message_->GetReflection()->GetRepeatedFieldRef<google::protobuf::Message>(
162 *message_, field_);
163 auto* cloned_message = message_->New(arena);
164 auto cloned_field =
165 cloned_message->GetReflection()
166 ->GetMutableRepeatedFieldRef<google::protobuf::Message>(cloned_message, field_);
167 cloned_field.CopyFrom(field);
168 return ParsedRepeatedFieldValue(cloned_message, field_, arena);
169}
170
171bool ParsedRepeatedFieldValue::IsEmpty() const { return Size() == 0; }
172

Callers

nothing calls this directly

Calls 4

CopyFromMethod · 0.80
GetReflectionMethod · 0.45
NewMethod · 0.45

Tested by

no test coverage detected