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

Method AppendStruct

testutil/expr_printer.cc:150–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148 }
149
150 void AppendStruct(const StructExpr& obj) {
151 Append(obj.name());
152
153 if (obj.fields().empty()) {
154 Append("{}");
155 return;
156 }
157
158 Append("{");
159 AppendLine();
160 Indent();
161 for (int i = 0; i < obj.fields().size(); ++i) {
162 const auto& entry = obj.fields()[i];
163 if (i > 0) {
164 Append(",");
165 AppendLine();
166 }
167 if (entry.optional()) {
168 Append("?");
169 }
170 Append(entry.name());
171 Append(":");
172 AppendExpr(entry.value());
173 Append(adorner_.AdornStructField(entry));
174 }
175 AppendLine();
176 Unindent();
177 Append("}");
178 }
179
180 void AppendMap(const MapExpr& obj) {
181 if (obj.entries().empty()) {

Callers

nothing calls this directly

Calls 6

nameMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
optionalMethod · 0.45
valueMethod · 0.45
AdornStructFieldMethod · 0.45

Tested by

no test coverage detected