mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-14 09:02:06 +00:00
Merge remote-tracking branch 'remote/master' into SoftFever
This commit is contained in:
@@ -1182,6 +1182,42 @@ std::string xml_escape(std::string text, bool is_marked/* = false*/)
|
||||
return text;
|
||||
}
|
||||
|
||||
std::string xml_unescape(std::string s)
|
||||
{
|
||||
std::string ret;
|
||||
std::string::size_type i = 0;
|
||||
std::string::size_type pos = 0;
|
||||
while (i < s.size()) {
|
||||
std::string rep;
|
||||
if (s[i] == '&') {
|
||||
if (s.substr(i, 4) == "<") {
|
||||
ret += s.substr(pos, i - pos) + "<";
|
||||
i += 4;
|
||||
pos = i;
|
||||
}
|
||||
else if (s.substr(i, 4) == ">") {
|
||||
ret += s.substr(pos, i - pos) + ">";
|
||||
i += 4;
|
||||
pos = i;
|
||||
}
|
||||
else if (s.substr(i, 5) == "&") {
|
||||
ret += s.substr(pos, i - pos) + "&";
|
||||
i += 5;
|
||||
pos = i;
|
||||
}
|
||||
else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
ret += s.substr(pos);
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string format_memsize_MB(size_t n)
|
||||
{
|
||||
std::string out;
|
||||
|
||||
Reference in New Issue
Block a user