예제 #1
0
void ui_message_handlert::xml_ui_msg(
  const std::string &type,
  const std::string &msg1,
  const std::string &msg2,
  const source_locationt &location)
{
  xmlt result;
  result.name="message";

  if(location.is_not_nil() &&
     !location.get_file().empty())
    result.new_element(xml(location));

  result.new_element("text").data=msg1;
  result.set_attribute("type", type);
  
  std::cout << result;
  std::cout << std::endl;
}
예제 #2
0
void ui_message_handlert::json_ui_msg(
  const std::string &type,
  const std::string &msg1,
  const std::string &msg2,
  const source_locationt &location)
{
  json_objectt result;

  #if 0
  if(location.is_not_nil() &&
     !location.get_file().empty())
    result.new_element(xml(location));
  #endif

  result["messageType"] = json_stringt(type);
  result["messageText"] = json_stringt(msg1);

  //By convention a leading comma is created by every new array entry.
  //The first entry is generated in the constructor and does not have
  //  a trailing comma.
  std::cout << ",\n" << result;
}