Base: add method isEqual() to Base::Flags<> to simplify comparison
This commit is contained in:
@@ -187,11 +187,7 @@ bool ColorGradientProfile::isEqual(const ColorGradientProfile& cg) const
|
||||
return false;
|
||||
if (fMax != cg.fMax)
|
||||
return false;
|
||||
if (visibility.testFlag(Visibility::Grayed) !=
|
||||
cg.visibility.testFlag(Visibility::Grayed))
|
||||
return false;
|
||||
if (visibility.testFlag(Visibility::Invisible) !=
|
||||
cg.visibility.testFlag(Visibility::Invisible))
|
||||
if (!visibility.isEqual(cg.visibility))
|
||||
return false;
|
||||
if (tColorModel != cg.tColorModel)
|
||||
return false;
|
||||
|
||||
@@ -116,10 +116,13 @@ public:
|
||||
using u = typename std::underlying_type<Enum>::type;
|
||||
return (i & f) == f && (static_cast<u>(f) != 0 || i == f);
|
||||
}
|
||||
constexpr inline void setFlag(Enum f, bool on = true)
|
||||
{
|
||||
constexpr inline void setFlag(Enum f, bool on = true) {
|
||||
on ? (i |= f) : (i &= ~f);
|
||||
}
|
||||
constexpr bool isEqual(Flags f) const {
|
||||
using u = typename std::underlying_type<Enum>::type;
|
||||
return static_cast<u>(i) == static_cast<u>(f.i);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user