@@ -89,7 +89,8 @@ const char *ui_message_handlert::level_string(unsigned level)
89
89
90
90
void ui_message_handlert::print (
91
91
unsigned level,
92
- const std::string &message)
92
+ const std::string &message,
93
+ bool preformatted)
93
94
{
94
95
if (verbosity>=level)
95
96
{
@@ -98,7 +99,7 @@ void ui_message_handlert::print(
98
99
case uit::PLAIN:
99
100
{
100
101
console_message_handlert console_message_handler;
101
- console_message_handler.print (level, message);
102
+ console_message_handler.print (level, message, preformatted );
102
103
}
103
104
break ;
104
105
@@ -107,7 +108,7 @@ void ui_message_handlert::print(
107
108
{
108
109
source_locationt location;
109
110
location.make_nil ();
110
- print (level, message, -1 , location);
111
+ print (level, message, -1 , location, preformatted );
111
112
}
112
113
break ;
113
114
}
@@ -118,17 +119,18 @@ void ui_message_handlert::print(
118
119
unsigned level,
119
120
const std::string &message,
120
121
int sequence_number,
121
- const source_locationt &location)
122
+ const source_locationt &location,
123
+ bool preformatted)
122
124
{
123
- message_handlert::print (level, message);
125
+ message_handlert::print (level, message, preformatted );
124
126
125
127
if (verbosity>=level)
126
128
{
127
129
switch (get_ui ())
128
130
{
129
131
case uit::PLAIN:
130
132
message_handlert::print (
131
- level, message, sequence_number, location);
133
+ level, message, sequence_number, location, preformatted );
132
134
break ;
133
135
134
136
case uit::XML_UI:
@@ -144,7 +146,7 @@ void ui_message_handlert::print(
144
146
std::string sequence_number_str=
145
147
sequence_number>=0 ?std::to_string (sequence_number):" " ;
146
148
147
- ui_msg (type, tmp_message, sequence_number_str, location);
149
+ ui_msg (type, tmp_message, sequence_number_str, location, preformatted );
148
150
}
149
151
break ;
150
152
}
@@ -155,19 +157,20 @@ void ui_message_handlert::ui_msg(
155
157
const std::string &type,
156
158
const std::string &msg1,
157
159
const std::string &msg2,
158
- const source_locationt &location)
160
+ const source_locationt &location,
161
+ bool preformatted)
159
162
{
160
163
switch (get_ui ())
161
164
{
162
165
case uit::PLAIN:
163
166
break ;
164
167
165
168
case uit::XML_UI:
166
- xml_ui_msg (type, msg1, msg2, location);
169
+ xml_ui_msg (type, msg1, msg2, location, preformatted );
167
170
break ;
168
171
169
172
case uit::JSON_UI:
170
- json_ui_msg (type, msg1, msg2, location);
173
+ json_ui_msg (type, msg1, msg2, location, preformatted );
171
174
break ;
172
175
}
173
176
}
@@ -176,8 +179,16 @@ void ui_message_handlert::xml_ui_msg(
176
179
const std::string &type,
177
180
const std::string &msg1,
178
181
const std::string &msg2,
179
- const source_locationt &location)
182
+ const source_locationt &location,
183
+ bool preformatted)
180
184
{
185
+ if (preformatted)
186
+ {
187
+ // Expect the message is already an XML fragment.
188
+ std::cout << msg1 << ' \n ' ;
189
+ return ;
190
+ }
191
+
181
192
xmlt result;
182
193
result.name =" message" ;
183
194
@@ -196,8 +207,16 @@ void ui_message_handlert::json_ui_msg(
196
207
const std::string &type,
197
208
const std::string &msg1,
198
209
const std::string &msg2,
199
- const source_locationt &location)
210
+ const source_locationt &location,
211
+ bool preformatted)
200
212
{
213
+ if (preformatted)
214
+ {
215
+ // Expect the message is already a JSON fragment.
216
+ std::cout << " ,\n " << msg1;
217
+ return ;
218
+ }
219
+
201
220
json_objectt result;
202
221
203
222
#if 0
0 commit comments