@@ -33,36 +33,37 @@ void ebmc_baset::show_properties()
3333{
3434 unsigned p_nr=1 ;
3535
36+ auto make_xml =
37+ [](const ebmc_propertiest::propertyt &p, std::size_t p_nr) -> xmlt {
38+ xmlt xml (" property" );
39+ xml.set_attribute (" name" , id2string (p.name ));
40+
41+ xml.new_element (" number" ).data = std::to_string (p_nr); // will go away
42+ xml.new_element (" description" ).data = p.description ;
43+
44+ if (p.location .is_not_nil ())
45+ xml.new_element (" location" ) = ::xml (p.location );
46+
47+ return xml;
48+ };
49+
3650 for (const auto &p : properties.properties )
3751 {
38- switch (static_cast <ui_message_handlert &>(message.get_message_handler ()).get_ui ()) {
52+ switch (static_cast <ui_message_handlert &>(message.get_message_handler ())
53+ .get_ui ())
54+ {
3955 case ui_message_handlert::uit::XML_UI:
40- {
41- xmlt xml (" property" );
42- xml.set_attribute (" name" , id2string (p.name ));
43-
44- xml.new_element (" number" ).data =std::to_string (p_nr); // will go away
45- xml.new_element (" expression" ).data =p.expr_string ;
46- xml.new_element (" description" ).data =p.description ;
47-
48- if (p.location .is_not_nil ())
49- xml.new_element (" location" )=::xml (p.location );
50-
51- std::cout << xml << ' \n ' ;
52- }
56+ std::cout << make_xml (p, p_nr) << ' \n ' ;
5357 break ;
5458
5559 case ui_message_handlert::uit::PLAIN:
56- std::cout << p.name << " : " ;
57- std::cout << p.expr_string ;
58- if (!p.description .empty ())
59- std::cout << " (" << p.description << " )" ;
60- std::cout << ' \n ' ;
60+ std::cout << p.name << " : " << p.description << ' \n ' ;
6161 break ;
62+
6263 case ui_message_handlert::uit::JSON_UI:
6364 default :;
6465 }
65-
66+
6667 p_nr++;
6768 }
6869}
0 commit comments