App: add Property::isSame() API

To compare if two property contains the same content. The default
implementation in Property uses the persistense interface to save both
properties to string and compares the content. This may not work at the
moment if the property saves content in separate file or in binary.

Various properties have cheaper implementation to direct compare their
internal values.
This commit is contained in:
Zheng, Lei
2020-01-01 18:26:39 +08:00
committed by Chris Hennes
parent 51d4e5c2a9
commit 08cdd323b6
9 changed files with 133 additions and 6 deletions

View File

@@ -276,6 +276,17 @@ void Property::setStatus(Status pos, bool on) {
bits.set(pos,on);
setStatusValue(bits.to_ulong());
}
bool Property::isSame(const Property &other) const {
if(other.getTypeId() != getTypeId() || getMemSize() != other.getMemSize())
return false;
Base::StringWriter writer,writer2;
Save(writer);
other.Save(writer2);
return writer.getString() == writer2.getString();
}
//**************************************************************************
//**************************************************************************
// PropertyListsBase