diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2007-03-08 23:10:28 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2007-03-08 23:10:28 +0100 |
commit | da26eb1a24eadc3ed9bf6f1850197ac5240486ec (patch) | |
tree | 1b207b9fe0aab6689826e5b2b94b4a6790a13f08 /src | |
parent | f2014feafc9f8df9fae40feecdf56c13a9a78a51 (diff) | |
download | pyexiv2-da26eb1a24eadc3ed9bf6f1850197ac5240486ec.tar.gz |
Modified the behaviour of Image::getAvailableIptcTags(): it now returns a list without duplicates. This is a prerequisite to the implementation of an Iptc handler that can access all the instances of a given repeatable key.
Diffstat (limited to 'src')
-rw-r--r-- | src/libpyexiv2.cpp | 7 | ||||
-rw-r--r-- | src/libpyexiv2.hpp | 3 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/libpyexiv2.cpp b/src/libpyexiv2.cpp index 6eebbdd..fdae167 100644 --- a/src/libpyexiv2.cpp +++ b/src/libpyexiv2.cpp @@ -187,8 +187,6 @@ namespace LibPyExiv2 throw Exiv2::Error(METADATA_NOT_READ); } - // returns a list containing the keys of all the IPTC tags available in - // the image boost::python::list Image::getAvailableIptcTags() { boost::python::list list; @@ -196,7 +194,10 @@ namespace LibPyExiv2 { for(Exiv2::IptcMetadata::iterator i = _iptcData.begin() ; i != _iptcData.end() ; i++) { - list.append(i->key()); + // The key is appended to the list if and only if it is not + // already present. + if (list.count(i->key()) == 0) + list.append(i->key()); } return list; } diff --git a/src/libpyexiv2.hpp b/src/libpyexiv2.hpp index 9a3e486..a63a05f 100644 --- a/src/libpyexiv2.hpp +++ b/src/libpyexiv2.hpp @@ -84,7 +84,8 @@ namespace LibPyExiv2 // libexiv2's documentation (http://exiv2.org/iptc.html). // Returns a list of all the keys of available IPTC tags set in the - // image. + // image. This list has no duplicates: each of its items is unique, + // even if a tag is present more than once. boost::python::list getAvailableIptcTags(); // Return true if the required IPTC tag is set, false otherwise. |