Added LangAltValue::toString(const std::string&) to get the value for a specific language qualifier (suggested by Marco Piovanelli).

This commit is contained in:
Andreas Huggel 2008-05-01 08:22:26 +00:00
parent aada8cfb92
commit d1a305e30f
2 changed files with 21 additions and 3 deletions

View File

@ -702,6 +702,16 @@ namespace Exiv2 {
std::string LangAltValue::toString(long /*n*/) const
{
return toString("x-default");
}
std::string LangAltValue::toString(const std::string& qualifier) const
{
ValueType::const_iterator i = value_.find(qualifier);
if (i != value_.end()) {
ok_ = true;
return i->second;
}
ok_ = false;
return "";
}

View File

@ -893,11 +893,19 @@ namespace Exiv2 {
AutoPtr clone() const;
virtual long count() const;
/*!
@brief Return the <EM>n</EM>-th component of the value as a string.
The behaviour of this method may be undefined if there is no
<EM>n</EM>-th component.
@brief Return the text value associated with the default language
qualifier \c x-default. The parameter \em n is not used, but
it is suggested that only 0 is passed in. Returns an empty
string and sets the ok-flag to \c false if there is no
default value.
*/
virtual std::string toString(long n) const;
/*!
@brief Return the text value associated with the language qualifier
\em qualifier. Returns an empty string and sets the ok-flag
to \c false if there is no entry for the language qualifier.
*/
std::string toString(const std::string& qualifier) const;
virtual long toLong(long n =0) const;
virtual float toFloat(long n =0) const;
virtual Rational toRational(long n =0) const;