Write the help strings contained in the help process to JSON. The schema looks as follows: { "processes": [ { "id": id, "endpoints": [ { "name" : name, "text" : text }, ... ] }, ... ] }
| 167 | // ] |
| 168 | // } |
| 169 | void json(JSON::ObjectWriter* writer, const Help& help) |
| 170 | { |
| 171 | // We must declare this temporary typedef in order to make the |
| 172 | // foreachpair macro happy. Otherwise it interprets the ',' in the |
| 173 | // map definition to denote a new parameter in the macro invocation. |
| 174 | typedef map<string, string> StringStringMap; |
| 175 | |
| 176 | writer->field("processes", [&help](JSON::ArrayWriter* writer) { |
| 177 | foreachpair (const string& id, const StringStringMap& names, help.helps) { |
| 178 | writer->element([&id, &names](JSON::ObjectWriter* writer) { |
| 179 | writer->field("id", id); |
| 180 | writer->field("endpoints", [&names](JSON::ArrayWriter* writer) { |
| 181 | foreachpair (const string& name, const string& text, names) { |
| 182 | writer->element([&name, &text](JSON::ObjectWriter* writer) { |
| 183 | writer->field("name", name); |
| 184 | writer->field("text", text); |
| 185 | }); |
| 186 | } |
| 187 | }); |
| 188 | }); |
| 189 | } |
| 190 | }); |
| 191 | } |
| 192 | |
| 193 | |
| 194 | Future<http::Response> Help::help(const http::Request& request) |
nothing calls this directly
no outgoing calls
no test coverage detected