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

Function MapValueToExpr

common/internal/value_conversion.cc:142–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142absl::StatusOr<ExprMapValue> MapValueToExpr(
143 const MapValue& map_value,
144 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
145 google::protobuf::MessageFactory* absl_nonnull message_factory,
146 google::protobuf::Arena* absl_nonnull arena) {
147 ExprMapValue result;
148
149 CEL_ASSIGN_OR_RETURN(auto iter, map_value.NewIterator());
150
151 while (iter->HasNext()) {
152 CEL_ASSIGN_OR_RETURN(auto key_value,
153 iter->Next(descriptor_pool, message_factory, arena));
154 CEL_ASSIGN_OR_RETURN(
155 auto value_value,
156 map_value.Get(key_value, descriptor_pool, message_factory, arena));
157
158 CEL_ASSIGN_OR_RETURN(
159 auto key,
160 ToExprValue(key_value, descriptor_pool, message_factory, arena));
161 CEL_ASSIGN_OR_RETURN(auto value,
162 ToExprValue(value_value, descriptor_pool,
163 message_factory, arena));
164
165 auto* entry = result.add_entries();
166
167 *entry->mutable_key() = std::move(key);
168 *entry->mutable_value() = std::move(value);
169 }
170
171 return result;
172}
173
174absl::StatusOr<ExprListValue> ListValueToExpr(
175 const ListValue& list_value,

Callers 1

ToExprValueFunction · 0.85

Calls 2

mutable_valueMethod · 0.80
HasNextMethod · 0.45

Tested by

no test coverage detected