summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-06-14 23:23:30 +0300
committerAndrei Karas <akaras@inbox.ru>2011-06-14 23:36:38 +0300
commitbf9bccc30a186e338f96c230a4f63cc924c77bd8 (patch)
treee46dbc2f022842982d89164ee598e1bcf827aa39 /src/utils
parentfb0f86589ae9e2d582383cea43e0a391e8d4739d (diff)
downloadplus-bf9bccc30a186e338f96c230a4f63cc924c77bd8.tar.gz
plus-bf9bccc30a186e338f96c230a4f63cc924c77bd8.tar.bz2
plus-bf9bccc30a186e338f96c230a4f63cc924c77bd8.tar.xz
plus-bf9bccc30a186e338f96c230a4f63cc924c77bd8.zip
Add ability to add comments to any players.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/stringutils.cpp13
-rw-r--r--src/utils/stringutils.h4
2 files changed, 15 insertions, 2 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 5e45b6168..dffec3f0c 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -474,7 +474,18 @@ std::string packList(std::list<std::string> &list)
return str;
}
-std::list<std::string> unpackList(const std::string str)
+std::list<std::string> unpackList(const std::string &str)
{
return splitToStringList(str, '|');
}
+
+std::string stringToHexPath(const std::string &str)
+{
+ if (str.empty())
+ return "";
+
+ std::string hex = strprintf("%%%2x/", (int)str[0]);
+ for (unsigned f = 1; f < str.size(); f ++)
+ hex += strprintf("%%%2x", (int)str[f]);
+ return hex;
+}
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 9d22f8ba8..796df92c5 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -182,6 +182,8 @@ std::vector<std::string> getLang();
std::string packList(std::list<std::string> &list);
-std::list<std::string> unpackList(const std::string str);
+std::list<std::string> unpackList(const std::string &str);
+
+std::string stringToHexPath(const std::string &str);
#endif // UTILS_STRINGUTILS_H