Shows how to use xtd::web::css:css_reader class.
#include <xtd/web/css/css_reader>
#include <xtd/console>
 
using namespace xtd::web::css;
 
  for (auto [name, contents] : selectors) {
    console::write_line("{} {{", name);
    for (auto [key, value] : contents.properties())
    console::write_line("}");
  }
}
 
auto main() -> int {
    "  display: none;\n"
    "  position: fixed;\n"
    "  z-index: 100;\n"
    "  width: 100%;\n"
    "  height: 100%;\n"
    "  left: 300;\n"
    "  top: 200;\n"
    "  background: #4080FA;\n"
    "  filter: alpha(opacity=40);\n"
    "  opacity: 0.4;\n"
    "}"};
    
  console::write_line("Write all selectors and all properties :");
  console::write_line("----------------------------------------");
  write_selectors(reader.selectors());
  console::write_line();
  
  console::write_line("Get specific properties :");
  console::write_line("-------------------------");
  console::write_line("filter = {}", reader.selectors().at(".user_box").properties().at("filter"));
  console::write_line("opacity = {}", reader.selectors().at(".user_box").properties().at("opacity").to_single());
  console::write_line("z-index = {}", reader.selectors().at(".user_box").properties().at("z-index").to<int>());
}
 
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
 
Definition css_reader.hpp:16
 
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
 
std::map< xtd::string, xtd::web::css::selector > selector_map
Represents the map of a selector name - selector pair.
Definition selector_map.hpp:13