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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user