fixed warning

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
(cherry picked from commit 440afcedb0)
This commit is contained in:
Trial97 2023-07-14 13:32:18 +03:00 committed by github-actions[bot]
parent 5aa3aabdf9
commit 1389b74a8a
2 changed files with 21 additions and 0 deletions

View File

@ -18,6 +18,7 @@
#include "JavaInstall.h" #include "JavaInstall.h"
#include "BaseVersion.h"
#include "StringUtils.h" #include "StringUtils.h"
bool JavaInstall::operator<(const JavaInstall& rhs) bool JavaInstall::operator<(const JavaInstall& rhs)
@ -43,3 +44,21 @@ bool JavaInstall::operator>(const JavaInstall& rhs)
{ {
return (!operator<(rhs)) && (!operator==(rhs)); return (!operator<(rhs)) && (!operator==(rhs));
} }
bool JavaInstall::operator<(BaseVersion& a)
{
try {
return operator<(dynamic_cast<JavaInstall&>(a));
} catch (const std::bad_cast& e) {
return BaseVersion::operator<(a);
}
}
bool JavaInstall::operator>(BaseVersion& a)
{
try {
return operator>(dynamic_cast<JavaInstall&>(a));
} catch (const std::bad_cast& e) {
return BaseVersion::operator>(a);
}
}

View File

@ -30,6 +30,8 @@ struct JavaInstall : public BaseVersion {
virtual QString typeString() const { return arch; } virtual QString typeString() const { return arch; }
virtual bool operator<(BaseVersion& a) override;
virtual bool operator>(BaseVersion& a) override;
bool operator<(const JavaInstall& rhs); bool operator<(const JavaInstall& rhs);
bool operator==(const JavaInstall& rhs); bool operator==(const JavaInstall& rhs);
bool operator>(const JavaInstall& rhs); bool operator>(const JavaInstall& rhs);