26 const std::string &program,
42 out <<
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
49 program_xml.
name=
"program";
50 program_xml.
data=program;
68 const std::string &program)
71 cmdline.isset(
"xml-ui") || cmdline.isset(
"xml-interface")
73 : cmdline.isset(
"json-ui") || cmdline.isset(
"json-interface")
77 cmdline.isset(
"flush"),
78 cmdline.isset(
"timestamp") ? cmdline.get_value(
"timestamp") ==
"monotonic"
80 : cmdline.get_value(
"timestamp") ==
"wall"
88 std::make_unique<console_message_handlert>(
always_flush);
131 if(c ==
'<' || c ==
'>')
135 return std::string();
142 return std::string();
181 return "STATUS-MESSAGE";
186 const std::string &message)
194 std::stringstream ss;
195 const std::string timestamp =
time->stamp();
196 ss << timestamp << (timestamp.empty() ?
"" :
" ") << message;
208 print(level, message, location);
226 INVARIANT(
false,
"Cannot print xml data on PLAIN UI");
233 INVARIANT(
false,
"Cannot print xml data on JSON UI");
248 INVARIANT(
false,
"Cannot print json data on PLAIN UI");
251 INVARIANT(
false,
"Cannot print json data on XML UI");
264 const std::string &message,
275 level, message, location);
281 std::string tmp_message(message);
283 if(!tmp_message.empty() && *tmp_message.rbegin()==
'\n')
284 tmp_message.resize(tmp_message.size()-1);
288 ui_msg(type, tmp_message, location);
296 const std::string &type,
297 const std::string &msg,
316 const std::string &type,
317 const std::string &msg1,
321 result.
name=
"message";
329 const std::string timestamp =
time->stamp();
330 if(!timestamp.empty())
338 const std::string &type,
339 const std::string &msg1,
347 result[
"sourceLocation"] =
json(location);
351 const std::string timestamp =
time->stamp();
352 if(!timestamp.empty())
Provides methods for streaming JSON arrays.
virtual void print(unsigned level, const std::string &message)=0
const irep_idt & get_file() const
A way of representing nested key/value data.
Timestamp class hierarchy.
clockt
Derived types of timestampert.
void print(unsigned level, const structured_datat &data) override
virtual void json_ui_msg(const std::string &type, const std::string &msg, const source_locationt &location)
const char * level_string(unsigned level)
std::string command(unsigned c) const override
Create an ECMA-48 SGR (Select Graphic Rendition) command.
virtual uit get_ui() const
static bool is_sgr_style_command(unsigned c)
Returns true iff c is a Select Graphic Rendition (SGR) parameter value used by messaget for terminal ...
message_handlert * message_handler
std::unique_ptr< const timestampert > time
virtual void flush(unsigned level) override
virtual void xml_ui_msg(const std::string &type, const std::string &msg, const source_locationt &location)
std::unique_ptr< json_stream_arrayt > json_stream
virtual ~ui_message_handlert()
ui_message_handlert(const class cmdlinet &, const std::string &program)
virtual void ui_msg(const std::string &type, const std::string &msg, const source_locationt &location)
std::unique_ptr< console_message_handlert > console_message_handler
xmlt & new_element(const std::string &key)
void set_attribute(const std::string &attribute, unsigned value)
jsont to_json(const structured_datat &data)
Convert the structured_datat into an json object.
static void json(json_objectT &result, const irep_idt &property_id, const property_infot &property_info)
xmlt xml(const irep_idt &property_id, const property_infot &property_info)
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
std::string to_pretty(const structured_datat &data)
Convert the structured_data into plain text.
xmlt to_xml(const structured_datat &data)
Convert the structured_datat into an xml object.