Delete Concrete(Read|Data)AttributePath equality operator (#32131)
* Delete Concrete(Read|Data)AttributePath equality operator
Right now these default to using the ConcreteAttributePath equality
operator, which is misleading because it will return true for objects
which are not actually equal.
Replace this with the MatchesConcreteAttributePath
function.
A new equality operator for these classes will be introduced in a
follow-up PR. I'm introducing this change separately to ensure that CI
catches any current usage of the equality operator.
* Restyled by clang-format
* Add unit tests
* Restyled by clang-format
---------
Co-authored-by: Restyled.io <commits@restyled.io>
diff --git a/src/app/ConcreteAttributePath.h b/src/app/ConcreteAttributePath.h
index 076575d..253b590 100644
--- a/src/app/ConcreteAttributePath.h
+++ b/src/app/ConcreteAttributePath.h
@@ -87,6 +87,10 @@
mListIndex.SetValue(aListIndex);
}
+ bool operator==(const ConcreteReadAttributePath & aOther) const = delete;
+ bool operator!=(const ConcreteReadAttributePath & aOther) const = delete;
+ bool operator<(const ConcreteReadAttributePath & aOther) const = delete;
+
Optional<uint16_t> mListIndex;
};
@@ -138,6 +142,12 @@
ChipLogValueMEI(mClusterId), ChipLogValueMEI(mAttributeId));
}
+ bool MatchesConcreteAttributePath(const ConcreteAttributePath & aOther) { return ConcreteAttributePath::operator==(aOther); }
+
+ bool operator==(const ConcreteDataAttributePath & aOther) const = delete;
+ bool operator!=(const ConcreteDataAttributePath & aOther) const = delete;
+ bool operator<(const ConcreteDataAttributePath & aOther) const = delete;
+
//
// This index is only valid if `mListOp` is set to a list item operation, i.e
// ReplaceItem, DeleteItem or AppendItem. Otherwise, it is to be ignored.