本文整理汇总了C++中exiv2::exifdata::const_iterator::groupName方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::groupName方法的具体用法?C++ const_iterator::groupName怎么用?C++ const_iterator::groupName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exiv2::exifdata::const_iterator
的用法示例。
在下文中一共展示了const_iterator::groupName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LOG
/** \fn ImageUtils::GetAllExifValues(const QString &)
* \brief Reads and returns all non empty tags from the given file
* \param fileName The filename that holds the exif data
* \return The list of exif tag names and values
*/
QList<QStringList> ImageUtils::GetAllExifValues(const QString &fileName)
{
// default value, an empty list means no
// exif tags were found or an error occured
QList<QStringList> valueList;
try
{
Exiv2::Image::AutoPtr image =
Exiv2::ImageFactory::open(fileName.toLocal8Bit().constData());
if (image.get())
{
image->readMetadata();
Exiv2::ExifData &exifData = image->exifData();
if (!exifData.empty())
{
LOG(VB_GENERAL, LOG_DEBUG,
QString("Found %1 tag(s) for file %2")
.arg(exifData.count())
.arg(fileName));
Exiv2::ExifData::const_iterator end = exifData.end();
Exiv2::ExifData::const_iterator i = exifData.begin();
for (; i != end; ++i)
{
QString value = QString::fromStdString(i->value().toString());
// Do not add empty tags to the list
if (!value.isEmpty())
{
QStringList values;
// These three are the same as i->key()
values.append(QString::fromStdString(i->familyName()));
values.append(QString::fromStdString(i->groupName()));
values.append(QString::fromStdString(i->tagName()));
values.append(QString::fromStdString(i->key()));
values.append(QString::fromStdString(i->tagLabel()));
values.append(QString::fromStdString(i->value().toString()));
// Add the exif information to the list
valueList.append(values);
}
}
}
else
{
LOG(VB_GENERAL, LOG_ERR,
QString("Exiv2 error: No header, file %1")
.arg(fileName));
}
}
else
{
LOG(VB_GENERAL, LOG_ERR,
QString("Exiv2 error: Could not open file, file %1")
.arg(fileName));
}
}
catch (Exiv2::Error& e)
{
LOG(VB_GENERAL, LOG_ERR,
QString("Exiv2 exception %1, file %2")
.arg(e.what()).arg(fileName));
}
return valueList;
}
示例2: JMAP
JSONNODE *ImgTagJson::genLitExif(const Exiv2::Image::AutoPtr & image)
{
//const Exiv2::ExifData &data = image->exifData();
Exiv2::ExifData &data = image->exifData();
data.sortByKey();
if (data.empty()) return NULL;
Exiv2::ExifData::const_iterator end = data.end();
JMAP *grpmap = new JMAP();
JSONNODE *tree = json_new(JSON_NODE);
json_set_name(tree, "exif");
for (Exiv2::ExifData::const_iterator i = data.begin(); i != end; i++)
{
JSONNODE *grp;
if (grpmap->find(i->groupName()) == grpmap->end())
{
grp = json_new(JSON_NODE);
json_set_name(grp, i->groupName().c_str());
grpmap->insert(JMAP::value_type(i->groupName(), grp));
}
else
grp = (grpmap->find(i->groupName()))->second;
Exiv2::ExifData::const_iterator nxt = i;
nxt++;
if ((nxt != data.end()) && (i->key() == nxt->key()))
{
//cout << "Array Elem! " << i->key() << endl;
JSONNODE *arr = json_new(JSON_ARRAY);
json_set_name(arr, i->tagName().c_str());
json_push_back(arr, json_new_a((i->tagName()).c_str(),
(i->print()).c_str()));
while ((nxt != data.end()) && (nxt->key() == i->key()))
{
json_push_back(arr, json_new_a((nxt->tagName()).c_str(),
(nxt->print()).c_str()));
nxt++;
}
json_push_back(grp, arr);
if (nxt == data.end()) break;
nxt--;
i = nxt;
}
else
{
json_push_back(grp, json_new_a((i->tagName()).c_str(),
(i->print()).c_str()));
}
}
JMAP::iterator it;
for(it = grpmap->begin(); it != grpmap->end(); it++)
{
json_push_back(tree, it->second);
grpmap->erase(it);
}
//cout << it->first << endl;
delete grpmap;
//cout << json_write_formatted(tree) << endl;
return tree;
}