code optimized for s attribut cell / row format

improve the performance
This commit is contained in:
sukoi26 2017-08-29 13:01:47 +02:00 committed by GitHub
parent f423c6e3fe
commit b21b856e68

View File

@ -201,9 +201,9 @@ cell xlsx_consumer::read_cell()
auto has_type = parser().attribute_present("t");
auto type = has_type ? parser().attribute("t") : "n";
auto has_format = parser().attribute_present("s");
auto format_id = static_cast<std::size_t>(has_format ? std::stoull(parser().attribute("s")) : 0LL);
if (parser().attribute_present("s"))
cell.format(target_.format(std::stoull(parser().attribute("s"))));
auto has_value = false;
auto value_string = std::string();
@ -286,11 +286,6 @@ cell xlsx_consumer::read_cell()
}
}
if (has_format)
{
cell.format(target_.format(format_id));
}
if (!in_element(qn("spreadsheetml", "row")))
{
expect_end_element(qn("spreadsheetml", "row"));
@ -579,9 +574,9 @@ void xlsx_consumer::read_worksheet_sheetdata()
auto has_type = parser().attribute_present("t");
auto type = has_type ? parser().attribute("t") : "n";
auto has_format = parser().attribute_present("s");
auto format_id = static_cast<std::size_t>(has_format ? std::stoull(parser().attribute("s")) : 0LL);
if (parser().attribute_present("s"))
cell.format(target_.format(std::stoull(parser().attribute("s"))));
auto has_value = false;
auto value_string = std::string();
@ -665,10 +660,6 @@ void xlsx_consumer::read_worksheet_sheetdata()
}
}
if (has_format)
{
cell.format(target_.format(format_id));
}
}
expect_end_element(qn("spreadsheetml", "row"));