[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a
Maximiliano Curia
maxy at moszumanska.debian.org
Thu Jul 13 17:36:40 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=e20bffa
The following commit has been merged in the master branch:
commit e20bffaec7739a327ca2c64bcf4ed8c8fc4c25bb
Author: Andreas Huggel <ahuggel at gmx.net>
Date: Sat Oct 16 04:43:21 2004 +0000
Converted Key hierarchy to use std::auto_ptr where appropriate
---
src/datasets.cpp | 11 ++++++++---
src/datasets.hpp | 11 +++++++++--
src/exif.cpp | 21 ++++++++++-----------
src/exif.hpp | 20 ++++++++++----------
src/iptc.cpp | 16 +++++++---------
src/iptc.hpp | 14 +++++++-------
src/metadatum.cpp | 10 +++++++---
src/metadatum.hpp | 19 ++++++++++++++-----
src/tags.cpp | 11 ++++++++---
src/tags.hpp | 10 ++++++++--
10 files changed, 88 insertions(+), 55 deletions(-)
diff --git a/src/datasets.cpp b/src/datasets.cpp
index 62f32a1..53c23e3 100644
--- a/src/datasets.cpp
+++ b/src/datasets.cpp
@@ -20,13 +20,13 @@
*/
/*
File: datasets.cpp
- Version: $Name: $ $Revision: 1.7 $
+ Version: $Name: $ $Revision: 1.8 $
Author(s): Brad Schick (brad) <schick at robotbattle.com>
History: 24-Jul-04, brad: created
*/
// *****************************************************************************
#include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name: $ $Revision: 1.7 $ $RCSfile: datasets.cpp,v $");
+EXIV2_RCSID("@(#) $Name: $ $Revision: 1.8 $ $RCSfile: datasets.cpp,v $");
// *****************************************************************************
// included header files
@@ -318,7 +318,12 @@ namespace Exiv2 {
return *this;
}
- IptcKey* IptcKey::clone() const
+ IptcKey::AutoPtr IptcKey::clone() const
+ {
+ return AutoPtr(clone_());
+ }
+
+ IptcKey* IptcKey::clone_() const
{
return new IptcKey(*this);
}
diff --git a/src/datasets.hpp b/src/datasets.hpp
index 83b854e..d20eb88 100644
--- a/src/datasets.hpp
+++ b/src/datasets.hpp
@@ -21,7 +21,7 @@
/*!
@file datasets.hpp
@brief Iptc dataSet and type information
- @version $Name: $ $Revision: 1.6 $
+ @version $Name: $ $Revision: 1.7 $
@author Brad Schick (brad) <schick at robotbattle.com>
@date 24-Jul-04, brad: created
*/
@@ -37,6 +37,7 @@
#include <string>
#include <utility> // for std::pair
#include <iosfwd>
+#include <memory>
// *****************************************************************************
// namespace extensions
@@ -262,6 +263,9 @@ namespace Exiv2 {
*/
class IptcKey : public Key {
public:
+ //! Shortcut for an %IptcKey auto pointer.
+ typedef std::auto_ptr<IptcKey> AutoPtr;
+
//! @name Creators
//@{
/*!
@@ -303,8 +307,8 @@ namespace Exiv2 {
virtual std::string tagName() const
{ return IptcDataSets::dataSetName(tag_, record_); }
virtual uint16_t tag() const { return tag_; }
- virtual IptcKey* clone() const;
+ AutoPtr clone() const;
//! Return the name of the record
std::string recordName() const
{ return IptcDataSets::recordName(record_); }
@@ -331,6 +335,9 @@ namespace Exiv2 {
//@}
private:
+ //! Internal virtual copy constructor.
+ virtual IptcKey* clone_() const;
+
// DATA
static const char* familyName_;
diff --git a/src/exif.cpp b/src/exif.cpp
index 0dffffc..22dedd0 100644
--- a/src/exif.cpp
+++ b/src/exif.cpp
@@ -20,14 +20,14 @@
*/
/*
File: exif.cpp
- Version: $Name: $ $Revision: 1.65 $
+ Version: $Name: $ $Revision: 1.66 $
Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
History: 26-Jan-04, ahu: created
11-Feb-04, ahu: isolated as a component
*/
// *****************************************************************************
#include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name: $ $Revision: 1.65 $ $RCSfile: exif.cpp,v $");
+EXIV2_RCSID("@(#) $Name: $ $Revision: 1.66 $ $RCSfile: exif.cpp,v $");
// Define DEBUG_MAKERNOTE to output debug information to std::cerr
#undef DEBUG_MAKERNOTE
@@ -74,28 +74,27 @@ namespace {
namespace Exiv2 {
Exifdatum::Exifdatum(const Entry& e, ByteOrder byteOrder)
- : pKey_(new ExifKey(e)), pValue_(0)
+ : key_(ExifKey::AutoPtr(new ExifKey(e))), pValue_(0)
{
pValue_ = Value::create(TypeId(e.type()));
pValue_->read(e.data(), e.count() * e.typeSize(), byteOrder);
}
Exifdatum::Exifdatum(const ExifKey& key, const Value* pValue)
- : pKey_(key.clone()), pValue_(0)
+ : key_(key.clone()), pValue_(0)
{
if (pValue) pValue_ = pValue->clone();
}
Exifdatum::~Exifdatum()
{
- delete pKey_;
delete pValue_;
}
Exifdatum::Exifdatum(const Exifdatum& rhs)
- : Metadatum(rhs), pKey_(0), pValue_(0)
+ : Metadatum(rhs), pValue_(0)
{
- if (rhs.pKey_ != 0) pKey_ = rhs.pKey_->clone(); // deep copy
+ if (rhs.key_.get() != 0) key_ = rhs.key_->clone(); // deep copy
if (rhs.pValue_ != 0) pValue_ = rhs.pValue_->clone(); // deep copy
}
@@ -104,9 +103,8 @@ namespace Exiv2 {
if (this == &rhs) return *this;
Metadatum::operator=(rhs);
- delete pKey_;
- pKey_ = 0;
- if (rhs.pKey_ != 0) pKey_ = rhs.pKey_->clone(); // deep copy
+ key_.reset();
+ if (rhs.key_.get() != 0) key_ = rhs.key_->clone(); // deep copy
delete pValue_;
pValue_ = 0;
@@ -1258,7 +1256,8 @@ namespace Exiv2 {
std::ostream& operator<<(std::ostream& os, const Exifdatum& md)
{
- return md.pKey_->printTag(os, md.value());
+ assert(md.key_.get() != 0);
+ return md.key_->printTag(os, md.value());
}
} // namespace Exiv2
diff --git a/src/exif.hpp b/src/exif.hpp
index 83daf48..3e768c6 100644
--- a/src/exif.hpp
+++ b/src/exif.hpp
@@ -21,7 +21,7 @@
/*!
@file exif.hpp
@brief Encoding and decoding of Exif data
- @version $Name: $ $Revision: 1.56 $
+ @version $Name: $ $Revision: 1.57 $
@author Andreas Huggel (ahu)
<a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
@date 09-Jan-04, ahu: created
@@ -114,28 +114,28 @@ namespace Exiv2 {
//@{
//! Return the key of the %Exifdatum.
std::string key() const
- { return pKey_ == 0 ? "" : pKey_->key(); }
+ { return key_.get() == 0 ? "" : key_->key(); }
//! Return the name of the group (the second part of the key)
std::string groupName() const
- { return pKey_ == 0 ? "" : pKey_->groupName(); }
+ { return key_.get() == 0 ? "" : key_->groupName(); }
//! Return the name of the tag (which is also the third part of the key)
std::string tagName() const
- { return pKey_ == 0 ? "" : pKey_->tagName(); }
+ { return key_.get() == 0 ? "" : key_->tagName(); }
//! Return the tag
uint16_t tag() const
- { return pKey_ == 0 ? 0xffff : pKey_->tag(); }
+ { return key_.get() == 0 ? 0xffff : key_->tag(); }
//! Return the IFD id
IfdId ifdId() const
- { return pKey_ == 0 ? ifdIdNotSet : pKey_->ifdId(); }
+ { return key_.get() == 0 ? ifdIdNotSet : key_->ifdId(); }
//! Return the name of the IFD
const char* ifdName() const
- { return pKey_ == 0 ? "" : pKey_->ifdName(); }
+ { return key_.get() == 0 ? "" : key_->ifdName(); }
//! Return the related image item (deprecated)
std::string ifdItem() const
- { return pKey_ == 0 ? "" : pKey_->ifdItem(); }
+ { return key_.get() == 0 ? "" : key_->ifdItem(); }
//! Return the index (unique id of this key within the original IFD)
int idx() const
- { return pKey_ == 0 ? 0 : pKey_->idx(); }
+ { return key_.get() == 0 ? 0 : key_->idx(); }
/*!
@brief Write value to a data buffer and return the number
of bytes written.
@@ -230,7 +230,7 @@ namespace Exiv2 {
private:
// DATA
- ExifKey* pKey_; //!< Key
+ ExifKey::AutoPtr key_; //!< Key
Value* pValue_; //!< Pointer to the value
}; // class Exifdatum
diff --git a/src/iptc.cpp b/src/iptc.cpp
index e17801d..c291353 100644
--- a/src/iptc.cpp
+++ b/src/iptc.cpp
@@ -20,13 +20,13 @@
*/
/*
File: iptc.cpp
- Version: $Name: $ $Revision: 1.7 $
+ Version: $Name: $ $Revision: 1.8 $
Author(s): Brad Schick (brad) <schick at robotbattle.com>
History: 31-July-04, brad: created
*/
// *****************************************************************************
#include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name: $ $Revision: 1.7 $ $RCSfile: iptc.cpp,v $");
+EXIV2_RCSID("@(#) $Name: $ $Revision: 1.8 $ $RCSfile: iptc.cpp,v $");
// Define DEBUG_MAKERNOTE to output debug information to std::cerr
#undef DEBUG_MAKERNOTE
@@ -50,21 +50,20 @@ namespace Exiv2 {
Iptcdatum::Iptcdatum(const IptcKey& key,
const Value* value)
- : pKey_(key.clone()), pValue_(0), modified_(false)
+ : key_(key.clone()), pValue_(0), modified_(false)
{
if (value) pValue_ = value->clone();
}
Iptcdatum::Iptcdatum(const Iptcdatum& rhs)
- : Metadatum(rhs), pKey_(0), pValue_(0), modified_(false)
+ : Metadatum(rhs), pValue_(0), modified_(false)
{
- if (rhs.pKey_ != 0) pKey_ = rhs.pKey_->clone(); // deep copy
+ if (rhs.key_.get() != 0) key_ = rhs.key_->clone(); // deep copy
if (rhs.pValue_ != 0) pValue_ = rhs.pValue_->clone(); // deep copy
}
Iptcdatum::~Iptcdatum()
{
- delete pKey_;
delete pValue_;
}
@@ -74,9 +73,8 @@ namespace Exiv2 {
Metadatum::operator=(rhs);
modified_ = true;
- delete pKey_;
- pKey_ = 0;
- if (rhs.pKey_ != 0) pKey_ = rhs.pKey_->clone(); // deep copy
+ key_.reset();
+ if (rhs.key_.get() != 0) key_ = rhs.key_->clone(); // deep copy
delete pValue_;
pValue_ = 0;
diff --git a/src/iptc.hpp b/src/iptc.hpp
index 5249e7c..d5480bf 100644
--- a/src/iptc.hpp
+++ b/src/iptc.hpp
@@ -21,7 +21,7 @@
/*!
@file iptc.hpp
@brief Encoding and decoding of Iptc data
- @version $Name: $ $Revision: 1.7 $
+ @version $Name: $ $Revision: 1.8 $
@author Brad Schick (brad)
<a href="mailto:schick at robotbattle.com">schick at robotbattle.com</a>
@date 31-Jul-04, brad: created
@@ -113,30 +113,30 @@ namespace Exiv2 {
is not necessarily unique, i.e., an IptcData may contain
multiple metadata with the same key.
*/
- std::string key() const { return pKey_ == 0 ? "" : pKey_->key(); }
+ std::string key() const { return key_.get() == 0 ? "" : key_->key(); }
/*!
@brief Return the name of the record
@return record name
@throw Error("Unknown record");
*/
std::string recordName() const
- { return pKey_ == 0 ? "" : pKey_->recordName(); }
+ { return key_.get() == 0 ? "" : key_->recordName(); }
/*!
@brief Return the record id
@return record id
*/
uint16_t record() const
- { return pKey_ == 0 ? 0 : pKey_->record(); }
+ { return key_.get() == 0 ? 0 : key_->record(); }
/*!
@brief Return the name of the tag (aka dataset)
@return tag name
@throw Error("No dataSet for record Id") if tag is unknown
*/
std::string tagName() const
- { return pKey_ == 0 ? "" : pKey_->tagName(); }
+ { return key_.get() == 0 ? "" : key_->tagName(); }
//! Return the tag (aka dataset) number
uint16_t tag() const
- { return pKey_ == 0 ? 0 : pKey_->tag(); }
+ { return key_.get() == 0 ? 0 : key_->tag(); }
//! Return the type id of the value
TypeId typeId() const
{ return pValue_ == 0 ? invalidTypeId : pValue_->typeId(); }
@@ -221,7 +221,7 @@ namespace Exiv2 {
private:
// DATA
- IptcKey* pKey_; //!< Key
+ IptcKey::AutoPtr key_; //!< Key
Value* pValue_; //!< Pointer to the value
bool modified_; //!< Change indicator
diff --git a/src/metadatum.cpp b/src/metadatum.cpp
index 165d4bb..7a157e7 100644
--- a/src/metadatum.cpp
+++ b/src/metadatum.cpp
@@ -20,7 +20,7 @@
*/
/*
File: metadatum.cpp
- Version: $Name: $ $Revision: 1.1 $
+ Version: $Name: $ $Revision: 1.2 $
Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
Brad Schick (brad) <schick at robotbattle.com>
History: 26-Jan-04, ahu: created
@@ -28,7 +28,7 @@
*/
// *****************************************************************************
#include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name: $ $Revision: 1.1 $ $RCSfile: metadatum.cpp,v $");
+EXIV2_RCSID("@(#) $Name: $ $Revision: 1.2 $ $RCSfile: metadatum.cpp,v $");
// *****************************************************************************
// included header files
@@ -42,6 +42,11 @@ EXIV2_RCSID("@(#) $Name: $ $Revision: 1.1 $ $RCSfile: metadatum.cpp,v $");
// *****************************************************************************
// class member definitions
namespace Exiv2 {
+
+ Key::AutoPtr Key::clone() const
+ {
+ return AutoPtr(clone_());
+ }
std::ostream& operator<<(std::ostream& os, const Metadatum& md)
{
@@ -56,7 +61,6 @@ namespace Exiv2 {
return os;
}
-
bool cmpMetadataByTag(const Metadatum& lhs, const Metadatum& rhs)
{
return lhs.tag() < rhs.tag();
diff --git a/src/metadatum.hpp b/src/metadatum.hpp
index 511cdc5..c70194d 100644
--- a/src/metadatum.hpp
+++ b/src/metadatum.hpp
@@ -21,7 +21,7 @@
/*!
@file metadatum.hpp
@brief Provides abstract base classes Metadatum and Key
- @version $Name: $ $Revision: 1.3 $
+ @version $Name: $ $Revision: 1.4 $
@author Andreas Huggel (ahu)
<a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
@author Brad Schick (brad)
@@ -40,6 +40,7 @@
// + standard includes
#include <string>
+#include <memory>
// *****************************************************************************
// namespace extensions
@@ -54,6 +55,9 @@ namespace Exiv2 {
*/
class Key {
public:
+ //! Shortcut for a %Key auto pointer.
+ typedef std::auto_ptr<Key> AutoPtr;
+
//! @name Creators
//@{
//! Destructor
@@ -78,10 +82,11 @@ namespace Exiv2 {
//! Return the tag number
virtual uint16_t tag() const =0;
/*!
- @brief Return a pointer to a copy of itself (deep copy).
- The caller owns this copy and is responsible to delete it!
+ @brief Return an auto-pointer to a copy of itself (deep copy).
+ The caller owns this copy and the auto-pointer ensures that it
+ will be deleted.
*/
- virtual Key* clone() const =0;
+ AutoPtr 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
@@ -101,6 +106,10 @@ namespace Exiv2 {
Key& operator=(const Key& rhs) { return *this; }
//@}
+ private:
+ //! Internal virtual copy constructor.
+ virtual Key* clone_() const =0;
+
}; // class Key
//! Output operator for Key types
@@ -241,7 +250,7 @@ namespace Exiv2 {
by subclasses but not directly.
*/
Metadatum& operator=(const Metadatum& rhs) { return *this; }
- //@}
+ //@}
}; // class Metadatum
diff --git a/src/tags.cpp b/src/tags.cpp
index db73575..f450630 100644
--- a/src/tags.cpp
+++ b/src/tags.cpp
@@ -20,13 +20,13 @@
*/
/*
File: tags.cpp
- Version: $Name: $ $Revision: 1.38 $
+ Version: $Name: $ $Revision: 1.39 $
Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
History: 15-Jan-04, ahu: created
*/
// *****************************************************************************
#include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name: $ $Revision: 1.38 $ $RCSfile: tags.cpp,v $");
+EXIV2_RCSID("@(#) $Name: $ $Revision: 1.39 $ $RCSfile: tags.cpp,v $");
// *****************************************************************************
// included header files
@@ -473,7 +473,12 @@ namespace Exiv2 {
return ExifTags::tagName(tag_, ifdId_);
}
- ExifKey* ExifKey::clone() const
+ ExifKey::AutoPtr ExifKey::clone() const
+ {
+ return AutoPtr(clone_());
+ }
+
+ ExifKey* ExifKey::clone_() const
{
return new ExifKey(*this);
}
diff --git a/src/tags.hpp b/src/tags.hpp
index 669fcdb..1fd9db3 100644
--- a/src/tags.hpp
+++ b/src/tags.hpp
@@ -21,7 +21,7 @@
/*!
@file tags.hpp
@brief Exif tag and type information
- @version $Name: $ $Revision: 1.29 $
+ @version $Name: $ $Revision: 1.30 $
@author Andreas Huggel (ahu)
<a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
@date 15-Jan-04, ahu: created<BR>
@@ -201,6 +201,9 @@ namespace Exiv2 {
*/
class ExifKey : public Key {
public:
+ //! Shortcut for an %ExifKey auto pointer.
+ typedef std::auto_ptr<ExifKey> AutoPtr;
+
//! @name Creators
//@{
/*!
@@ -247,8 +250,8 @@ namespace Exiv2 {
virtual std::string groupName() const { return ifdItem(); }
virtual std::string tagName() const;
virtual uint16_t tag() const { return tag_; }
- virtual ExifKey* clone() const;
+ AutoPtr clone() const;
//! Interpret and print the value of an Exif tag
std::ostream& printTag(std::ostream& os, const Value& value) const;
//! Return the IFD id
@@ -282,6 +285,9 @@ namespace Exiv2 {
//@}
private:
+ //! Internal virtual copy constructor.
+ virtual ExifKey* clone_() const;
+
// DATA
static const char* familyName_;
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list