void gdipp_setting::load_gdimm_process(const xpath_node_set &process_nodes) { // backward iterate so that first-coming process settings overwrites last-coming ones xpath_node_set::const_iterator node_iter = process_nodes.end(); node_iter--; for (size_t i = 0; i < process_nodes.size(); i++, node_iter--) { // only store the setting items which match the current process name const xml_node curr_proc = node_iter->node(); const xml_attribute name_attr = curr_proc.attribute(L"name"); bool process_matched = name_attr.empty(); if (!process_matched) { const wregex name_ex(name_attr.value(), regex_flags); process_matched = regex_match(_process_name, name_ex); } if (process_matched) { for (xml_node::iterator set_iter = node_iter->node().begin(); set_iter != node_iter->node().end(); set_iter++) parse_gdimm_setting_node(*set_iter, _process_setting); } } }
void gdipp_setting::load_gdimm_font(const xpath_node_set &font_node) { for (xpath_node_set::const_iterator node_iter = font_node.begin(); node_iter != font_node.end(); node_iter++) { setting_map curr_settings; for (xml_node::iterator set_iter = node_iter->node().begin(); set_iter != node_iter->node().end(); set_iter++) parse_gdimm_setting_node(*set_iter, curr_settings); const xml_node curr_font = node_iter->node(); const xml_attribute name_attr = curr_font.attribute(L"name"); const xml_attribute bold_attr = curr_font.attribute(L"bold"); const xml_attribute italic_attr = curr_font.attribute(L"italic"); const xml_attribute max_height_attr = curr_font.attribute(L"max_height"); // negative indicates such optional attribute is not specified const gdimm_font_node new_font = {(name_attr.empty() ? wstring() : name_attr.value()), (bold_attr.empty() ? -1 : bold_attr.as_uint()), (italic_attr.empty() ? -1 : italic_attr.as_uint()), (max_height_attr.empty() ? -1 : max_height_attr.as_uint()), curr_settings}; _gdimm_font.push_back(new_font); } }