get rid of EXV_CALL_MEMBER_FN
std::invoke can be used. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
2108ae671a
commit
357d970425
@ -16,17 +16,6 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
/*!
|
|
||||||
@brief Macro to make calls to member functions through a pointer more readable.
|
|
||||||
See the C++ FAQ LITE, item
|
|
||||||
<a href="http://www.parashift.com/c++-faq-lite/pointers-to-members.html#faq-33.5" title="[33.5] How can I avoid
|
|
||||||
syntax errors when calling a member function using a pointer-to-member-function?">[33.5] How can I avoid syntax errors
|
|
||||||
when calling a member function using a pointer-to-member-function?</a>.
|
|
||||||
*/
|
|
||||||
#define EXV_CALL_MEMBER_FN(object, ptrToMember) ((object).*(ptrToMember))
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
|
|
||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
// namespace extensions
|
// namespace extensions
|
||||||
namespace Exiv2 {
|
namespace Exiv2 {
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
// + standard includes
|
// + standard includes
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <functional>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
@ -499,7 +500,7 @@ Converter::Converter(IptcData& iptcData, XmpData& xmpData, const char* iptcChars
|
|||||||
void Converter::cnvToXmp() {
|
void Converter::cnvToXmp() {
|
||||||
for (auto&& c : conversion_) {
|
for (auto&& c : conversion_) {
|
||||||
if ((c.metadataId_ == mdExif && exifData_) || (c.metadataId_ == mdIptc && iptcData_)) {
|
if ((c.metadataId_ == mdExif && exifData_) || (c.metadataId_ == mdIptc && iptcData_)) {
|
||||||
EXV_CALL_MEMBER_FN(*this, c.key1ToKey2_)(c.key1_, c.key2_);
|
std::invoke(c.key1ToKey2_, *this, c.key1_, c.key2_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -507,7 +508,7 @@ void Converter::cnvToXmp() {
|
|||||||
void Converter::cnvFromXmp() {
|
void Converter::cnvFromXmp() {
|
||||||
for (auto&& c : conversion_) {
|
for (auto&& c : conversion_) {
|
||||||
if ((c.metadataId_ == mdExif && exifData_) || (c.metadataId_ == mdIptc && iptcData_)) {
|
if ((c.metadataId_ == mdExif && exifData_) || (c.metadataId_ == mdIptc && iptcData_)) {
|
||||||
EXV_CALL_MEMBER_FN(*this, c.key2ToKey1_)(c.key2_, c.key1_);
|
std::invoke(c.key2ToKey1_, *this, c.key2_, c.key1_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
#include "tiffvisitor_int.hpp" // see bug #487
|
#include "tiffvisitor_int.hpp" // see bug #487
|
||||||
#include "value.hpp"
|
#include "value.hpp"
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
@ -421,11 +422,9 @@ void TiffDecoder::decodeTiffEntry(const TiffEntryBase* object) {
|
|||||||
if (!object->pValue())
|
if (!object->pValue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const DecoderFct decoderFct = findDecoderFct_(make_, object->tag(), object->group());
|
|
||||||
// skip decoding if decoderFct == 0
|
// skip decoding if decoderFct == 0
|
||||||
if (decoderFct) {
|
if (auto decoderFct = findDecoderFct_(make_, object->tag(), object->group()))
|
||||||
EXV_CALL_MEMBER_FN(*this, decoderFct)(object);
|
std::invoke(decoderFct, *this, object);
|
||||||
}
|
|
||||||
} // TiffDecoder::decodeTiffEntry
|
} // TiffDecoder::decodeTiffEntry
|
||||||
|
|
||||||
void TiffDecoder::decodeStdTiffEntry(const TiffEntryBase* object) {
|
void TiffDecoder::decodeStdTiffEntry(const TiffEntryBase* object) {
|
||||||
@ -737,10 +736,9 @@ void TiffEncoder::encodeTiffComponent(TiffEntryBase* object, const Exifdatum* da
|
|||||||
// Skip encoding image tags of existing TIFF image - they were copied earlier -
|
// Skip encoding image tags of existing TIFF image - they were copied earlier -
|
||||||
// but encode image tags of new images (creation)
|
// but encode image tags of new images (creation)
|
||||||
if (ed && !isImageTag(object->tag(), object->group())) {
|
if (ed && !isImageTag(object->tag(), object->group())) {
|
||||||
const EncoderFct fct = findEncoderFct_(make_, object->tag(), object->group());
|
if (auto fct = findEncoderFct_(make_, object->tag(), object->group())) {
|
||||||
if (fct) {
|
|
||||||
// If an encoding function is registered for the tag, use it
|
// If an encoding function is registered for the tag, use it
|
||||||
EXV_CALL_MEMBER_FN(*this, fct)(object, ed);
|
std::invoke(fct, *this, object, ed);
|
||||||
} else {
|
} else {
|
||||||
// Else use the encode function at the object (results in a double-dispatch
|
// Else use the encode function at the object (results in a double-dispatch
|
||||||
// to the appropriate encoding function of the encoder.
|
// to the appropriate encoding function of the encoder.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user