kdecore: remove unused KUrl::CompareWithoutFragment enum

doubles as optimization for KUrl comparisons

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-06-25 04:44:52 +03:00
parent 94a5a3f641
commit 0917277201
2 changed files with 13 additions and 29 deletions

View file

@ -432,34 +432,23 @@ bool KUrl::equals(const KUrl &u, const EqualsOptions &options) const
return false;
}
if (options & CompareWithoutTrailingSlash || options & CompareWithoutFragment) {
QString path1 = path((options & CompareWithoutTrailingSlash) ? RemoveTrailingSlash : LeaveTrailingSlash);
QString path2 = u.path((options & CompareWithoutTrailingSlash) ? RemoveTrailingSlash : LeaveTrailingSlash);
if (options & AllowEmptyPath) {
if (path1 == QLatin1String("/")) {
path1.clear();
}
if (path2 == QLatin1String("/")) {
path2.clear();
}
QString path1 = path((options & CompareWithoutTrailingSlash) ? RemoveTrailingSlash : LeaveTrailingSlash);
QString path2 = u.path((options & CompareWithoutTrailingSlash) ? RemoveTrailingSlash : LeaveTrailingSlash);
if (options & AllowEmptyPath) {
if (path1 == QLatin1String("/")) {
path1.clear();
}
if (path1 != path2) {
return false;
}
if (scheme() == u.scheme() &&
authority() == u.authority() && // user+pass+host+port
query() == u.query() &&
(fragment() == u.fragment() || options & CompareWithoutFragment))
{
return true;
if (path2 == QLatin1String("/")) {
path2.clear();
}
}
if (path1 != path2) {
return false;
}
return (*this == u);
return (scheme() == u.scheme() &&
authority() == u.authority() && // user+pass+host+port
query() == u.query() && fragment() == u.fragment());
}
KUrl KUrl::fromPath(const QString &text)

View file

@ -587,11 +587,6 @@ public:
*/
CompareWithoutTrailingSlash = 0x01,
/**
* disables comparison of HTML-style references.
*/
CompareWithoutFragment = 0x02,
/**
* Treat a URL with no path as equal to a URL with a path of "/",
* when CompareWithoutTrailingSlash is set.
@ -601,7 +596,7 @@ public:
* This option is ignored if CompareWithoutTrailingSlash isn't set.
* @since 4.5
*/
AllowEmptyPath = 0x04
AllowEmptyPath = 0x02
};
Q_DECLARE_FLAGS(EqualsOptions, EqualsOption)