Rename class ISOBMFF => class bmffImage to match other image handlers. Removed C++11 style code. Removed unused code.

main
Robin Mills 4 years ago
parent 460a802671
commit 0844e1bbfb

@ -43,7 +43,7 @@ namespace Exiv2
/*! /*!
@brief Class to access ISO BMFF images. @brief Class to access ISO BMFF images.
*/ */
class EXIV2API ISOBMFF : public Image { class EXIV2API BmffImage : public Image {
public: public:
//! @name Creators //! @name Creators
//@{ //@{
@ -61,13 +61,13 @@ namespace Exiv2
@param create Specifies if an existing image should be read (false) @param create Specifies if an existing image should be read (false)
or if a new file should be created (true). or if a new file should be created (true).
*/ */
ISOBMFF(BasicIo::AutoPtr io, bool create); BmffImage(BasicIo::AutoPtr io, bool create);
//@} //@}
//! @name Manipulators //! @name Manipulators
//@{ //@{
void readMetadata() override; void readMetadata() /* override */ ;
void writeMetadata() override; void writeMetadata() /* override */ ;
/*! /*!
@brief Print out the structure of image file. @brief Print out the structure of image file.
@ -75,27 +75,28 @@ namespace Exiv2
not valid (does not look like data of the specific image type). not valid (does not look like data of the specific image type).
@warning This function is not thread safe and intended for exiv2 -pS for debugging. @warning This function is not thread safe and intended for exiv2 -pS for debugging.
*/ */
void printStructure(std::ostream& out, PrintStructureOption option,int depth) override; void printStructure(std::ostream& out, PrintStructureOption option,int depth) /* override */ ;
/*! /*!
@brief Todo: Not supported yet(?). Calling this function will throw @brief Todo: Not supported yet(?). Calling this function will throw
an instance of Error(kerInvalidSettingForImage). an instance of Error(kerInvalidSettingForImage).
*/ */
void setComment(const std::string& comment) override; void setComment(const std::string& comment) /* override */ ;
//@} //@}
//! @name Accessors //! @name Accessors
//@{ //@{
std::string mimeType() const override; std::string mimeType() const /* override */ ;
//@} //@}
#if 0
ISOBMFF& operator=(const ISOBMFF& rhs) = delete; BmffImage& operator=(const BmffImage& rhs) /* = delete*/ ;
ISOBMFF& operator=(const ISOBMFF&& rhs) = delete; BmffImage& operator=(const BmffImage&& rhs) /* = delete */ ;
ISOBMFF(const ISOBMFF& rhs) = delete; BmffImage(const BmffImage& rhs) /* = delete */;
ISOBMFF(const ISOBMFF&& rhs) = delete; BmffImage(const BmffImage&& rhs) /* = delete */;
#endif
private: private:
int fileType = ImageType::bmff; int fileType /* = ImageType::bmff*/ ;
/*! /*!
@brief Provides the main implementation of writeMetadata() by @brief Provides the main implementation of writeMetadata() by
@ -107,7 +108,7 @@ namespace Exiv2
void doWriteMetadata(BasicIo& outIo); void doWriteMetadata(BasicIo& outIo);
//@} //@}
}; // class ISOBMFF }; // class BmffImage
// ***************************************************************************** // *****************************************************************************
// template, inline and free functions // template, inline and free functions

@ -46,9 +46,9 @@
#include "exiv2/image.hpp" #include "exiv2/image.hpp"
#include "exiv2/ini.hpp" #include "exiv2/ini.hpp"
#include "exiv2/iptc.hpp" #include "exiv2/iptc.hpp"
#ifdef EXV_ENABLE_ISOBMFF #ifdef EXV_ENABLE_ISOBMFF
#include "isobmff.hpp" #include "bmffimage.hpp"
#endif // EXV_ENABLE_ISOBMFF #endif// EXV_ENABLE_ISOBMFF
#include "exiv2/jp2image.hpp" #include "exiv2/jp2image.hpp"
#include "exiv2/jpgimage.hpp" #include "exiv2/jpgimage.hpp"
#include "exiv2/metadatum.hpp" #include "exiv2/metadatum.hpp"

@ -46,6 +46,7 @@ add_library( exiv2lib
../include/exiv2/rwlock.hpp ../include/exiv2/rwlock.hpp
../include/exiv2/slice.hpp ../include/exiv2/slice.hpp
basicio.cpp ../include/exiv2/basicio.hpp basicio.cpp ../include/exiv2/basicio.hpp
bmffimage.cpp ../include/exiv2/bmffimage.hpp
bmpimage.cpp ../include/exiv2/bmpimage.hpp bmpimage.cpp ../include/exiv2/bmpimage.hpp
convert.cpp ../include/exiv2/convert.hpp convert.cpp ../include/exiv2/convert.hpp
cr2image.cpp ../include/exiv2/cr2image.hpp cr2image.cpp ../include/exiv2/cr2image.hpp
@ -61,7 +62,6 @@ add_library( exiv2lib
image.cpp ../include/exiv2/image.hpp image.cpp ../include/exiv2/image.hpp
ini.cpp ../include/exiv2/ini.hpp ini.cpp ../include/exiv2/ini.hpp
iptc.cpp ../include/exiv2/iptc.hpp iptc.cpp ../include/exiv2/iptc.hpp
isobmff.cpp ../include/exiv2/isobmff.hpp
jp2image.cpp ../include/exiv2/jp2image.hpp jp2image.cpp ../include/exiv2/jp2image.hpp
jpgimage.cpp ../include/exiv2/jpgimage.hpp jpgimage.cpp ../include/exiv2/jpgimage.hpp
metadatum.cpp ../include/exiv2/metadatum.hpp metadatum.cpp ../include/exiv2/metadatum.hpp

@ -23,7 +23,7 @@
// included header files // included header files
#include "config.h" #include "config.h"
#include "isobmff.hpp" #include "bmffimage.hpp"
#include "tiffimage.hpp" #include "tiffimage.hpp"
#include "image.hpp" #include "image.hpp"
#include "image_int.hpp" #include "image_int.hpp"
@ -32,6 +32,7 @@
#include "futils.hpp" #include "futils.hpp"
#include "types.hpp" #include "types.hpp"
#include "safe_op.hpp" #include "safe_op.hpp"
#include "unused.h"
// + standard includes // + standard includes
#include <string> #include <string>
@ -48,18 +49,20 @@ namespace Exiv2
EXIV2API bool enableISOBMFF(bool enable) EXIV2API bool enableISOBMFF(bool enable)
{ {
#ifdef EXV_ENABLE_ISOBMFF #ifdef EXV_ENABLE_ISOBMFF
enabled = enable; enabled = enable;
#endif // EXV_ENABLE_ISOBMFF return true;
return enabled; #endif//EXV_ENABLE_ISOBMFF
enable = false ;
return enable ;
} }
ISOBMFF::ISOBMFF(BasicIo::AutoPtr io, bool /* create */) BmffImage::BmffImage(BasicIo::AutoPtr io, bool /* create */)
: Image(ImageType::bmff, mdExif | mdIptc | mdXmp, std::move(io)) : Image(ImageType::bmff, mdExif | mdIptc | mdXmp, std::move(io))
{ {
} // ISOBMFF::ISOBMFF } // BmffImage::BmffImage
std::string ISOBMFF::mimeType() const std::string BmffImage::mimeType() const
{ {
/* /*
switch (fileType) switch (fileType)
@ -74,49 +77,21 @@ namespace Exiv2
return "image/unknown"; return "image/unknown";
} }
*/ */
return "image/bmff";
} }
void ISOBMFF::setComment(const std::string& /*comment*/) void BmffImage::setComment(const std::string& /*comment*/)
{ {
// Todo: implement me! // Todo: implement me!
throw(Error(kerInvalidSettingForImage, "Image comment", "ISO BMFF")); throw(Error(kerInvalidSettingForImage, "Image comment", "ISO BMFF"));
} // ISOBMFF::setComment } // ISOBMFF::setComment
static void lf(std::ostream& out, bool& bLF) void BmffImage::readMetadata()
{
if ( bLF ) {
out << std::endl;
out.flush();
bLF = false ;
}
}
static bool isBigEndian()
{
union {
uint32_t i;
char c[4];
} e = { 0x01000000 };
return e.c[0] != 0;
}
static std::string toAscii(long n)
{
const auto p = reinterpret_cast<const char*>(&n);
std::string result;
bool bBigEndian = isBigEndian();
for ( int i = 0 ; i < 4 ; i++) {
result += p[ bBigEndian ? i : (3-i) ];
}
return result;
}
void ISOBMFF::readMetadata()
{ {
} // ISOBMFF::readMetadata } // ISOBMFF::readMetadata
void ISOBMFF::printStructure(std::ostream& out, PrintStructureOption option, int depth) void BmffImage::printStructure(std::ostream& out, PrintStructureOption option, int depth)
{ {
if (io_->open() != 0) if (io_->open() != 0)
throw Error(kerDataSourceOpenFailed, io_->path(), strError()); throw Error(kerDataSourceOpenFailed, io_->path(), strError());
@ -127,17 +102,20 @@ namespace Exiv2
throw Error(kerFailedToReadImageData); throw Error(kerFailedToReadImageData);
throw Error(kerNotAnImage); throw Error(kerNotAnImage);
} }
UNUSED(out);
UNUSED(option);
UNUSED(depth);
} // ISOBMFF::printStructure } // ISOBMFF::printStructure
void ISOBMFF::writeMetadata() void BmffImage::writeMetadata()
{ {
} // ISOBMFF::writeMetadata } // BmffImage::writeMetadata
// ************************************************************************* // *************************************************************************
// free functions // free functions
Image::AutoPtr newBmffInstance(BasicIo::AutoPtr io, bool create) Image::AutoPtr newBmffInstance(BasicIo::AutoPtr io, bool create)
{ {
Image::AutoPtr image(new ISOBMFF(std::move(io), create)); Image::AutoPtr image(new BmffImage(std::move(io), create));
if (!image->good()) if (!image->good())
{ {
image.reset(); image.reset();
@ -158,11 +136,12 @@ namespace Exiv2
{ {
return false; return false;
} }
bool isobmffMatched = buf[4] == 'f' && buf[5] == 't' && buf[6] == 'y' && buf[7] == 'p';
bool result = buf[4] == 'f' && buf[5] == 't' && buf[6] == 'y' && buf[7] == 'p';
if (!advance) if (!advance)
{ {
iIo.seek(-len, BasicIo::cur); iIo.seek(-len, BasicIo::cur);
} }
return isobmffMatched; return result;
} }
} // namespace Exiv2 } // namespace Exiv2

@ -31,17 +31,17 @@
#include "safe_op.hpp" #include "safe_op.hpp"
#include "slice.hpp" #include "slice.hpp"
#ifdef EXV_ENABLE_ISOBMFF
#include "bmffimage.hpp"
#endif// EXV_ENABLE_ISOBMFF
#include "cr2image.hpp" #include "cr2image.hpp"
#include "crwimage.hpp" #include "crwimage.hpp"
#include "epsimage.hpp" #include "epsimage.hpp"
#ifdef EXV_ENABLE_ISOBMFF
#include "isobmff.hpp"
#endif // EXV_ENABLE_ISOBMFF
#include "jpgimage.hpp" #include "jpgimage.hpp"
#include "mrwimage.hpp" #include "mrwimage.hpp"
#ifdef EXV_HAVE_LIBZ #ifdef EXV_HAVE_LIBZ
# include "pngimage.hpp" # include "pngimage.hpp"
#endif // EXV_HAVE_LIBZ #endif// EXV_HAVE_LIBZ
#include "rafimage.hpp" #include "rafimage.hpp"
#include "tiffimage.hpp" #include "tiffimage.hpp"
#include "tiffimage_int.hpp" #include "tiffimage_int.hpp"
@ -56,12 +56,12 @@
#include "jp2image.hpp" #include "jp2image.hpp"
#include "nikonmn_int.hpp" #include "nikonmn_int.hpp"
#ifdef EXV_ENABLE_VIDEO #ifdef EXV_ENABLE_VIDEO
#include "matroskavideo.hpp" #include "matroskavideo.hpp"
#include "quicktimevideo.hpp" #include "quicktimevideo.hpp"
#include "riffvideo.hpp" #include "riffvideo.hpp"
#include "asfvideo.hpp" #include "asfvideo.hpp"
#endif // EXV_ENABLE_VIDEO #endif// EXV_ENABLE_VIDEO
#include "rw2image.hpp" #include "rw2image.hpp"
#include "pgfimage.hpp" #include "pgfimage.hpp"
#include "xmpsidecar.hpp" #include "xmpsidecar.hpp"

Loading…
Cancel
Save