2016-07-28 20:01:08 +03:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 13:23:14 +03:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-07-28 20:01:08 +03:00
|
|
|
|
2018-01-03 13:23:14 +03:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-07-28 20:01:08 +03:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace qthelp {
|
|
|
|
|
|
|
|
inline QString url_encode(const QString &part) {
|
|
|
|
return QString::fromLatin1(QUrl::toPercentEncoding(part));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline QString url_decode(const QString &encoded) {
|
|
|
|
return QUrl::fromPercentEncoding(encoded.toUtf8());
|
|
|
|
}
|
|
|
|
|
|
|
|
enum class UrlParamNameTransform {
|
|
|
|
NoTransform,
|
|
|
|
ToLower,
|
|
|
|
};
|
|
|
|
// Parses a string like "p1=v1&p2=v2&..&pn=vn" to a map.
|
|
|
|
QMap<QString, QString> url_parse_params(const QString ¶ms, UrlParamNameTransform transform = UrlParamNameTransform::NoTransform);
|
|
|
|
|
|
|
|
} // namespace qthelp
|