[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a
Maximiliano Curia
maxy at moszumanska.debian.org
Thu Jul 13 17:39:15 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=d8e6b51
The following commit has been merged in the master branch:
commit d8e6b51c69a61dbb0089b1f040406b79488f3f97
Author: Andreas Huggel <ahuggel at gmx.net>
Date: Sat Feb 16 18:08:44 2008 +0000
Refactored op<< for Metadatum, introduced std::string Metadatum::print(). Fixes #474.
---
src/exif.cpp | 9 +++++----
src/exif.hpp | 8 +-------
src/iptc.cpp | 12 +++++-------
src/iptc.hpp | 7 +------
src/metadatum.cpp | 14 ++++----------
src/metadatum.hpp | 26 +++++++++++++++++++++++---
src/xmp.cpp | 13 +++++--------
src/xmp.hpp | 7 +------
8 files changed, 45 insertions(+), 51 deletions(-)
diff --git a/src/exif.cpp b/src/exif.cpp
index ca45b79..121a24d 100644
--- a/src/exif.cpp
+++ b/src/exif.cpp
@@ -111,6 +111,11 @@ namespace Exiv2 {
if (rhs.value_.get() != 0) value_ = rhs.value_->clone(); // deep copy
}
+ std::ostream& Exifdatum::write(std::ostream& os) const
+ {
+ return ExifTags::printTag(os, tag(), ifdId(), value());
+ }
+
const Value& Exifdatum::value() const
{
if (value_.get() == 0) throw Error(8);
@@ -1281,10 +1286,6 @@ namespace Exiv2 {
makerNote->add(e);
} // addToMakerNote
- std::ostream& operator<<(std::ostream& os, const Exifdatum& md)
- {
- return ExifTags::printTag(os, md.tag(), md.ifdId(), md.value());
- }
} // namespace Exiv2
// *****************************************************************************
diff --git a/src/exif.hpp b/src/exif.hpp
index 1f348c8..dee57ab 100644
--- a/src/exif.hpp
+++ b/src/exif.hpp
@@ -66,7 +66,6 @@ namespace Exiv2 {
an ExifKey and a Value and provides methods to manipulate these.
*/
class Exifdatum : public Metadatum {
- friend std::ostream& operator<<(std::ostream&, const Exifdatum&);
template<typename T> friend Exifdatum& setValue(Exifdatum&, const T&);
public:
//! @name Creators
@@ -202,6 +201,7 @@ namespace Exiv2 {
*/
long copy(byte* buf, ByteOrder byteOrder) const
{ return value_.get() == 0 ? 0 : value_->copy(buf, byteOrder); }
+ std::ostream& write(std::ostream& os) const;
//! Return the type id of the value
TypeId typeId() const
{ return value_.get() == 0 ? invalidTypeId : value_->typeId(); }
@@ -258,12 +258,6 @@ namespace Exiv2 {
}; // class Exifdatum
/*!
- @brief Output operator for Exifdatum types, prints the interpreted
- tag value.
- */
- std::ostream& operator<<(std::ostream& os, const Exifdatum& md);
-
- /*!
@brief Set the value of \em exifDatum to \em value. If the object already
has a value, it is replaced. Otherwise a new ValueType\<T\> value
is created and set to \em value.
diff --git a/src/iptc.cpp b/src/iptc.cpp
index 247af91..3d880cb 100644
--- a/src/iptc.cpp
+++ b/src/iptc.cpp
@@ -63,6 +63,11 @@ namespace Exiv2 {
{
}
+ std::ostream& Iptcdatum::write(std::ostream& os) const
+ {
+ return os << value();
+ }
+
const Value& Iptcdatum::value() const
{
if (value_.get() == 0) throw Error(8);
@@ -323,11 +328,4 @@ namespace Exiv2 {
return iptcMetadata_.erase(pos);
}
- // *************************************************************************
- // free functions
- std::ostream& operator<<(std::ostream& os, const Iptcdatum& md)
- {
- return os << md.value();
- }
-
} // namespace Exiv2
diff --git a/src/iptc.hpp b/src/iptc.hpp
index d912946..35ea2de 100644
--- a/src/iptc.hpp
+++ b/src/iptc.hpp
@@ -111,6 +111,7 @@ namespace Exiv2 {
//@{
long copy(byte* buf, ByteOrder byteOrder) const
{ return value_.get() == 0 ? 0 : value_->copy(buf, byteOrder); }
+ std::ostream& write(std::ostream& os) const;
/*!
@brief Return the key of the Iptcdatum. The key is of the form
'<b>Iptc</b>.recordName.datasetName'. Note however that the key
@@ -169,12 +170,6 @@ namespace Exiv2 {
}; // class Iptcdatum
- /*!
- @brief Output operator for Iptcdatum types, printing the interpreted
- tag value.
- */
- std::ostream& operator<<(std::ostream& os, const Iptcdatum& md);
-
//! Container type to hold all metadata
typedef std::vector<Iptcdatum> IptcMetadata;
diff --git a/src/metadatum.cpp b/src/metadatum.cpp
index 3155a58..b0e070d 100644
--- a/src/metadatum.cpp
+++ b/src/metadatum.cpp
@@ -70,17 +70,11 @@ namespace Exiv2 {
return *this;
}
- std::ostream& operator<<(std::ostream& os, const Metadatum& md)
+ std::string Metadatum::print() const
{
- os << "0x" << std::setw(4) << std::setfill('0') << std::right
- << std::hex << md.tag() << " "
- << std::setw(40) << std::setfill(' ') << std::left
- << md.key() << " "
- << std::setw(9) << std::setfill(' ') << std::left
- << md.typeName() << " "
- << std::dec << md.value()
- << "
";
- return os;
+ std::ostringstream os;
+ write(os);
+ return os.str();
}
bool cmpMetadataByTag(const Metadatum& lhs, const Metadatum& rhs)
diff --git a/src/metadatum.hpp b/src/metadatum.hpp
index 2079b52..b9423d3 100644
--- a/src/metadatum.hpp
+++ b/src/metadatum.hpp
@@ -155,6 +155,12 @@ namespace Exiv2 {
//! @name Accessors
//@{
/*!
+ @brief Write the interpreted value to a string.
+
+ Implemented in terms of std::ostream& write(std::ostream& os).
+ */
+ std::string print() const;
+ /*!
@brief Write value to a data buffer and return the number
of bytes written.
@@ -167,6 +173,17 @@ namespace Exiv2 {
*/
virtual long copy(byte* buf, ByteOrder byteOrder) const =0;
/*!
+ @brief Write the interpreted value to an output stream, return
+ the stream.
+
+ You do not usually have to use this function; it is used for the
+ implementation of the output operator for %Metadatum,
+ operator<<(std::ostream &os, const Metadatum &md). See also
+ std::string print() const, which prints the interpreted value
+ to a string.
+ */
+ virtual std::ostream& write(std::ostream& os) const =0;
+ /*!
@brief Return the key of the metadatum. The key is of the form
'familyName.ifdItem.tagName'. Note however that the key
is not necessarily unique, i.e., an ExifData object may
@@ -280,12 +297,15 @@ namespace Exiv2 {
}; // class FindMetadatumByTag
-
/*!
- @brief Output operator for Metadatum types, printing the interpreted
+ @brief Output operator for Metadatum types, writing the interpreted
tag value.
*/
- std::ostream& operator<<(std::ostream& os, const Metadatum& md);
+ inline std::ostream& operator<<(std::ostream& os, const Metadatum& md)
+ {
+ return md.write(os);
+ }
+
/*!
@brief Compare two metadata by tag. Return true if the tag of metadatum
lhs is less than that of rhs.
diff --git a/src/xmp.cpp b/src/xmp.cpp
index 6898d78..941491e 100644
--- a/src/xmp.cpp
+++ b/src/xmp.cpp
@@ -246,6 +246,11 @@ namespace Exiv2 {
return 0;
}
+ std::ostream& Xmpdatum::write(std::ostream& os) const
+ {
+ return XmpProperties::printProperty(os, key(), value());
+ }
+
Xmpdatum& Xmpdatum::operator=(const std::string& value)
{
setValue(value);
@@ -665,14 +670,6 @@ namespace Exiv2 {
} // XmpParser::encode
#endif // !EXV_HAVE_XMP_TOOLKIT
- // *************************************************************************
- // free functions
-
- std::ostream& operator<<(std::ostream& os, const Xmpdatum& md)
- {
- return XmpProperties::printProperty(os, md.key(), md.value());
- }
-
} // namespace Exiv2
// *****************************************************************************
diff --git a/src/xmp.hpp b/src/xmp.hpp
index 0cbc630..82857d2 100644
--- a/src/xmp.hpp
+++ b/src/xmp.hpp
@@ -120,6 +120,7 @@ namespace Exiv2 {
//@{
//! Not implemented. Calling this method will raise an exception.
long copy(byte* buf, ByteOrder byteOrder) const;
+ std::ostream& write(std::ostream& os) const;
/*!
@brief Return the key of the Xmpdatum. The key is of the form
'<b>Xmp</b>.prefix.property'. Note however that the
@@ -157,12 +158,6 @@ namespace Exiv2 {
}; // class Xmpdatum
- /*!
- @brief Output operator for Xmpdatum types, printing the interpreted
- tag value.
- */
- std::ostream& operator<<(std::ostream& os, const Xmpdatum& md);
-
//! Container type to hold all metadata
typedef std::vector<Xmpdatum> XmpMetadata;
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list