mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
escape_ampersand function and changed order of printer names and pictures in config wizard
This commit is contained in:
parent
4f85a42830
commit
0a4ce079e8
3 changed files with 23 additions and 3 deletions
|
@ -192,6 +192,23 @@ bool unescape_strings_cstyle(const std::string &str, std::vector<std::string> &o
|
|||
}
|
||||
}
|
||||
|
||||
std::string escape_ampersand(const std::string& str)
|
||||
{
|
||||
// Allocate a buffer 2 times the input string length,
|
||||
// so the output will fit even if all input characters get escaped.
|
||||
std::vector<char> out(str.size() * 6, 0);
|
||||
char* outptr = out.data();
|
||||
for (size_t i = 0; i < str.size(); ++i) {
|
||||
char c = str[i];
|
||||
if (c == '&') {
|
||||
(*outptr++) = '&';
|
||||
(*outptr++) = '&';
|
||||
} else
|
||||
(*outptr++) = c;
|
||||
}
|
||||
return std::string(out.data(), outptr - out.data());
|
||||
}
|
||||
|
||||
std::vector<std::string> ConfigOptionDef::cli_args(const std::string &key) const
|
||||
{
|
||||
std::vector<std::string> args;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue