From ca250bf14979d359a82d5baf11ae9587d5605594 Mon Sep 17 00:00:00 2001 From: B Stack Date: Tue, 17 Sep 2019 08:06:14 -0400 Subject: add upstream 10.16 --- zenXml/zenxml/parser.h | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'zenXml/zenxml/parser.h') diff --git a/zenXml/zenxml/parser.h b/zenXml/zenxml/parser.h index f7604ebf..dbf5a8c4 100644 --- a/zenXml/zenxml/parser.h +++ b/zenXml/zenxml/parser.h @@ -79,31 +79,31 @@ std::string normalize(const std::string& str, Predicate pred) //pred: unary func { std::string output; for (const char c : str) - { - if (c == '&') // - output += "&"; - else if (c == '<') //normalization mandatory: https://www.w3.org/TR/xml/#syntax - output += "<"; - else if (c == '>') // - output += ">"; - else if (pred(c)) + switch (c) { - if (c == '\'') - output += "'"; - else if (c == '"') - output += """; - else - { - output += "&#x"; - const auto [high, low] = hexify(c); - output += high; - output += low; - output += ';'; - } + //*INDENT-OFF* + case '&': output += "&"; break; // + case '<': output += "<"; break; //normalization mandatory: https://www.w3.org/TR/xml/#syntax + case '>': output += ">"; break; // + default: + if (pred(c)) + { + if (c == '\'') output += "'"; + else if (c == '"') output += """; + else + { + output += "&#x"; + const auto [high, low] = hexify(c); + output += high; + output += low; + output += ';'; + } + } + else + output += c; + break; + //*INDENT-ON* } - else - output += c; - } return output; } -- cgit