MCPcopy Create free account
hub / github.com/LAStools/LAStools / escape_xml_value

Function escape_xml_value

LASzip/src/mydefs.cpp:883–904  ·  view source on GitHub ↗

Converts all XML reserved characters in the string to their safe entity codes for valid XML

Source from the content-addressed store, hash-verified

881
882/// Converts all XML reserved characters in the string to their safe entity codes for valid XML
883std::string escape_xml_value(const std::string& value) {
884 std::string out;
885 out.reserve(value.size());
886
887 for (char c : value) {
888 switch (c) {
889 case '&':
890 out += "&";
891 break;
892 case '<':
893 out += "&lt;";
894 break;
895 case '>':
896 out += "&gt;";
897 break;
898 default:
899 out += c;
900 break;
901 }
902 }
903 return out;
904}
905
906/// Compresses a sorted set of indices into readable ranges such as '3-7, 10-12, 20'.
907/// Consecutive values are grouped into ranges, whilst individual values are output separately.

Callers 1

writeMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected