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

Method Clone

common/values/parsed_map_field_value.cc:156–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154bool ParsedMapFieldValue::IsZeroValue() const { return IsEmpty(); }
155
156ParsedMapFieldValue ParsedMapFieldValue::Clone(
157 google::protobuf::Arena* absl_nonnull arena) const {
158 ABSL_DCHECK(arena != nullptr);
159 ABSL_DCHECK(*this);
160
161 if (ABSL_PREDICT_FALSE(field_ == nullptr)) {
162 return ParsedMapFieldValue();
163 }
164 if (arena_ == arena) {
165 return *this;
166 }
167 auto field = message_->GetReflection()->GetRepeatedFieldRef<google::protobuf::Message>(
168 *message_, field_);
169 auto* cloned = message_->New(arena);
170 auto cloned_field =
171 cloned->GetReflection()->GetMutableRepeatedFieldRef<google::protobuf::Message>(
172 cloned, field_);
173 cloned_field.CopyFrom(field);
174 return ParsedMapFieldValue(cloned, field_, arena);
175}
176
177bool ParsedMapFieldValue::IsEmpty() const { return Size() == 0; }
178

Callers

nothing calls this directly

Calls 4

CopyFromMethod · 0.80
ParsedMapFieldValueClass · 0.70
GetReflectionMethod · 0.45
NewMethod · 0.45

Tested by

no test coverage detected