2016-07-28 17:01:08 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-07-28 17:01:08 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-07-28 17:01:08 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace qthelp {
|
|
|
|
|
2018-08-08 20:11:28 +00:00
|
|
|
const QRegularExpression &RegExpDomain();
|
|
|
|
const QRegularExpression &RegExpDomainExplicit();
|
|
|
|
QRegularExpression RegExpProtocol();
|
|
|
|
|
2016-07-28 17:01:08 +00:00
|
|
|
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.
|
2018-04-12 15:45:04 +00:00
|
|
|
QMap<QString, QString> url_parse_params(
|
|
|
|
const QString ¶ms,
|
|
|
|
UrlParamNameTransform transform = UrlParamNameTransform::NoTransform);
|
|
|
|
|
2018-05-18 17:03:31 +00:00
|
|
|
QString url_append_query_or_hash(const QString &url, const QString &add);
|
2016-07-28 17:01:08 +00:00
|
|
|
|
2018-04-24 19:09:20 +00:00
|
|
|
bool is_ipv6(const QString &ip);
|
|
|
|
|
2018-07-31 19:51:06 +00:00
|
|
|
QString validate_url(const QString &value);
|
|
|
|
|
2016-07-28 17:01:08 +00:00
|
|
|
} // namespace qthelp
|