MCPcopy Create free account
hub / github.com/Icinga/icinga2 / EscapeString

Method EscapeString

lib/base/utility.cpp:1562–1584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1560}
1561
1562String Utility::EscapeString(const String& s, const String& chars, const bool illegal)
1563{
1564 std::ostringstream result;
1565 if (illegal) {
1566 for (char ch : s) {
1567 if (chars.FindFirstOf(ch) != String::NPos || ch == '%') {
1568 result << '%';
1569 HexEncode(ch, result);
1570 } else
1571 result << ch;
1572 }
1573 } else {
1574 for (char ch : s) {
1575 if (chars.FindFirstOf(ch) == String::NPos || ch == '%') {
1576 result << '%';
1577 HexEncode(ch, result);
1578 } else
1579 result << ch;
1580 }
1581 }
1582
1583 return result.str();
1584}
1585
1586String Utility::UnescapeString(const String& s)
1587{

Callers

nothing calls this directly

Calls 2

HexEncodeFunction · 0.85
FindFirstOfMethod · 0.80

Tested by

no test coverage detected