Skip to content

Commit 8027f84

Browse files
author
thk123
committed
Extend ui_message_handler to always print xml
If JSON or plain text UIs are enabled, convert the data into a suitable format before printing as usual
1 parent ccaa1ac commit 8027f84

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/util/ui_message.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Author: Daniel Kroening, [email protected]
1212
#include <iostream>
1313

1414
#include "cmdline.h"
15+
#include "convert_xml_json.h"
1516
#include "json_irep.h"
1617
#include "json_stream.h"
1718
#include "make_unique.h"
@@ -166,16 +167,22 @@ void ui_message_handlert::print(
166167
switch(get_ui())
167168
{
168169
case uit::PLAIN:
169-
INVARIANT(false, "Cannot print xml data on PLAIN UI");
170+
{
171+
print(level, xml_to_pretty(data));
170172
break;
173+
}
171174
case uit::XML_UI:
175+
{
172176
out << data << '\n';
173177
flush(level);
174178
break;
179+
}
175180
case uit::JSON_UI:
176-
INVARIANT(false, "Cannot print xml data on JSON UI");
181+
{
182+
print(level, from_xml(data));
177183
break;
178184
}
185+
}
179186
}
180187
}
181188

0 commit comments

Comments
 (0)