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

Function ListValueToJsonArray

common/values/value_builder.cc:81–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79
80template <typename Vector>
81absl::Status ListValueToJsonArray(
82 const Vector& vector,
83 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
84 google::protobuf::MessageFactory* absl_nonnull message_factory,
85 google::protobuf::Message* absl_nonnull json) {
86 ABSL_DCHECK(descriptor_pool != nullptr);
87 ABSL_DCHECK(message_factory != nullptr);
88 ABSL_DCHECK(json != nullptr);
89 ABSL_DCHECK_EQ(json->GetDescriptor()->well_known_type(),
90 google::protobuf::Descriptor::WELLKNOWNTYPE_LISTVALUE);
91
92 ListValueReflection reflection;
93 CEL_RETURN_IF_ERROR(reflection.Initialize(json->GetDescriptor()));
94
95 json->Clear();
96
97 if (vector.empty()) {
98 return absl::OkStatus();
99 }
100
101 for (const auto& element : vector) {
102 CEL_RETURN_IF_ERROR(element->ConvertToJson(descriptor_pool, message_factory,
103 reflection.AddValues(json)));
104 }
105 return absl::OkStatus();
106}
107
108template <typename Vector>
109absl::Status ListValueToJson(

Callers 3

ListValueToJsonFunction · 0.85
ConvertToJsonArrayMethod · 0.85
ConvertToJsonArrayMethod · 0.85

Calls 6

GetDescriptorMethod · 0.45
InitializeMethod · 0.45
ClearMethod · 0.45
emptyMethod · 0.45
ConvertToJsonMethod · 0.45
AddValuesMethod · 0.45

Tested by

no test coverage detected