ABI compatiblity
Alexis Horner
alexis.horner at tum.de
Sat Jun 18 22:25:52 BST 2022
Hi,
I read the KDE wiki page [1] about binary compatibility for library code
and was wondering:
Does ABI compatibility have to be maintained for classes in the lib/
folder ?
For context, I am working on issue 399069 [2] which consists in adding
metadata editing capabilities to gwenview. My current goal is to be able
to modify the metadata in Document and save these modifications at the
same time as the image.
Currently, Document and JpegContent store separate copies of the
metadata. When the document is saved, the version in JpegContent is
written to the disk, while the one in Document is ignored.
I would need to change AbstractDocumentImpl::setDocumentExiv2Image to
accept an std::shared_ptr instead of an std::unique_ptr to be able to
share the Exiv2::Image between Document and JpegContent (i.e. have only
one version).
I think sharing the metadata makes sense, because when modifying an
image, JpegContent updates Exif.Photo.PixelXDimension and
PixelYDimension, so it means that both the modifications in Document and
JpegContent have to be taken into account when saving the document.
Another possibility is keep two versions and pass the Exiv2::Image copy
from the Document to JpegContent on save with something like
bool JpegContent::save(QIODevice *, Exiv2::Image *)
and let JpegContent merge the changes. Of course
DocumentLoadedImpl::saveInternal would need an overload that
takes an Exiv2::Image, which would also break ABI compatibility, because
it's a virtual method.
If modifying the ABI is not possible, I can try to use signals and slots
to share the Exiv2::Image or to propagate modifications to JpegContent.
What do you think ?
There may be better possibilities I have not considered, feel free to
make suggestions.
Thanks in advance for your answer
Kind regards,
Alexis Horner
[1]
https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B
[2] https://bugs.kde.org/show_bug.cgi?id=399069
More information about the Gwenview-devel
mailing list