diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2009-11-24 10:01:18 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2009-11-24 10:01:18 +0100 |
commit | ccfcadbc550a453aa1fa1b1e6b036eec0a902dd6 (patch) | |
tree | 52df322f9755a6262298f8cd9302f226ea2a6879 /src/exiv2wrapper.cpp | |
parent | 1bcfb83db7bd8b985b3172ad80b0cb155de7146c (diff) | |
download | pyexiv2-ccfcadbc550a453aa1fa1b1e6b036eec0a902dd6.tar.gz |
Separate _XmpTag value getters for text, array and lang alt.
Diffstat (limited to 'src/exiv2wrapper.cpp')
-rw-r--r-- | src/exiv2wrapper.cpp | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/exiv2wrapper.cpp b/src/exiv2wrapper.cpp index d7e989c..96e9536 100644 --- a/src/exiv2wrapper.cpp +++ b/src/exiv2wrapper.cpp @@ -641,10 +641,10 @@ XmpTag::XmpTag(const std::string& key, Exiv2::Xmpdatum* datum): _key(key) _type = info->xmpValueType_; } -void XmpTag::setRawValue(const std::string& value) +/*void XmpTag::setRawValue(const std::string& value) { _datum->setValue(value); -} +}*/ const std::string XmpTag::getKey() { @@ -671,9 +671,35 @@ const std::string XmpTag::getDescription() return _description; } -const std::string XmpTag::getRawValue() +const std::string XmpTag::getTextValue() { - return _datum->toString(); + return dynamic_cast<const Exiv2::XmpTextValue*>(&_datum->value())->value_; +} + +const boost::python::list XmpTag::getArrayValue() +{ + std::vector<std::string> value = + dynamic_cast<const Exiv2::XmpArrayValue*>(&_datum->value())->value_; + boost::python::list rvalue; + for(std::vector<std::string>::const_iterator i = value.begin(); + i != value.end(); ++i) + { + rvalue.append(*i); + } + return rvalue; +} + +const boost::python::dict XmpTag::getLangAltValue() +{ + Exiv2::LangAltValue::ValueType value = + dynamic_cast<const Exiv2::LangAltValue*>(&_datum->value())->value_; + boost::python::dict rvalue; + for (Exiv2::LangAltValue::ValueType::const_iterator i = value.begin(); + i != value.end(); ++i) + { + rvalue[i->first] = i->second; + } + return rvalue; } |