diff --git a/app/actions.cpp b/app/actions.cpp index a53fd35eb1..4613005220 100644 --- a/app/actions.cpp +++ b/app/actions.cpp @@ -902,7 +902,7 @@ namespace Action { if (dontOverwrite(thumbPath)) return 0; if (Params::instance().verbose_) { Exiv2::DataBuf buf = exifThumb.copy(); - if (buf.size() != 0) { + if (!buf.empty()) { std::cout << _("Writing thumbnail") << " (" << exifThumb.mimeType() << ", " << buf.size() << " " << _("Bytes") << ") " << _("to file") << " " << thumbPath << std::endl; @@ -1150,7 +1150,7 @@ namespace Action { image->readMetadata(); // clear existing profile, assign the blob and rewrite image image->clearIccProfile(); - if ( iccProfileBlob.size() ) { + if (!iccProfileBlob.empty()) { image->setIccProfile(std::move(iccProfileBlob)); } image->writeMetadata(); diff --git a/app/exiv2.cpp b/app/exiv2.cpp index 48d1968721..64171e9ef4 100644 --- a/app/exiv2.cpp +++ b/app/exiv2.cpp @@ -1010,7 +1010,7 @@ void Params::getStdin(Exiv2::DataBuf& buf) } // copy stdinBuf to buf - if ( stdinBuf.size() ) { + if (!stdinBuf.empty()) { buf.alloc(stdinBuf.size()); buf.copyBytes(0,stdinBuf.c_data(),buf.size()); } diff --git a/include/exiv2/basicio.hpp b/include/exiv2/basicio.hpp index 198c05cb81..ce6bc33d97 100644 --- a/include/exiv2/basicio.hpp +++ b/include/exiv2/basicio.hpp @@ -36,7 +36,7 @@ namespace Exiv2 { class EXIV2API BasicIo { public: //! BasicIo auto_ptr type - typedef std::unique_ptr UniquePtr; + using UniquePtr = std::unique_ptr; //! Seek starting positions enum Position { beg, cur, end }; diff --git a/include/exiv2/datasets.hpp b/include/exiv2/datasets.hpp index 0d5be0d996..7dd4a37a45 100644 --- a/include/exiv2/datasets.hpp +++ b/include/exiv2/datasets.hpp @@ -245,7 +245,7 @@ namespace Exiv2 { class EXIV2API IptcKey : public Key { public: //! Shortcut for an %IptcKey auto pointer. - typedef std::unique_ptr UniquePtr; + using UniquePtr = std::unique_ptr; //! @name Creators //@{ @@ -322,10 +322,10 @@ namespace Exiv2 { /*! @brief typedef for string:string map */ - typedef std::map Dictionary; + using Dictionary = std::map; -// ***************************************************************************** -// free functions + // ***************************************************************************** + // free functions //! Output operator for dataSet EXIV2API std::ostream& operator<<(std::ostream& os, const DataSet& dataSet); diff --git a/include/exiv2/error.hpp b/include/exiv2/error.hpp index 5776f2ce3f..31a9e7f553 100644 --- a/include/exiv2/error.hpp +++ b/include/exiv2/error.hpp @@ -68,7 +68,7 @@ namespace Exiv2 { specific way. The default handler sends the log message to standard error. */ - typedef void (*Handler)(int, const char*); + using Handler = void (*)(int, const char*); //! @name Creators //@{ @@ -290,10 +290,10 @@ namespace Exiv2 { }; // class BasicError //! Error class used for exceptions (std::string based) - typedef BasicError Error; + using Error = BasicError; -// ***************************************************************************** -// free functions, template and inline definitions + // ***************************************************************************** + // free functions, template and inline definitions //! Return the error message for the error with code \em code. const char* errMsg(int code); diff --git a/include/exiv2/exif.hpp b/include/exiv2/exif.hpp index 18cda66685..71124f838b 100644 --- a/include/exiv2/exif.hpp +++ b/include/exiv2/exif.hpp @@ -354,7 +354,7 @@ namespace Exiv2 { }; // class ExifThumb //! Container type to hold all metadata - typedef std::list ExifMetadata; + using ExifMetadata = std::list; /*! @brief A container for Exif data. This is a top-level class of the %Exiv2 @@ -371,9 +371,9 @@ namespace Exiv2 { class EXIV2API ExifData { public: //! ExifMetadata iterator type - typedef ExifMetadata::iterator iterator; + using iterator = ExifMetadata::iterator; //! ExifMetadata const iterator type - typedef ExifMetadata::const_iterator const_iterator; + using const_iterator = ExifMetadata::const_iterator; //! @name Manipulators //@{ diff --git a/include/exiv2/image.hpp b/include/exiv2/image.hpp index 808b3ac79b..d8e4f795a1 100644 --- a/include/exiv2/image.hpp +++ b/include/exiv2/image.hpp @@ -31,14 +31,12 @@ namespace Exiv2 { }; //! List of native previews. This is meant to be used only by the PreviewManager. - typedef std::vector NativePreviewList; + using NativePreviewList = std::vector; /*! @brief Options for printStructure */ - typedef enum { kpsNone, kpsBasic, kpsXMP, kpsRecursive - , kpsIccProfile , kpsIptcErase - } PrintStructureOption; + enum PrintStructureOption { kpsNone, kpsBasic, kpsXMP, kpsRecursive, kpsIccProfile, kpsIptcErase }; /*! @brief Abstract base class defining the interface for an image. This is @@ -53,7 +51,7 @@ namespace Exiv2 { class EXIV2API Image { public: //! Image auto_ptr type - typedef std::unique_ptr UniquePtr; + using UniquePtr = std::unique_ptr; //! @name Creators //@{ @@ -490,9 +488,9 @@ namespace Exiv2 { }; // class Image //! Type for function pointer that creates new Image instances - typedef Image::UniquePtr (*NewInstanceFct)(BasicIo::UniquePtr io, bool create); + using NewInstanceFct = Image::UniquePtr (*)(BasicIo::UniquePtr io, bool create); //! Type for function pointer that checks image types - typedef bool (*IsThisTypeFct)(BasicIo& iIo, bool advance); + using IsThisTypeFct = bool (*)(BasicIo& iIo, bool advance); /*! @brief Returns an Image instance of the specified type. diff --git a/include/exiv2/ini.hpp b/include/exiv2/ini.hpp index 1c25563337..c45905fc11 100755 --- a/include/exiv2/ini.hpp +++ b/include/exiv2/ini.hpp @@ -25,11 +25,10 @@ extern "C" { #endif //! @brief typedef for prototype of handler function. -typedef int (*ini_handler)(void* user, const char* section, - const char* name, const char* value); +using ini_handler = int (*)(void* user, const char* section, const char* name, const char* value); //! Typedef for prototype of fgets-style reader function. -typedef char* (*ini_reader)(char* str, int num, void* stream); +using ini_reader = char* (*)(char* str, int num, void* stream); /*! @brief Parse given INI-style file. May have [section]s, name=value pairs diff --git a/include/exiv2/iptc.hpp b/include/exiv2/iptc.hpp index a64274a8a5..a2dfd02c6b 100644 --- a/include/exiv2/iptc.hpp +++ b/include/exiv2/iptc.hpp @@ -138,7 +138,7 @@ namespace Exiv2 { }; // class Iptcdatum //! Container type to hold all metadata - typedef std::vector IptcMetadata; + using IptcMetadata = std::vector; /*! @brief A container for IPTC data. This is a top-level class of the %Exiv2 library. @@ -153,9 +153,9 @@ namespace Exiv2 { class EXIV2API IptcData { public: //! IptcMetadata iterator type - typedef IptcMetadata::iterator iterator; + using iterator = IptcMetadata::iterator; //! IptcMetadata const iterator type - typedef IptcMetadata::const_iterator const_iterator; + using const_iterator = IptcMetadata::const_iterator; // Use the compiler generated constructors and assignment operator diff --git a/include/exiv2/metadatum.hpp b/include/exiv2/metadatum.hpp index 5a5cb5145e..811d0d1fa9 100644 --- a/include/exiv2/metadatum.hpp +++ b/include/exiv2/metadatum.hpp @@ -27,7 +27,7 @@ namespace Exiv2 { class EXIV2API Key { public: //! Shortcut for a %Key auto pointer. - typedef std::unique_ptr UniquePtr; + using UniquePtr = std::unique_ptr; //! @name Creators //@{ diff --git a/include/exiv2/preview.hpp b/include/exiv2/preview.hpp index 0439693309..f28c2ab0a7 100644 --- a/include/exiv2/preview.hpp +++ b/include/exiv2/preview.hpp @@ -12,11 +12,11 @@ // namespace extensions namespace Exiv2 { -// ***************************************************************************** -// class definitions + // ***************************************************************************** + // class definitions //! Type of preview image. - typedef int PreviewId; + using PreviewId = int; /*! @brief Preview image properties. @@ -37,13 +37,14 @@ namespace Exiv2 { }; //! Container type to hold all preview images metadata. - typedef std::vector PreviewPropertiesList; + using PreviewPropertiesList = std::vector; /*! @brief Class that holds preview image properties and data buffer. */ class EXIV2API PreviewImage { friend class PreviewManager; + public: //! @name Constructors //@{ @@ -111,10 +112,10 @@ namespace Exiv2 { //! Private constructor PreviewImage(PreviewProperties properties, DataBuf&& data); - PreviewProperties properties_; //!< Preview image properties - DataBuf preview_; //!< Preview image data + PreviewProperties properties_; //!< Preview image properties + DataBuf preview_; //!< Preview image data - }; // class PreviewImage + }; // class PreviewImage /*! @brief Class for extracting preview images from image metadata. @@ -142,9 +143,9 @@ namespace Exiv2 { //@} private: - const Image& image_; + const Image& image_; - }; // class PreviewManager -} // namespace Exiv2 + }; // class PreviewManager +} // namespace Exiv2 -#endif // #ifndef PREVIEW_HPP_ +#endif // #ifndef PREVIEW_HPP_ diff --git a/include/exiv2/properties.hpp b/include/exiv2/properties.hpp index 05d011b7cc..b77e2548cb 100644 --- a/include/exiv2/properties.hpp +++ b/include/exiv2/properties.hpp @@ -198,7 +198,7 @@ namespace Exiv2 { */ static void unregisterNs(); //! Type for the namespace registry - typedef std::map NsRegistry; + using NsRegistry = std::map; /*! @brief Get the registered namespace for a specific \em prefix from the registry. */ @@ -221,7 +221,7 @@ namespace Exiv2 { { public: //! Shortcut for an %XmpKey auto pointer. - typedef std::unique_ptr UniquePtr; + using UniquePtr = std::unique_ptr; //! @name Creators //@{ diff --git a/include/exiv2/slice.hpp b/include/exiv2/slice.hpp index c533d23140..5477e66f6c 100644 --- a/include/exiv2/slice.hpp +++ b/include/exiv2/slice.hpp @@ -12,53 +12,6 @@ namespace Exiv2 { namespace Internal { - // TODO: remove these custom implementations once we have C++11 - template - struct remove_const - { - typedef T type; - }; - - template - struct remove_const - { - typedef T type; - }; - - template - struct remove_volatile - { - typedef T type; - }; - template - struct remove_volatile - { - typedef T type; - }; - template - struct remove_cv - { - typedef typename remove_const::type>::type type; - }; - - template - struct remove_pointer - { - typedef T type; - }; - - template - struct remove_pointer - { - typedef T type; - }; - - template - struct remove_pointer - { - typedef T type; - }; - /*! * Common base class of all slice implementations. * @@ -133,9 +86,9 @@ namespace Exiv2 template