diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/exiv2wrapper.cpp | 32 | ||||
-rw-r--r-- | src/exiv2wrapper.hpp | 4 | ||||
-rw-r--r-- | src/exiv2wrapper_python.cpp | 4 |
3 files changed, 36 insertions, 4 deletions
diff --git a/src/exiv2wrapper.cpp b/src/exiv2wrapper.cpp index 7455477..5666d10 100644 --- a/src/exiv2wrapper.cpp +++ b/src/exiv2wrapper.cpp @@ -656,10 +656,38 @@ XmpTag::XmpTag(const std::string& key, Exiv2::Xmpdatum* datum): _key(key) } } -/*void XmpTag::setRawValue(const std::string& value) +void XmpTag::setTextValue(const std::string& value) { _datum->setValue(value); -}*/ +} + +void XmpTag::setArrayValue(const boost::python::list& values) +{ + // Reset the value + _datum->setValue(0); + + for(boost::python::stl_input_iterator<std::string> iterator(values); + iterator != boost::python::stl_input_iterator<std::string>(); + ++iterator) + { + _datum->setValue(*iterator); + } +} + +void XmpTag::setLangAltValue(const boost::python::dict& values) +{ + // Reset the value + _datum->setValue(0); + + for(boost::python::stl_input_iterator<std::string> iterator(values); + iterator != boost::python::stl_input_iterator<std::string>(); + ++iterator) + { + std::string key = *iterator; + std::string value = boost::python::extract<std::string>(values.get(key)); + _datum->setValue("lang=\"" + key + "\" " + value); + } +} const std::string XmpTag::getKey() { diff --git a/src/exiv2wrapper.hpp b/src/exiv2wrapper.hpp index 418fac7..8a0d885 100644 --- a/src/exiv2wrapper.hpp +++ b/src/exiv2wrapper.hpp @@ -108,7 +108,9 @@ public: // Constructor XmpTag(const std::string& key, Exiv2::Xmpdatum* datum=0); - //void setRawValue(const std::string& value); + void setTextValue(const std::string& value); + void setArrayValue(const boost::python::list& values); + void setLangAltValue(const boost::python::dict& values); const std::string getKey(); const std::string getExiv2Type(); diff --git a/src/exiv2wrapper_python.cpp b/src/exiv2wrapper_python.cpp index e63e651..e2bdea5 100644 --- a/src/exiv2wrapper_python.cpp +++ b/src/exiv2wrapper_python.cpp @@ -79,7 +79,9 @@ BOOST_PYTHON_MODULE(libexiv2python) class_<XmpTag>("_XmpTag", init<std::string>()) - //.def("_setRawValue", &XmpTag::setRawValue) + .def("_setTextValue", &XmpTag::setTextValue) + .def("_setArrayValue", &XmpTag::setArrayValue) + .def("_setLangAltValue", &XmpTag::setLangAltValue) .def("_getKey", &XmpTag::getKey) .def("_getExiv2Type", &XmpTag::getExiv2Type) |