Performance

- Added a shortcut test that speeds up the decode process for most cases.
This commit is contained in:
Paul Beckingham
2012-01-30 00:18:53 -05:00
parent 5609711d47
commit 5e4f7feff8

View File

@@ -515,6 +515,8 @@ const std::string encode (const std::string& value)
// ] <- &close; // ] <- &close;
// : <- &colon; // : <- &colon;
const std::string decode (const std::string& value) const std::string decode (const std::string& value)
{
if (value.find ('&') != std::string::npos)
{ {
std::string modified = value; std::string modified = value;
@@ -534,6 +536,9 @@ const std::string decode (const std::string& value)
return modified; return modified;
} }
return value;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Escapes any unescaped character of type c within the given string // Escapes any unescaped character of type c within the given string
// e.g. ' ' -> '\ ' // e.g. ' ' -> '\ '