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

Method UnescapeString

lib/base/utility.cpp:1586–1604  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1584}
1585
1586String Utility::UnescapeString(const String& s)
1587{
1588 std::ostringstream result;
1589
1590 for (String::SizeType i = 0; i < s.GetLength(); i++) {
1591 if (s[i] == '%') {
1592 if (i + 2 > s.GetLength() - 1)
1593 BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid escape sequence."));
1594
1595 char ch = HexDecode(s[i + 1]) * 16 + HexDecode(s[i + 2]);
1596 result << ch;
1597
1598 i += 2;
1599 } else
1600 result << s[i];
1601 }
1602
1603 return result.str();
1604}
1605
1606#ifndef _WIN32
1607static String UnameHelper(char type)

Callers

nothing calls this directly

Calls 2

HexDecodeFunction · 0.85
GetLengthMethod · 0.45

Tested by

no test coverage detected