Commit 02890d62 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

C++20: Use defaulted equality comparison

parent a1be94f8
Pipeline #202850 passed with stage
in 2 minutes and 28 seconds
......@@ -210,31 +210,6 @@ void Card::setCanLearnKeys(bool value)
mCanLearn = value;
}
bool Card::operator == (const Card &other) const
{
return mCanLearn == other.mCanLearn
&& mHasNullPin == other.mHasNullPin
&& mStatus == other.mStatus
&& mSerialNumber == other.mSerialNumber
&& mAppName == other.mAppName
&& mAppVersion == other.mAppVersion
&& mCardType == other.mCardType
&& mCardVersion == other.mCardVersion
&& mCardHolder == other.mCardHolder
&& mSigningKeyRef == other.mSigningKeyRef
&& mEncryptionKeyRef == other.mEncryptionKeyRef
&& mAuthenticationKeyRef == other.mAuthenticationKeyRef
&& mPinStates == other.mPinStates
&& mErrMsg == other.mErrMsg
&& mKeyInfos == other.mKeyInfos
&& mCardInfo == other.mCardInfo;
}
bool Card::operator != (const Card &other) const
{
return !operator==(other);
}
void Card::setErrorMsg(const QString &msg)
{
mErrMsg = msg;
......
......@@ -51,8 +51,7 @@ public:
Card();
virtual ~Card();
virtual bool operator == (const Card &other) const;
bool operator != (const Card &other) const;
bool operator==(const Card &) const = default;
void setStatus(Status s);
Status status() const;
......
......@@ -82,19 +82,3 @@ void KeyPairInfo::update(const KeyPairInfo &other)
algorithm = other.algorithm;
}
}
// C++20: Replace with defaulted equality operator
bool KeyPairInfo::operator==(const KeyPairInfo &other) const
{
return keyRef == other.keyRef
&& grip == other.grip
&& usage == other.usage
&& keyTime == other.keyTime
&& algorithm == other.algorithm;
}
// C++20: Remove
bool KeyPairInfo::operator!=(const KeyPairInfo &other) const
{
return !operator==(other);
}
......@@ -24,8 +24,7 @@ struct KeyPairInfo {
void update(const KeyPairInfo &other);
bool operator==(const KeyPairInfo &other) const;
bool operator!=(const KeyPairInfo &other) const;
bool operator==(const KeyPairInfo &) const = default;
std::string keyRef;
std::string grip;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment