2023-07-14 11:31:28 +01:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
/*
|
|
|
|
* Prism Launcher - Minecraft Launcher
|
|
|
|
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, version 3.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2016-01-01 23:35:54 +00:00
|
|
|
#include "JavaInstall.h"
|
2022-11-03 19:41:55 +00:00
|
|
|
|
|
|
|
#include "StringUtils.h"
|
2016-01-01 23:35:54 +00:00
|
|
|
|
2023-07-14 11:31:13 +01:00
|
|
|
bool JavaInstall::operator<(const JavaInstall& rhs)
|
2016-01-01 23:35:54 +00:00
|
|
|
{
|
2022-11-03 19:41:55 +00:00
|
|
|
auto archCompare = StringUtils::naturalCompare(arch, rhs.arch, Qt::CaseInsensitive);
|
2023-07-14 11:31:13 +01:00
|
|
|
if (archCompare != 0)
|
2016-01-01 23:35:54 +00:00
|
|
|
return archCompare < 0;
|
2023-07-14 11:31:13 +01:00
|
|
|
if (id < rhs.id) {
|
2016-01-01 23:35:54 +00:00
|
|
|
return true;
|
|
|
|
}
|
2023-07-14 11:31:13 +01:00
|
|
|
if (id > rhs.id) {
|
2016-01-01 23:35:54 +00:00
|
|
|
return false;
|
|
|
|
}
|
2022-11-03 19:41:55 +00:00
|
|
|
return StringUtils::naturalCompare(path, rhs.path, Qt::CaseInsensitive) < 0;
|
2016-01-01 23:35:54 +00:00
|
|
|
}
|
|
|
|
|
2023-07-14 11:31:13 +01:00
|
|
|
bool JavaInstall::operator==(const JavaInstall& rhs)
|
2016-01-01 23:35:54 +00:00
|
|
|
{
|
|
|
|
return arch == rhs.arch && id == rhs.id && path == rhs.path;
|
|
|
|
}
|
|
|
|
|
2023-07-14 11:31:13 +01:00
|
|
|
bool JavaInstall::operator>(const JavaInstall& rhs)
|
2016-01-01 23:35:54 +00:00
|
|
|
{
|
|
|
|
return (!operator<(rhs)) && (!operator==(rhs));
|
|
|
|
}
|