aboutsummaryrefslogtreecommitdiffstats
path: root/src/exiv2wrapper.cpp
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2009-04-21 20:14:39 +0200
committerOlivier Tilloy <olivier@tilloy.net>2009-04-21 20:14:39 +0200
commita23bf770e4621a5dc65fccf723edd01ea7deec7c (patch)
tree68d406f00fd762adf79281178090d1f0c0f78933 /src/exiv2wrapper.cpp
parent279b974080eafb42af1f8da3920e2c4d04e63a0f (diff)
downloadpyexiv2-a23bf770e4621a5dc65fccf723edd01ea7deec7c.tar.gz
Private value setter for XMP tags.
Diffstat (limited to 'src/exiv2wrapper.cpp')
-rw-r--r--src/exiv2wrapper.cpp40
1 files changed, 3 insertions, 37 deletions
diff --git a/src/exiv2wrapper.cpp b/src/exiv2wrapper.cpp
index 4c37fd6..b91a2ac 100644
--- a/src/exiv2wrapper.cpp
+++ b/src/exiv2wrapper.cpp
@@ -365,49 +365,15 @@ boost::python::tuple Image::getXmpTag(std::string key)
return boost::python::make_tuple(key, sTagName, sTagLabel, sTagDesc, sTagType, sTagValue);
}
-/*void Image::setXmpTagValues(std::string key, boost::python::tuple values)
+void Image::setXmpTagValue(std::string key, std::string value)
{
if (!_dataRead)
{
throw Exiv2::Error(METADATA_NOT_READ);
}
- Exiv2::XmpKey xmpKey = Exiv2::XmpKey(key);
- unsigned int index = 0;
- unsigned int max = len(values);
- Exiv2::XmpMetadata::iterator dataIterator = _xmpData.findKey(xmpKey);
- while (index < max)
- {
- std::string value = boost::python::extract<std::string>(values[index++]);
- if (dataIterator != _xmpData.end())
- {
- // Override an existing value
- dataIterator->setValue(value);
- dataIterator = std::find_if(++dataIterator, _xmpData.end(),
- Exiv2::FindMetadatumById::FindMetadatumById(xmpKey.tag(),
- xmpKey.record()));
- }
- else
- {
- // Append a new value
- Exiv2::Iptcdatum iptcDatum(iptcKey);
- iptcDatum.setValue(value);
- int state = _iptcData.add(iptcDatum);
- if (state == 6)
- {
- throw Exiv2::Error(NON_REPEATABLE);
- }
- }
- }
- // Erase the remaining values if any
- while (dataIterator != _iptcData.end())
- {
- _iptcData.erase(dataIterator);
- dataIterator = std::find_if(dataIterator, _iptcData.end(),
- Exiv2::FindMetadatumById::FindMetadatumById(iptcKey.tag(),
- iptcKey.record()));
- }
-}*/
+ _xmpData[key] = value;
+}
/*
boost::python::tuple Image::getThumbnailData()