File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,46 @@ struct structured_data_entryt
43
43
std::map<labelt, structured_data_entryt> children;
44
44
};
45
45
46
+ // / A way of representing nested key/value data. Used for logging on any
47
+ // / message handler.
48
+ // / Usage:
49
+ // / ```
50
+ // / structured_datat data{
51
+ // / {{labelt{{"my", "data"}},
52
+ // / structured_data_entryt::entry(
53
+ // / {{labelt{{"my", "number"}},
54
+ // / structured_data_entryt::data_node(json_numbert("10"))},
55
+ // / {labelt{{"my", "string"}},
56
+ // / structured_data_entryt::data_node(json_stringt("hi"))}})}}};
57
+ // / message() << data << eom;
58
+ // / ```
59
+ // / Then if the output dependending on the UI of the message handler, you'll
60
+ // / get appropriately formatted data:
61
+ // /
62
+ // / XML:
63
+ // / ```xml
64
+ // / <my-data>
65
+ // / <my-number>10</my-number>
66
+ // / <my-string>hi</my-string>
67
+ // / </my-data>
68
+ // / ```
69
+ // /
70
+ // / JSON:
71
+ // / ```json
72
+ // / {
73
+ // / "myData": {
74
+ // / "myNumber": 10
75
+ // / "myString": "hi"
76
+ // / }
77
+ // / }
78
+ // / ```
79
+ // /
80
+ // / Plain:
81
+ // / ```
82
+ // / My data:
83
+ // / My number: 10
84
+ // / My string: hi
85
+ // / ```
46
86
class structured_datat
47
87
{
48
88
public:
You can’t perform that action at this time.
0 commit comments