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

Method MapExprToProto

common/ast/expr_proto.cc:198–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196 }
197
198 absl::Status MapExprToProto(const Expr& expr, const MapExpr& map_expr,
199 ExprProto* absl_nonnull proto) {
200 proto->Clear();
201 auto* map_proto = proto->mutable_struct_expr();
202 proto->set_id(expr.id());
203 if (!map_expr.entries().empty()) {
204 map_proto->mutable_entries()->Reserve(
205 static_cast<int>(map_expr.entries().size()));
206 for (const auto& entry_expr : map_expr.entries()) {
207 auto* entry_proto = map_proto->add_entries();
208 entry_proto->set_id(entry_expr.id());
209 if (entry_expr.has_key()) {
210 Push(entry_expr.key(), entry_proto->mutable_map_key());
211 }
212 if (entry_expr.has_value()) {
213 Push(entry_expr.value(), entry_proto->mutable_value());
214 }
215 if (entry_expr.optional()) {
216 entry_proto->set_optional_entry(true);
217 }
218 }
219 }
220 return absl::OkStatus();
221 }
222
223 absl::Status ComprehensionExprToProto(
224 const Expr& expr, const ComprehensionExpr& comprehension_expr,

Callers

nothing calls this directly

Calls 12

has_keyMethod · 0.80
keyMethod · 0.80
mutable_valueMethod · 0.80
ClearMethod · 0.45
set_idMethod · 0.45
idMethod · 0.45
emptyMethod · 0.45
ReserveMethod · 0.45
sizeMethod · 0.45
has_valueMethod · 0.45
valueMethod · 0.45
optionalMethod · 0.45

Tested by

no test coverage detected