Code Cleanup
- Removed unused util.cpp encode and decode functions.
This commit is contained in:
47
src/util.cpp
47
src/util.cpp
@@ -325,53 +325,6 @@ int execute (
|
||||
// Collides with std::numeric_limits methods
|
||||
#undef max
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Encode values prior to serialization.
|
||||
// [ -> &open;
|
||||
// ] -> &close;
|
||||
const std::string encode (const std::string& value)
|
||||
{
|
||||
std::string modified = value;
|
||||
|
||||
str_replace (modified, "[", "&open;");
|
||||
str_replace (modified, "]", "&close;");
|
||||
|
||||
return modified;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Decode values after parse.
|
||||
// " <- &dquot;
|
||||
// ' <- &squot; or "
|
||||
// , <- ,
|
||||
// [ <- &open;
|
||||
// ] <- &close;
|
||||
// : <- :
|
||||
const std::string decode (const std::string& value)
|
||||
{
|
||||
if (value.find ('&') != std::string::npos)
|
||||
{
|
||||
std::string modified = value;
|
||||
|
||||
// Supported encodings.
|
||||
str_replace (modified, "&open;", "[");
|
||||
str_replace (modified, "&close;", "]");
|
||||
|
||||
// Support for deprecated encodings. These cannot be removed or old files
|
||||
// will not be parsable. Not just old files - completed.data can contain
|
||||
// tasks formatted/encoded using these.
|
||||
str_replace (modified, "&dquot;", "\"");
|
||||
str_replace (modified, """, "'");
|
||||
str_replace (modified, "&squot;", "'"); // Deprecated 2.0
|
||||
str_replace (modified, ",", ","); // Deprecated 2.0
|
||||
str_replace (modified, ":", ":"); // Deprecated 2.0
|
||||
|
||||
return modified;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Escapes any unescaped character of type c within the given string
|
||||
// e.g. ' ' -> '\ '
|
||||
|
||||
Reference in New Issue
Block a user