Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move utilities out of the Image class #1348

Open
piponazo opened this issue Oct 6, 2020 · 4 comments
Open

Move utilities out of the Image class #1348

piponazo opened this issue Oct 6, 2020 · 4 comments
Labels
refactoring Cleanup / Simplify code -> more readable / robust
Milestone

Comments

@piponazo
Copy link
Collaborator

piponazo commented Oct 6, 2020

In #1347 we noticed that the class Image is containing some utilities that should not be part of such class.

Those utilities could be transformed to free functions or static member functions of other class. Since the Image class contains properties of specific images, I do not think it is a good idea to have those static functions in that class.

Before doing the change, we should analyse if this could have a big impact in consumers of Exiv2.

@piponazo piponazo added the refactoring Cleanup / Simplify code -> more readable / robust label Oct 6, 2020
@clanmills
Copy link
Collaborator

I agree. That stuff ended up in Exiv2 by mistake. I only intended printStructure() to be a debugging thing and it turned into something horrible.

The printStructure() code is at the heart of tvisitor.cpp. The byte swapping in tvisitor.cpp is done using the design in Exiv2. So you have functions such as:

uint32_t getLong(....source.....,endian);
uint16_t getShort(....source.....,endian);

endian is keBig|keLittle and is a property of the source of the data.
source can be an Io stream, or memory buffer.

@piponazo
Copy link
Collaborator Author

piponazo commented Oct 6, 2020

Thanks for your feedback Robin 😉 . It is good to have more details about the history of those functions

@clanmills
Copy link
Collaborator

You are free to change the Exiv2 API for v0.28 as you think best. I hope to get the book finished in 2020 and would like to see Exiv2 v0.28 RC1 released in Spring 2021. When RC1 appears, users will notice big changes and we'll get a lot of feedback. I'm sure we'll need at least 3 RCs. It's be great for Exiv2 v0.28 will ship about the time of LGM in Rennes in late May - however I think it's more likely to be the end of June.

1744 rmills@rmillsmbp:~/gnu/github/exiv2/0.27-maintenance $ nm -g --demangle build/lib/libexiv2.dylib | grep :Image:
000000000007fd40 T Exiv2::Image::isLongType(unsigned short)
000000000007ff50 T Exiv2::Image::isPrintICC(unsigned short, Exiv2::PrintStructureOption)
000000000007ff10 T Exiv2::Image::isPrintXMP(unsigned short, Exiv2::PrintStructureOption)
0000000000083ac0 T Exiv2::Image::setComment(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
00000000000839c0 T Exiv2::Image::setXmpData(Exiv2::XmpData const&)
000000000007fe00 T Exiv2::Image::is2ByteType(unsigned short)
000000000007fe30 T Exiv2::Image::is4ByteType(unsigned short)
000000000007fe90 T Exiv2::Image::is8ByteType(unsigned short)
000000000007fd00 T Exiv2::Image::isShortType(unsigned short)
0000000000083640 T Exiv2::Image::setExifData(Exiv2::ExifData const&)
0000000000083700 T Exiv2::Image::setIptcData(Exiv2::IptcData const&)
00000000000833d0 T Exiv2::Image::setMetadata(Exiv2::Image const&)
0000000000083a80 T Exiv2::Image::clearComment()
0000000000083980 T Exiv2::Image::clearXmpData()
000000000007fca0 T Exiv2::Image::isStringType(unsigned short)
0000000000083c90 T Exiv2::Image::setByteOrder(Exiv2::ByteOrder)
00000000000838b0 T Exiv2::Image::setXmpPacket(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
0000000000083610 T Exiv2::Image::clearExifData()
00000000000836b0 T Exiv2::Image::clearIptcData()
0000000000083260 T Exiv2::Image::clearMetadata()
0000000000083af0 T Exiv2::Image::setIccProfile(Exiv2::DataBuf&, bool)
0000000000083770 T Exiv2::Image::clearXmpPacket()
000000000007fd80 T Exiv2::Image::isLongLongType(unsigned short)
000000000007fdc0 T Exiv2::Image::isRationalType(unsigned short)
000000000007fb80 T Exiv2::Image::printStructure(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, Exiv2::PrintStructureOption, int)
0000000000083c60 T Exiv2::Image::clearIccProfile()
00000000000c1560 T Exiv2::Image::setTypeSupported(int, unsigned short)
00000000000805d0 T Exiv2::Image::printIFDStructure(Exiv2::BasicIo&, std::__1::basic_ostream<char, std::__1::char_traits<char> >&, Exiv2::PrintStructureOption, unsigned int, bool, char, int)
0000000000083070 T Exiv2::Image::printTiffStructure(Exiv2::BasicIo&, std::__1::basic_ostream<char, std::__1::char_traits<char> >&, Exiv2::PrintStructureOption, int, unsigned long)
0000000000083880 T Exiv2::Image::writeXmpFromPacket(bool)
000000000007ff90 T Exiv2::Image::isBigEndianPlatform()
000000000007fff0 T Exiv2::Image::isLittleEndianPlatform()
0000000000082860 T Exiv2::Image::tagName(unsigned short)
0000000000083310 T Exiv2::Image::xmpData()
00000000000832d0 T Exiv2::Image::exifData()
00000000000832f0 T Exiv2::Image::iptcData()
0000000000083330 T Exiv2::Image::xmpPacket()
000000000007f5e0 T Exiv2::Image::Image(int, unsigned short, std::__1::auto_ptr<Exiv2::BasicIo>)
000000000007fb70 T Exiv2::Image::~Image()
000000000007fb60 T Exiv2::Image::~Image()
000000000007f910 T Exiv2::Image::~Image()
0000000000083cd0 T Exiv2::Image::pixelWidth() const
0000000000083cf0 T Exiv2::Image::pixelHeight() const
0000000000083e20 T Exiv2::Image::nativePreviews() const
0000000000084000 T Exiv2::Image::supportsMetadata(Exiv2::MetadataId) const
00000000000833b0 T Exiv2::Image::writeXmpFromPacket() const
0000000000083dd0 T Exiv2::Image::io() const
0000000000083e40 T Exiv2::Image::good() const
0000000000083d70 T Exiv2::Image::comment() const
0000000000083d50 T Exiv2::Image::xmpData() const
00000000000800f0 T Exiv2::Image::byteSwap(unsigned int, bool) const
0000000000080170 T Exiv2::Image::byteSwap(unsigned short, bool) const
0000000000080020 T Exiv2::Image::byteSwap(unsigned long long, bool) const
0000000000083d10 T Exiv2::Image::exifData() const
0000000000083d30 T Exiv2::Image::iptcData() const
0000000000080430 T Exiv2::Image::typeName(unsigned short) const
0000000000083cb0 T Exiv2::Image::byteOrder() const
00000000000801f0 T Exiv2::Image::byteSwap2(Exiv2::DataBuf const&, unsigned long, bool) const
00000000000802a0 T Exiv2::Image::byteSwap4(Exiv2::DataBuf const&, unsigned long, bool) const
0000000000080370 T Exiv2::Image::byteSwap8(Exiv2::DataBuf const&, unsigned long, bool) const
00000000000835e0 T Exiv2::Image::checkMode(Exiv2::MetadataId) const
00000000000c1f50 T Exiv2::Image::imageType() const
0000000000083db0 T Exiv2::Image::xmpPacket() const
1745 rmills@rmillsmbp:~/gnu/github/exiv2/0.27-maintenance $

@clanmills clanmills added this to the v1.00 milestone Apr 12, 2021
@clanmills
Copy link
Collaborator

This is a good idea. As we have a new API with v1.00, let's clean this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Cleanup / Simplify code -> more readable / robust
Projects
None yet
Development

No branches or pull requests

3 participants