More print functions added (intermediate version, by webustany for GHOP 98).

This commit is contained in:
Andreas Huggel 2008-01-25 01:55:37 +00:00
parent c54c385d61
commit cd9aa48676
4 changed files with 34 additions and 1 deletions

View File

@ -813,7 +813,19 @@ namespace Exiv2 {
{"Xmp.exif.GPSStatus", EXV_PRINT_TAG(xmpExifGPSStatus)},
{"Xmp.exif.GPSTrackRef", EXV_PRINT_TAG(xmpExifGPSDirection)},
{"Xmp.tiff.XResolution", printLong},
{"Xmp.tiff.YResolution", printLong}
{"Xmp.tiff.YResolution", printLong},
{"Xmp.exif.DateTimeOriginal", printDate},
{"Xmp.exif.GPSTimeStamp", printDate},
{"Xmp.exif.CreateDate", printDate},
{"Xmp.exif.ModifyDate", printDate},
{"Xmp.exif.ApertureValue", print0x9202},
{"Xmp.exif.FNumber", print0x9202},
{"Xmp.exif.BrightnessValue", printLong},
{"Xmp.exif.ExposureBiasValue", printLong},
{"Xmp.exif.FocalLength", print0x920a},
{"Xmp.exif.FocalPlaneXResolution", printFloat},
{"Xmp.exif.FocalPlaneYResolution", printFloat},
{"Xmp.exif.ShutterSpeedValue", print0x9201}
};
XmpNsInfo::Ns::Ns(const std::string& ns)

View File

@ -2037,6 +2037,24 @@ namespace Exiv2 {
return os;
}
std::ostream& printDate(std::ostream& os, const Value& value)
{
if (value.size() != 20 || value.typeId() != xmpText) {
return os << "(" << value << ")";
}
std::string stringValue = value.toString();
if (stringValue[19] == 'Z') {
stringValue = stringValue.substr(0, 19);
}
for (unsigned int i = 0; i < stringValue.length(); ++i) {
if (stringValue[i] == 'T') stringValue[i] = ' ';
if (stringValue[i] == '-') stringValue[i] = ':';
}
return os << stringValue;
}
float fnumber(float apertureValue)
{
return static_cast<float>(std::exp(std::log(2.0) * apertureValue / 2));

View File

@ -479,6 +479,8 @@ namespace Exiv2 {
std::ostream& print0xa405(std::ostream& os, const Value& value);
//! Print any version packed in 4 Bytes format : major major minor minor
std::ostream& printVersion(std::ostream& os, const Value& value);
//! Print a date following the format YYYY-MM-DDTHH:MM:SSZ
std::ostream& printDate(std::ostream& os, const Value& value);
//@}
//! Calculate F number from an APEX aperture value

View File

@ -667,6 +667,7 @@ namespace Exiv2 {
// *************************************************************************
// free functions
std::ostream& operator<<(std::ostream& os, const Xmpdatum& md)
{
return XmpProperties::printProperty(os, md.key(), md.value());