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 875452c020
commit 54c484df9b
9 changed files with 133 additions and 6 deletions

View File

@@ -103,6 +103,13 @@ public:
virtual void Paste(const Property &from);
virtual unsigned int getMemSize (void) const;
virtual bool isSame(const Property &other) const {
return getTypeId() == other.getTypeId()
&& _BaseFileName == static_cast<decltype(this)>(&other)->_BaseFileName
&& _OriginalName == static_cast<decltype(this)>(&other)->_OriginalName
&& _cValue == static_cast<decltype(this)>(&other)->_cValue;
}
/** get a temp file name in the transient path of the document.
* Using this file for new Version of the file and set
* this file with setValue() is the fastest way to change