cpp: Replace auto_ptr by unique_ptr

This commit is contained in:
Luis Díaz Más
2021-04-05 16:01:48 +02:00
parent 537cdad99e
commit 0bbaa6eff3
102 changed files with 646 additions and 638 deletions
+2 -2
View File
@@ -62,7 +62,7 @@ namespace Exiv2 {
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
*/
AsfVideo(BasicIo::AutoPtr io);
AsfVideo(BasicIo::UniquePtr io);
//@}
//! @name Manipulators
@@ -169,7 +169,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newAsfInstance(BasicIo::AutoPtr io, bool create);
EXIV2LIB_DEPRECATED_EXPORT Image::UniquePtr newAsfInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a Windows Asf Video.
EXIV2LIB_DEPRECATED_EXPORT bool isAsfType(BasicIo& iIo, bool advance);
+4 -4
View File
@@ -30,7 +30,7 @@
#include "types.hpp"
// + standard includes
#include <memory> // for std::auto_ptr
#include <memory>
// The way to handle data from stdin or data uri path. If EXV_XPATH_MEMIO = 1,
// it uses MemIo. Otherwises, it uses FileIo.
@@ -55,7 +55,7 @@ namespace Exiv2 {
class EXIV2API BasicIo {
public:
//! BasicIo auto_ptr type
typedef std::auto_ptr<BasicIo> AutoPtr;
typedef std::unique_ptr<BasicIo> UniquePtr;
//! Seek starting positions
enum Position { beg, cur, end };
@@ -521,7 +521,7 @@ namespace Exiv2 {
// Pimpl idiom
class Impl;
std::auto_ptr<Impl> p_;
std::unique_ptr<Impl> p_;
}; // class FileIo
@@ -721,7 +721,7 @@ namespace Exiv2 {
// Pimpl idiom
class Impl;
std::auto_ptr<Impl> p_;
std::unique_ptr<Impl> p_;
}; // class MemIo
+2 -2
View File
@@ -76,7 +76,7 @@ namespace Exiv2
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
*/
BmffImage(BasicIo::AutoPtr io, bool create);
BmffImage(BasicIo::UniquePtr io, bool create);
//@}
//@{
@@ -163,7 +163,7 @@ namespace Exiv2
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newBmffInstance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newBmffInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a BMFF image.
EXIV2API bool isBmffType(BasicIo& iIo, bool advance);
+2 -2
View File
@@ -73,7 +73,7 @@ namespace Exiv2 {
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
*/
explicit BmpImage(BasicIo::AutoPtr io);
explicit BmpImage(BasicIo::UniquePtr io);
//@}
//! @name Manipulators
@@ -118,7 +118,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newBmpInstance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newBmpInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a Windows Bitmap image.
EXIV2API bool isBmpType(BasicIo& iIo, bool advance);
+2 -2
View File
@@ -68,7 +68,7 @@ namespace Exiv2 {
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
*/
Cr2Image(BasicIo::AutoPtr io, bool create);
Cr2Image(BasicIo::UniquePtr io, bool create);
//@}
//! @name Manipulators
@@ -152,7 +152,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newCr2Instance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newCr2Instance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a CR2 image.
EXIV2API bool isCr2Type(BasicIo& iIo, bool advance);
+2 -2
View File
@@ -75,7 +75,7 @@ namespace Exiv2 {
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
*/
CrwImage(BasicIo::AutoPtr io, bool create);
CrwImage(BasicIo::UniquePtr io, bool create);
//@}
//! @name Manipulators
@@ -161,7 +161,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newCrwInstance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newCrwInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a CRW image.
EXIV2API bool isCrwType(BasicIo& iIo, bool advance);
+2 -2
View File
@@ -275,7 +275,7 @@ namespace Exiv2 {
class EXIV2API IptcKey : public Key {
public:
//! Shortcut for an %IptcKey auto pointer.
typedef std::auto_ptr<IptcKey> AutoPtr;
typedef std::unique_ptr<IptcKey> UniquePtr;
//! @name Creators
//@{
@@ -320,7 +320,7 @@ namespace Exiv2 {
virtual std::string tagName() const;
virtual std::string tagLabel() const;
virtual uint16_t tag() const;
AutoPtr clone() const;
UniquePtr clone() const;
//! Return the name of the record
std::string recordName() const;
//! Return the record id
+3 -3
View File
@@ -192,7 +192,7 @@ namespace Exiv2 {
long toLong(long n =0) const;
float toFloat(long n =0) const;
Rational toRational(long n =0) const;
Value::AutoPtr getValue() const;
Value::UniquePtr getValue() const;
const Value& value() const;
//! Return the size of the data area.
long sizeDataArea() const;
@@ -213,8 +213,8 @@ namespace Exiv2 {
private:
// DATA
ExifKey::AutoPtr key_; //!< Key
Value::AutoPtr value_; //!< Value
ExifKey::UniquePtr key_; //!< Key
Value::UniquePtr value_; //!< Value
}; // class Exifdatum
+2 -2
View File
@@ -66,7 +66,7 @@ namespace Exiv2 {
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
*/
explicit GifImage(BasicIo::AutoPtr io);
explicit GifImage(BasicIo::UniquePtr io);
//@}
//! @name Manipulators
@@ -111,7 +111,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newGifInstance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newGifInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a GIF image.
EXIV2API bool isGifType(BasicIo& iIo, bool advance);
+14 -14
View File
@@ -78,7 +78,7 @@ namespace Exiv2 {
class EXIV2API Image {
public:
//! Image auto_ptr type
typedef std::auto_ptr<Image> AutoPtr;
typedef std::unique_ptr<Image> UniquePtr;
//! @name Creators
//@{
@@ -89,7 +89,7 @@ namespace Exiv2 {
*/
Image(int imageType,
uint16_t supportedMetadata,
BasicIo::AutoPtr io);
BasicIo::UniquePtr io);
//! Virtual Destructor
virtual ~Image();
//@}
@@ -481,7 +481,7 @@ namespace Exiv2 {
protected:
// DATA
BasicIo::AutoPtr io_; //!< Image data IO pointer
BasicIo::UniquePtr io_; //!< Image data IO pointer
ExifData exifData_; //!< Exif data container
IptcData iptcData_; //!< IPTC data container
XmpData xmpData_; //!< XMP data container
@@ -519,7 +519,7 @@ namespace Exiv2 {
}; // class Image
//! Type for function pointer that creates new Image instances
typedef Image::AutoPtr (*NewInstanceFct)(BasicIo::AutoPtr io, bool create);
typedef Image::UniquePtr (*NewInstanceFct)(BasicIo::UniquePtr io, bool create);
//! Type for function pointer that checks image types
typedef bool (*IsThisTypeFct)(BasicIo& iIo, bool advance);
@@ -545,13 +545,13 @@ namespace Exiv2 {
@throw Error If the file is not found or it is unable to connect to the server to
read the remote file.
*/
static BasicIo::AutoPtr createIo(const std::string& path, bool useCurl = true);
static BasicIo::UniquePtr createIo(const std::string& path, bool useCurl = true);
#ifdef EXV_UNICODE_PATH
/*!
@brief Like createIo() but accepts a unicode path in an std::wstring.
@note This function is only available on Windows.
*/
static BasicIo::AutoPtr createIo(const std::wstring& wpath, bool useCurl = true);
static BasicIo::UniquePtr createIo(const std::wstring& wpath, bool useCurl = true);
#endif
/*!
@brief Create an Image subclass of the appropriate type by reading
@@ -566,13 +566,13 @@ namespace Exiv2 {
@throw Error If opening the file fails or it contains data of an
unknown image type.
*/
static Image::AutoPtr open(const std::string& path, bool useCurl = true);
static Image::UniquePtr open(const std::string& path, bool useCurl = true);
#ifdef EXV_UNICODE_PATH
/*!
@brief Like open() but accepts a unicode path in an std::wstring.
@note This function is only available on Windows.
*/
static Image::AutoPtr open(const std::wstring& wpath, bool useCurl = true);
static Image::UniquePtr open(const std::wstring& wpath, bool useCurl = true);
#endif
/*!
@brief Create an Image subclass of the appropriate type by reading
@@ -585,7 +585,7 @@ namespace Exiv2 {
matches that of the data buffer.
@throw Error If the memory contains data of an unknown image type.
*/
static Image::AutoPtr open(const byte* data, long size);
static Image::UniquePtr open(const byte* data, long size);
/*!
@brief Create an Image subclass of the appropriate type by reading
the provided BasicIo instance. %Image type is derived from the
@@ -603,7 +603,7 @@ namespace Exiv2 {
determined, the pointer is 0.
@throw Error If opening the BasicIo fails
*/
static Image::AutoPtr open(BasicIo::AutoPtr io);
static Image::UniquePtr open(BasicIo::UniquePtr io);
/*!
@brief Create an Image subclass of the requested type by creating a
new image file. If the file already exists, it will be overwritten.
@@ -613,13 +613,13 @@ namespace Exiv2 {
type.
@throw Error If the image type is not supported.
*/
static Image::AutoPtr create(int type, const std::string& path);
static Image::UniquePtr create(int type, const std::string& path);
#ifdef EXV_UNICODE_PATH
/*!
@brief Like create() but accepts a unicode path in an std::wstring.
@note This function is only available on Windows.
*/
static Image::AutoPtr create(int type, const std::wstring& wpath);
static Image::UniquePtr create(int type, const std::wstring& wpath);
#endif
/*!
@brief Create an Image subclass of the requested type by creating a
@@ -629,7 +629,7 @@ namespace Exiv2 {
type.
@throw Error If the image type is not supported
*/
static Image::AutoPtr create(int type);
static Image::UniquePtr create(int type);
/*!
@brief Create an Image subclass of the requested type by writing a
new image to a BasicIo instance. If the BasicIo instance already
@@ -644,7 +644,7 @@ namespace Exiv2 {
@return An auto-pointer that owns an Image instance of the requested
type. If the image type is not supported, the pointer is 0.
*/
static Image::AutoPtr create(int type, BasicIo::AutoPtr io);
static Image::UniquePtr create(int type, BasicIo::UniquePtr io);
/*!
@brief Returns the image type of the provided file.
@param path %Image file. The contents of the file are tested to
+3 -3
View File
@@ -142,14 +142,14 @@ namespace Exiv2 {
long toLong(long n =0) const;
float toFloat(long n =0) const;
Rational toRational(long n =0) const;
Value::AutoPtr getValue() const;
Value::UniquePtr getValue() const;
const Value& value() const;
//@}
private:
// DATA
IptcKey::AutoPtr key_; //!< Key
Value::AutoPtr value_; //!< Value
IptcKey::UniquePtr key_; //!< Key
Value::UniquePtr value_; //!< Value
}; // class Iptcdatum
+2 -2
View File
@@ -66,7 +66,7 @@ namespace Exiv2
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
*/
Jp2Image(BasicIo::AutoPtr io, bool create);
Jp2Image(BasicIo::UniquePtr io, bool create);
//@}
//! @name Manipulators
@@ -130,7 +130,7 @@ namespace Exiv2
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newJp2Instance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newJp2Instance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a JPEG-2000 image.
EXIV2API bool isJp2Type(BasicIo& iIo, bool advance);
+5 -5
View File
@@ -167,7 +167,7 @@ namespace Exiv2 {
@param dataSize Size of initData in bytes.
*/
JpegBase(int type,
BasicIo::AutoPtr io,
BasicIo::UniquePtr io,
bool create,
const byte initData[],
long dataSize);
@@ -306,7 +306,7 @@ namespace Exiv2 {
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
*/
JpegImage(BasicIo::AutoPtr io, bool create);
JpegImage(BasicIo::UniquePtr io, bool create);
//@}
//! @name Accessors
//@{
@@ -367,7 +367,7 @@ namespace Exiv2 {
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
*/
ExvImage(BasicIo::AutoPtr io, bool create);
ExvImage(BasicIo::UniquePtr io, bool create);
//@}
//! @name Accessors
//@{
@@ -409,7 +409,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newJpegInstance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newJpegInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a JPEG image.
EXIV2API bool isJpegType(BasicIo& iIo, bool advance);
/*!
@@ -417,7 +417,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newExvInstance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newExvInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is an EXV file
EXIV2API bool isExvType(BasicIo& iIo, bool advance);
+2 -2
View File
@@ -68,7 +68,7 @@ namespace Exiv2 {
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
*/
MatroskaVideo(BasicIo::AutoPtr io);
MatroskaVideo(BasicIo::UniquePtr io);
//@}
//! @name Manipulators
@@ -138,7 +138,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newMkvInstance(BasicIo::AutoPtr io, bool create);
EXIV2LIB_DEPRECATED_EXPORT Image::UniquePtr newMkvInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a Matroska Video.
EXIV2LIB_DEPRECATED_EXPORT bool isMkvType(BasicIo& iIo, bool advance);
+3 -3
View File
@@ -44,7 +44,7 @@ namespace Exiv2 {
class EXIV2API Key {
public:
//! Shortcut for a %Key auto pointer.
typedef std::auto_ptr<Key> AutoPtr;
typedef std::unique_ptr<Key> UniquePtr;
//! @name Creators
//@{
@@ -76,7 +76,7 @@ namespace Exiv2 {
The caller owns this copy and the auto-pointer ensures that it
will be deleted.
*/
AutoPtr clone() const;
UniquePtr clone() const;
/*!
@brief Write the key to an output stream. You do not usually have
to use this function; it is used for the implementation of
@@ -251,7 +251,7 @@ namespace Exiv2 {
@return An auto-pointer containing a pointer to a copy (clone) of the
value, 0 if the value is not set.
*/
virtual Value::AutoPtr getValue() const =0;
virtual Value::UniquePtr getValue() const =0;
/*!
@brief Return a constant reference to the value.
+2 -2
View File
@@ -61,7 +61,7 @@ namespace Exiv2 {
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
*/
MrwImage(BasicIo::AutoPtr io, bool create);
MrwImage(BasicIo::UniquePtr io, bool create);
//@}
//! @name Manipulators
@@ -117,7 +117,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newMrwInstance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newMrwInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a MRW image.
EXIV2API bool isMrwType(BasicIo& iIo, bool advance);
+2 -2
View File
@@ -61,7 +61,7 @@ namespace Exiv2 {
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
*/
OrfImage(BasicIo::AutoPtr io, bool create);
OrfImage(BasicIo::UniquePtr io, bool create);
//@}
//! @name Manipulators
@@ -138,7 +138,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newOrfInstance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newOrfInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is an ORF image.
EXIV2API bool isOrfType(BasicIo& iIo, bool advance);
+2 -2
View File
@@ -63,7 +63,7 @@ namespace Exiv2
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
*/
PgfImage(BasicIo::AutoPtr io, bool create);
PgfImage(BasicIo::UniquePtr io, bool create);
//@}
//! @name Manipulators
@@ -113,7 +113,7 @@ namespace Exiv2
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newPgfInstance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newPgfInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a PGF image.
EXIV2API bool isPgfType(BasicIo& iIo, bool advance);
+2 -2
View File
@@ -63,7 +63,7 @@ namespace Exiv2
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
*/
PngImage(BasicIo::AutoPtr io, bool create);
PngImage(BasicIo::UniquePtr io, bool create);
//@}
//! @name Manipulators
@@ -116,7 +116,7 @@ namespace Exiv2
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newPngInstance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newPngInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a PNG image.
EXIV2API bool isPngType(BasicIo& iIo, bool advance);
+3 -3
View File
@@ -231,7 +231,7 @@ namespace Exiv2 {
{
public:
//! Shortcut for an %XmpKey auto pointer.
typedef std::auto_ptr<XmpKey> AutoPtr;
typedef std::unique_ptr<XmpKey> UniquePtr;
//! @name Creators
//@{
@@ -280,7 +280,7 @@ namespace Exiv2 {
//! Properties don't have a tag number. Return 0.
virtual uint16_t tag() const;
AutoPtr clone() const;
UniquePtr clone() const;
// Todo: Should this be removed? What about tagLabel then?
//! Return the schema namespace for the prefix of the key
@@ -294,7 +294,7 @@ namespace Exiv2 {
private:
// Pimpl idiom
struct Impl;
std::auto_ptr<Impl> p_;
std::unique_ptr<Impl> p_;
}; // class XmpKey
+2 -2
View File
@@ -65,7 +65,7 @@ namespace Exiv2 {
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
*/
explicit PsdImage(BasicIo::AutoPtr io);
explicit PsdImage(BasicIo::UniquePtr io);
//@}
//! @name Manipulators
@@ -127,7 +127,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newPsdInstance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newPsdInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a Photoshop image.
EXIV2API bool isPsdType(BasicIo& iIo, bool advance);
+2 -2
View File
@@ -58,7 +58,7 @@ namespace Exiv2 {
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
*/
QuickTimeVideo(BasicIo::AutoPtr io);
QuickTimeVideo(BasicIo::UniquePtr io);
//@}
//! @name Manipulators
@@ -235,7 +235,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newQTimeInstance(BasicIo::AutoPtr io, bool create);
EXIV2LIB_DEPRECATED_EXPORT Image::UniquePtr newQTimeInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a Quick Time Video.
EXIV2LIB_DEPRECATED_EXPORT bool isQTimeType(BasicIo& iIo, bool advance);
+2 -2
View File
@@ -66,7 +66,7 @@ namespace Exiv2 {
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
*/
RafImage(BasicIo::AutoPtr io, bool create);
RafImage(BasicIo::UniquePtr io, bool create);
//@}
//! @name Manipulators
@@ -123,7 +123,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newRafInstance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newRafInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a RAF image.
EXIV2API bool isRafType(BasicIo& iIo, bool advance);
+2 -2
View File
@@ -58,7 +58,7 @@ namespace Exiv2 {
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
*/
RiffVideo(BasicIo::AutoPtr io);
RiffVideo(BasicIo::UniquePtr io);
//@}
//! @name Manipulators
@@ -203,7 +203,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newRiffInstance(BasicIo::AutoPtr io, bool create);
EXIV2LIB_DEPRECATED_EXPORT Image::UniquePtr newRiffInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a Riff Video.
EXIV2LIB_DEPRECATED_EXPORT bool isRiffType(BasicIo& iIo, bool advance);
+2 -2
View File
@@ -59,7 +59,7 @@ namespace Exiv2 {
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
*/
explicit Rw2Image(BasicIo::AutoPtr io);
explicit Rw2Image(BasicIo::UniquePtr io);
//@}
//! @name Manipulators
@@ -138,7 +138,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newRw2Instance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newRw2Instance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a RW2 image.
EXIV2API bool isRw2Type(BasicIo& iIo, bool advance);
+3 -3
View File
@@ -140,7 +140,7 @@ namespace Exiv2 {
class EXIV2API ExifKey : public Key {
public:
//! Shortcut for an %ExifKey auto pointer.
typedef std::auto_ptr<ExifKey> AutoPtr;
typedef std::unique_ptr<ExifKey> UniquePtr;
//! @name Creators
//@{
@@ -202,7 +202,7 @@ namespace Exiv2 {
//! Return the default type id for this tag.
TypeId defaultTypeId() const; // Todo: should be in the base class
AutoPtr clone() const;
UniquePtr clone() const;
//! Return the index (unique id of this key within the original Exif data, 0 if not set)
int idx() const;
//@}
@@ -214,7 +214,7 @@ namespace Exiv2 {
private:
// Pimpl idiom
struct Impl;
std::auto_ptr<Impl> p_;
std::unique_ptr<Impl> p_;
}; // class ExifKey
+2 -2
View File
@@ -66,7 +66,7 @@ namespace Exiv2 {
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
*/
explicit TgaImage(BasicIo::AutoPtr io);
explicit TgaImage(BasicIo::UniquePtr io);
//@}
//! @name Manipulators
@@ -111,7 +111,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newTgaInstance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newTgaInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a Targa v2 image.
EXIV2API bool isTgaType(BasicIo& iIo, bool advance);
+2 -2
View File
@@ -68,7 +68,7 @@ namespace Exiv2 {
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
*/
TiffImage(BasicIo::AutoPtr io, bool create);
TiffImage(BasicIo::UniquePtr io, bool create);
//@}
//! @name Manipulators
@@ -204,7 +204,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newTiffInstance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newTiffInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a TIFF image.
EXIV2API bool isTiffType(BasicIo& iIo, bool advance);
+4 -4
View File
@@ -174,7 +174,7 @@ namespace Exiv2 {
/*!
@brief Auxiliary type to enable copies and assignments, similar to
std::auto_ptr_ref. See http://www.josuttis.com/libbook/auto_ptr.html
std::unique_ptr_ref. See http://www.josuttis.com/libbook/auto_ptr.html
for a discussion.
*/
struct EXIV2API DataBufRef {
@@ -202,7 +202,7 @@ namespace Exiv2 {
DataBuf(const byte* pData, long size);
/*!
@brief Copy constructor. Transfers the buffer to the newly created
object similar to std::auto_ptr, i.e., the original object is
object similar to std::unique_ptr, i.e., the original object is
modified.
*/
DataBuf(DataBuf& rhs);
@@ -214,7 +214,7 @@ namespace Exiv2 {
//@{
/*!
@brief Assignment operator. Transfers the buffer and releases the
buffer at the original object similar to std::auto_ptr, i.e.,
buffer at the original object similar to std::unique_ptr, i.e.,
the original object is modified.
*/
DataBuf& operator=(DataBuf& rhs);
@@ -244,7 +244,7 @@ namespace Exiv2 {
@name Conversions
Special conversions with auxiliary type to enable copies
and assignments, similar to those used for std::auto_ptr.
and assignments, similar to those used for std::unique_ptr.
See http://www.josuttis.com/libbook/auto_ptr.html for a discussion.
*/
//@{
+30 -27
View File
@@ -51,7 +51,7 @@ namespace Exiv2 {
class EXIV2API Value {
public:
//! Shortcut for a %Value auto pointer.
typedef std::auto_ptr<Value> AutoPtr;
typedef std::unique_ptr<Value> UniquePtr;
//! @name Creators
//@{
@@ -107,7 +107,7 @@ namespace Exiv2 {
The caller owns this copy and the auto-pointer ensures that
it will be deleted.
*/
AutoPtr clone() const { return AutoPtr(clone_()); }
UniquePtr clone() const { return UniquePtr(clone_()); }
/*!
@brief Write value to a data buffer.
@@ -224,7 +224,7 @@ namespace Exiv2 {
@return Auto-pointer to the newly created Value. The caller owns this
copy and the auto-pointer ensures that it will be deleted.
*/
static AutoPtr create(TypeId typeId);
static UniquePtr create(TypeId typeId);
protected:
/*!
@@ -253,7 +253,7 @@ namespace Exiv2 {
class EXIV2API DataValue : public Value {
public:
//! Shortcut for a %DataValue auto pointer.
typedef std::auto_ptr<DataValue> AutoPtr;
typedef std::unique_ptr<DataValue> UniquePtr;
explicit DataValue(TypeId typeId =undefined);
@@ -286,7 +286,7 @@ namespace Exiv2 {
//! @name Accessors
//@{
AutoPtr clone() const { return AutoPtr(clone_()); }
UniquePtr clone() const { return UniquePtr(clone_()); }
/*!
@brief Write value to a character data buffer.
@@ -335,7 +335,7 @@ namespace Exiv2 {
class EXIV2API StringValueBase : public Value {
public:
//! Shortcut for a %StringValueBase auto pointer.
typedef std::auto_ptr<StringValueBase> AutoPtr;
typedef std::unique_ptr<StringValueBase> UniquePtr;
//! @name Creators
//@{
@@ -372,7 +372,7 @@ namespace Exiv2 {
//! @name Accessors
//@{
AutoPtr clone() const { return AutoPtr(clone_()); }
UniquePtr clone() const { return UniquePtr(clone_()); }
/*!
@brief Write value to a character data buffer.
@@ -417,7 +417,7 @@ namespace Exiv2 {
class EXIV2API StringValue : public StringValueBase {
public:
//! Shortcut for a %StringValue auto pointer.
typedef std::auto_ptr<StringValue> AutoPtr;
typedef std::unique_ptr<StringValue> UniquePtr;
//! @name Creators
//@{
@@ -431,7 +431,7 @@ namespace Exiv2 {
//! @name Accessors
//@{
AutoPtr clone() const { return AutoPtr(clone_()); }
UniquePtr clone() const { return UniquePtr(clone_()); }
//@}
private:
@@ -449,7 +449,7 @@ namespace Exiv2 {
class EXIV2API AsciiValue : public StringValueBase {
public:
//! Shortcut for a %AsciiValue auto pointer.
typedef std::auto_ptr<AsciiValue> AutoPtr;
typedef std::unique_ptr<AsciiValue> UniquePtr;
//! @name Creators
//@{
@@ -474,7 +474,7 @@ namespace Exiv2 {
//! @name Accessors
//@{
AutoPtr clone() const { return AutoPtr(clone_()); }
UniquePtr clone() const { return UniquePtr(clone_()); }
/*!
@brief Write the ASCII value up to the the first '\\0' character to an
output stream. Any further characters are ignored and not
@@ -537,7 +537,7 @@ namespace Exiv2 {
}; // class CharsetInfo
//! Shortcut for a %CommentValue auto pointer.
typedef std::auto_ptr<CommentValue> AutoPtr;
typedef std::unique_ptr<CommentValue> UniquePtr;
//! @name Creators
//@{
@@ -572,7 +572,7 @@ namespace Exiv2 {
//! @name Accessors
//@{
AutoPtr clone() const { return AutoPtr(clone_()); }
UniquePtr clone() const { return UniquePtr(clone_()); }
long copy(byte* buf, ByteOrder byteOrder) const;
/*!
@brief Write the comment in a format which can be read by
@@ -624,7 +624,7 @@ namespace Exiv2 {
class EXIV2API XmpValue : public Value {
public:
//! Shortcut for a %XmpValue auto pointer.
typedef std::auto_ptr<XmpValue> AutoPtr;
typedef std::unique_ptr<XmpValue> UniquePtr;
//! XMP array types.
enum XmpArrayType { xaNone, xaAlt, xaBag, xaSeq };
@@ -715,7 +715,7 @@ namespace Exiv2 {
class EXIV2API XmpTextValue : public XmpValue {
public:
//! Shortcut for a %XmpTextValue auto pointer.
typedef std::auto_ptr<XmpTextValue> AutoPtr;
typedef std::unique_ptr<XmpTextValue> UniquePtr;
//! @name Creators
//@{
@@ -748,7 +748,7 @@ namespace Exiv2 {
//! @name Accessors
//@{
AutoPtr clone() const;
UniquePtr clone() const;
long size() const;
virtual long count() const;
/*!
@@ -797,7 +797,7 @@ namespace Exiv2 {
class EXIV2API XmpArrayValue : public XmpValue {
public:
//! Shortcut for a %XmpArrayValue auto pointer.
typedef std::auto_ptr<XmpArrayValue> AutoPtr;
typedef std::unique_ptr<XmpArrayValue> UniquePtr;
//! @name Creators
//@{
@@ -823,7 +823,7 @@ namespace Exiv2 {
//! @name Accessors
//@{
AutoPtr clone() const;
UniquePtr clone() const;
virtual long count() const;
/*!
@brief Return the <EM>n</EM>-th component of the value as a string.
@@ -890,7 +890,7 @@ namespace Exiv2 {
class EXIV2API LangAltValue : public XmpValue {
public:
//! Shortcut for a %LangAltValue auto pointer.
typedef std::auto_ptr<LangAltValue> AutoPtr;
typedef std::unique_ptr<LangAltValue> UniquePtr;
//! @name Creators
//@{
@@ -925,7 +925,7 @@ namespace Exiv2 {
//! @name Accessors
//@{
AutoPtr clone() const;
UniquePtr clone() const;
virtual long count() const;
/*!
@brief Return the text value associated with the default language
@@ -978,7 +978,7 @@ namespace Exiv2 {
class EXIV2API DateValue : public Value {
public:
//! Shortcut for a %DateValue auto pointer.
typedef std::auto_ptr<DateValue> AutoPtr;
typedef std::unique_ptr<DateValue> UniquePtr;
//! @name Creators
//@{
@@ -1031,7 +1031,7 @@ namespace Exiv2 {
//! @name Accessors
//@{
AutoPtr clone() const { return AutoPtr(clone_()); }
UniquePtr clone() const { return UniquePtr(clone_()); }
/*!
@brief Write value to a character data buffer.
@@ -1079,7 +1079,7 @@ namespace Exiv2 {
class EXIV2API TimeValue : public Value {
public:
//! Shortcut for a %TimeValue auto pointer.
typedef std::auto_ptr<TimeValue> AutoPtr;
typedef std::unique_ptr<TimeValue> UniquePtr;
//! @name Creators
//@{
@@ -1138,7 +1138,7 @@ namespace Exiv2 {
//! @name Accessors
//@{
AutoPtr clone() const { return AutoPtr(clone_()); }
UniquePtr clone() const { return UniquePtr(clone_()); }
/*!
@brief Write value to a character data buffer.
@@ -1235,7 +1235,7 @@ namespace Exiv2 {
class ValueType : public Value {
public:
//! Shortcut for a %ValueType\<T\> auto pointer.
typedef std::auto_ptr<ValueType<T> > AutoPtr;
typedef std::unique_ptr<ValueType<T> > UniquePtr;
//! @name Creators
//@{
@@ -1275,7 +1275,7 @@ namespace Exiv2 {
//! @name Accessors
//@{
AutoPtr clone() const { return AutoPtr(clone_()); }
UniquePtr clone() const { return UniquePtr(clone_()); }
virtual long copy(byte* buf, ByteOrder byteOrder) const;
virtual long count() const;
virtual long size() const;
@@ -1521,7 +1521,10 @@ namespace Exiv2 {
template<typename T>
ValueType<T>::ValueType(const ValueType<T>& rhs)
: Value(rhs), value_(rhs.value_), pDataArea_(0), sizeDataArea_(0)
: Value(rhs)
, value_(rhs.value_)
, pDataArea_(nullptr)
, sizeDataArea_(0)
{
if (rhs.sizeDataArea_ > 0) {
pDataArea_ = new byte[rhs.sizeDataArea_];
+2 -2
View File
@@ -57,7 +57,7 @@ namespace Exiv2 {
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
*/
WebPImage(BasicIo::AutoPtr io);
WebPImage(BasicIo::UniquePtr io);
//@}
//! @name Manipulators
@@ -126,7 +126,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newWebPInstance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newWebPInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is a WebP Video.
EXIV2API bool isWebPType(BasicIo& iIo, bool advance);
+2 -2
View File
@@ -139,14 +139,14 @@ namespace Exiv2 {
long toLong(long n =0) const;
float toFloat(long n =0) const;
Rational toRational(long n =0) const;
Value::AutoPtr getValue() const;
Value::UniquePtr getValue() const;
const Value& value() const;
//@}
private:
// Pimpl idiom
struct Impl;
std::auto_ptr<Impl> p_;
std::unique_ptr<Impl> p_;
}; // class Xmpdatum
+2 -2
View File
@@ -58,7 +58,7 @@ namespace Exiv2 {
@param create Specifies if an existing image should be read (false)
or if a new image should be created (true).
*/
XmpSidecar(BasicIo::AutoPtr io, bool create);
XmpSidecar(BasicIo::UniquePtr io, bool create);
//@}
//! @name Manipulators
@@ -100,7 +100,7 @@ namespace Exiv2 {
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::AutoPtr newXmpInstance(BasicIo::AutoPtr io, bool create);
EXIV2API Image::UniquePtr newXmpInstance(BasicIo::UniquePtr io, bool create);
//! Check if the file iIo is an XMP sidecar file.
EXIV2API bool isXmpType(BasicIo& iIo, bool advance);