本文整理汇总了C++中exiv2::iptcdata::iterator::toString方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::toString方法的具体用法?C++ iterator::toString怎么用?C++ iterator::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exiv2::iptcdata::iterator
的用法示例。
在下文中一共展示了iterator::toString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: iptcData
QStringList KExiv2::getIptcSubCategories() const
{
try
{
if (!d->iptcMetadata().empty())
{
QStringList subCategories;
Exiv2::IptcData iptcData(d->iptcMetadata());
for (Exiv2::IptcData::iterator it = iptcData.begin(); it != iptcData.end(); ++it)
{
QString key = QString::fromLocal8Bit(it->key().c_str());
if (key == QString("Iptc.Application2.SuppCategory"))
{
QString val(it->toString().c_str());
subCategories.append(val);
}
}
return subCategories;
}
}
catch( Exiv2::Error& e )
{
d->printExiv2ExceptionError("Cannot get Iptc Sub Categories from image using Exiv2 ", e);
}
return QStringList();
}
示例2: getIptcKeywords
bool getIptcKeywords(Exiv2::IptcData &iptcData, bool isIptcUtf8, QStringList &keywords) {
bool anyAdded = false;
try {
QString keywordsTagName = QString::fromLatin1(IPTC_KEYWORDS);
for (Exiv2::IptcData::iterator it = iptcData.begin(); it != iptcData.end(); ++it) {
QString key = QString::fromLocal8Bit(it->key().c_str());
if (key == keywordsTagName) {
QString tag;
if (isIptcUtf8) {
tag = QString::fromUtf8(it->toString().c_str());
} else {
tag = QString::fromLocal8Bit(it->toString().c_str());
}
keywords.append(tag);
anyAdded = true;
}
}
if (keywords.length() == 1 && keywords[0].contains(',')) {
LOG_DEBUG << "processing legacy saved keywords";
QString composite = keywords[0];
keywords.clear();
keywords += decomposeKeyword(composite);
}
}
catch (Exiv2::Error &e) {
LOG_WARNING << "Exiv2 error:" << e.what();
anyAdded = false;
}
catch (...) {
LOG_WARNING << "Exception";
anyAdded = false;
#ifdef QT_DEBUG
throw;
#endif
}
return anyAdded;
}
示例3: g_strdup
gchar* gexiv2_metadata_get_iptc_tag_string (GExiv2Metadata *self, const gchar* tag) {
g_return_val_if_fail(GEXIV2_IS_METADATA (self), NULL);
g_return_val_if_fail(tag != NULL, NULL);
g_return_val_if_fail(self->priv->image.get() != NULL, NULL);
Exiv2::IptcData& iptc_data = self->priv->image->iptcData();
try {
Exiv2::IptcData::iterator it = iptc_data.findKey(Exiv2::IptcKey(tag));
while (it != iptc_data.end() && it->count() == 0)
it++;
if (it != iptc_data.end())
return g_strdup (it->toString ().c_str ());
} catch (Exiv2::Error& e) {
LOG_ERROR(e);
}
return NULL;
}
示例4: exifData
QDateTime KExiv2::getDigitizationDateTime(bool fallbackToCreationTime) const
{
try
{
// In first, trying to get Date & time from Exif tags.
if (!d->exifMetadata().empty())
{
// Try Exif date time digitized.
Exiv2::ExifData exifData(d->exifMetadata());
Exiv2::ExifKey key("Exif.Photo.DateTimeDigitized");
Exiv2::ExifData::iterator it = exifData.findKey(key);
if (it != exifData.end())
{
QDateTime dateTime = QDateTime::fromString(it->toString().c_str(), Qt::ISODate);
if (dateTime.isValid())
{
kDebug() << "DateTime (Exif digitalized): " << dateTime.toString().toAscii().constData();
return dateTime;
}
}
}
// In second, trying to get Date & time from Iptc tags.
if (!d->iptcMetadata().empty())
{
// Try digitization Iptc date time entries.
Exiv2::IptcData iptcData(d->iptcMetadata());
Exiv2::IptcKey keyDigitizationDate("Iptc.Application2.DigitizationDate");
Exiv2::IptcData::iterator it = iptcData.findKey(keyDigitizationDate);
if (it != iptcData.end())
{
QString IptcDateDigitization(it->toString().c_str());
Exiv2::IptcKey keyDigitizationTime("Iptc.Application2.DigitizationTime");
Exiv2::IptcData::iterator it2 = iptcData.findKey(keyDigitizationTime);
if (it2 != iptcData.end())
{
QString IptcTimeDigitization(it2->toString().c_str());
QDate date = QDate::fromString(IptcDateDigitization, Qt::ISODate);
QTime time = QTime::fromString(IptcTimeDigitization, Qt::ISODate);
QDateTime dateTime = QDateTime(date, time);
if (dateTime.isValid())
{
kDebug() << "Date (IPTC digitalized): " << dateTime.toString().toAscii().constData();
return dateTime;
}
}
}
}
}
catch( Exiv2::Error& e )
{
d->printExiv2ExceptionError("Cannot parse Exif digitization date & time tag using Exiv2 ", e);
}
catch(...)
{
kError() << "Default exception from Exiv2";
}
if (fallbackToCreationTime)
return getImageDateTime();
else
return QDateTime();
}
示例5: getDigitizationDateTime
QDateTime MetaEngine::getDigitizationDateTime(bool fallbackToCreationTime) const
{
try
{
// In first, trying to get Date & time from Exif tags.
if (!d->exifMetadata().empty())
{
// Try Exif date time digitized.
Exiv2::ExifData exifData(d->exifMetadata());
Exiv2::ExifKey key("Exif.Photo.DateTimeDigitized");
Exiv2::ExifData::iterator it = exifData.findKey(key);
if (it != exifData.end())
{
QDateTime dateTime = QDateTime::fromString(QString::fromLatin1(it->toString().c_str()), Qt::ISODate);
if (dateTime.isValid())
{
qCDebug(DIGIKAM_METAENGINE_LOG) << "DateTime (Exif digitalized): " << dateTime.toString().toLatin1().constData();
return dateTime;
}
}
}
// In second, we trying XMP
#ifdef _XMP_SUPPORT_
if (!d->xmpMetadata().empty())
{
Exiv2::XmpData xmpData(d->xmpMetadata());
{
Exiv2::XmpKey key("Xmp.exif.DateTimeDigitized");
Exiv2::XmpData::iterator it = xmpData.findKey(key);
if (it != xmpData.end())
{
QDateTime dateTime = QDateTime::fromString(QString::fromLatin1(it->toString().c_str()), Qt::ISODate);
if (dateTime.isValid())
{
qCDebug(DIGIKAM_METAENGINE_LOG) << "DateTime (XMP-Exif digitalized): " << dateTime.toString().toLatin1().constData();
return dateTime;
}
}
}
{
Exiv2::XmpKey key("Xmp.video.DateTimeDigitized");
Exiv2::XmpData::iterator it = xmpData.findKey(key);
if (it != xmpData.end())
{
QDateTime dateTime = QDateTime::fromString(QString::fromLatin1(it->toString().c_str()), Qt::ISODate);
if (dateTime.isValid())
{
qCDebug(DIGIKAM_METAENGINE_LOG) << "DateTime (XMP-Video digitalized): " << dateTime.toString().toLatin1().constData();
return dateTime;
}
}
}
}
#endif // _XMP_SUPPORT_
// In third, trying to get Date & time from Iptc tags.
if (!d->iptcMetadata().empty())
{
// Try digitization Iptc date time entries.
Exiv2::IptcData iptcData(d->iptcMetadata());
Exiv2::IptcKey keyDigitizationDate("Iptc.Application2.DigitizationDate");
Exiv2::IptcData::iterator it = iptcData.findKey(keyDigitizationDate);
if (it != iptcData.end())
{
QString IptcDateDigitization(QString::fromLatin1(it->toString().c_str()));
Exiv2::IptcKey keyDigitizationTime("Iptc.Application2.DigitizationTime");
Exiv2::IptcData::iterator it2 = iptcData.findKey(keyDigitizationTime);
if (it2 != iptcData.end())
{
QString IptcTimeDigitization(QString::fromLatin1(it2->toString().c_str()));
QDate date = QDate::fromString(IptcDateDigitization, Qt::ISODate);
QTime time = QTime::fromString(IptcTimeDigitization, Qt::ISODate);
QDateTime dateTime = QDateTime(date, time);
if (dateTime.isValid())
{
qCDebug(DIGIKAM_METAENGINE_LOG) << "Date (IPTC digitalized): " << dateTime.toString().toLatin1().constData();
return dateTime;
}
}
}
}
//.........这里部分代码省略.........