本文整理汇总了C++中exiv2::exifdata::const_iterator::tag方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::tag方法的具体用法?C++ const_iterator::tag怎么用?C++ const_iterator::tag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exiv2::exifdata::const_iterator
的用法示例。
在下文中一共展示了const_iterator::tag方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: print
void print(const std::string& file)
{
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
assert(image.get() != 0);
image->readMetadata();
Exiv2::ExifData &ed = image->exifData();
Exiv2::ExifData::const_iterator end = ed.end();
for (Exiv2::ExifData::const_iterator i = ed.begin(); i != end; ++i) {
std::cout << std::setw(45) << std::setfill(' ') << std::left
<< i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::setw(12) << std::setfill(' ') << std::left
<< i->ifdName() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< i->typeName() << " "
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< i->count() << " "
<< std::dec << i->value()
<< "\n";
}
}
示例2: print
void print(const std::string& file)
{
Exiv2::ExifData ed;
int rc = ed.read(file);
if (rc) {
std::string error = Exiv2::ExifData::strError(rc, file);
throw Exiv2::Error(error);
}
Exiv2::ExifData::const_iterator end = ed.end();
for (Exiv2::ExifData::const_iterator i = ed.begin(); i != end; ++i) {
std::cout << std::setw(45) << std::setfill(' ') << std::left
<< i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::setw(12) << std::setfill(' ') << std::left
<< i->ifdName() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< i->typeName() << " "
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< i->count() << " "
<< std::dec << i->value()
<< "\n";
}
}
示例3: readexiv
void ImageResolution::readexiv(char const *fn) {
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(fn);
if (!image.get())
return;
image->readMetadata();
Exiv2::ExifData &exifData = image->exifData();
if (exifData.empty())
return;
Exiv2::ExifData::const_iterator end = exifData.end();
bool havex = false;
bool havey = false;
bool haveunit = false;
int unit;
for (Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i) {
if (ok_)
break;
if (i->tag()==0x011a) {
// X Resolution
x_ = i->toFloat();
havex = true;
} else if (i->tag()==0x011b) {
// Y Resolution
y_ = i->toFloat();
havey = true;
} else if (i->tag()==0x0128) {
unit = i->toLong();
}
ok_ = havex && havey && haveunit;
}
if (haveunit) {
if (unit==3) {
x_ *= 2.54;
y_ *= 2.54;
}
}
ok_ = havex && havey;
}
示例4: print
void print(const ExifData& exifData)
{
if (exifData.empty()) {
std::string error("No Exif data found in the file");
throw Exiv2::Error(1, error);
}
Exiv2::ExifData::const_iterator end = exifData.end();
for (Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i) {
std::cout << std::setw(44) << std::setfill(' ') << std::left
<< i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< i->typeName() << " "
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< i->count() << " "
<< std::dec << i->value()
<< "\n";
}
}
示例5: exiv2_dump_tags
void exiv2_dump_tags(const ExifData& exif)
{
cout << "exiv2_dump_tags: " << endl;
Exiv2::ExifData::const_iterator end = exif.end();
for (Exiv2::ExifData::const_iterator i = exif.begin(); i != end; ++i)
{
std::cout << std::setw(44) << std::setfill(' ') << std::left
<< i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< i->typeName() << " "
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< i->count() << " "
<< std::dec << i->value()
<< "\n";
}
}
示例6: main
int main(int argc, char* const argv[])
try {
if (argc != 2) {
std::cout << "Usage: " << argv[0] << " file\n";
return 1;
}
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]);
if (image.get() == 0) {
std::string error(argv[1]);
error += " : Could not read file or unknown image type";
throw Exiv2::Error(error);
}
// Load existing metadata
int rc = image->readMetadata();
if (rc) {
std::string error = Exiv2::Image::strError(rc, argv[1]);
throw Exiv2::Error(error);
}
Exiv2::ExifData &exifData = image->exifData();
Exiv2::ExifData::const_iterator end = exifData.end();
for (Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i) {
std::cout << std::setw(53) << std::setfill(' ') << std::left
<< i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::dec << i->value()
<< "\n";
}
return rc;
}
catch (Exiv2::Error& e) {
std::cout << "Caught Exiv2 exception '" << e << "'\n";
return -1;
}
示例7: parseTag
void Tag_Handler::parseTag()
{
if(!gps_from_filename)
gps_found = false;
Exiv2::ExifData::const_iterator end = exif_data->end();
for(Exiv2::ExifData::const_iterator i = exif_data->begin(); i != end; ++i)
{
if(0)//(dumpAllExif)
{
const char* tn = i->typeName();
std::cout << std::setw(44) << std::setfill(' ') << std::left
<< i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< (tn ? tn : "Unknown") << " "
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< i->count() << " "
<< std::dec << i->value()
<< "\n";
}
if(i->key() == "Exif.GPSInfo.GPSLatitude" && !gps_from_filename)
{
gps.lat_ratio = QString::fromStdString(i->value().toString());
convert_degMinSec(gps.lat_ratio, gps.lat_coord);
gps.lat_coord.dec_form = getDecForm(gps.lat_coord, gps.lat_coord.ref);
gps_found = true;
}
else if(i->key() == "Exif.GPSInfo.GPSLongitude" && !gps_from_filename)
{
gps.long_ratio = QString::fromStdString(i->value().toString());
convert_degMinSec(gps.long_ratio, gps.long_coord);
gps.long_coord.dec_form = getDecForm(gps.long_coord, gps.long_coord.ref);
gps_found = true;
}
else if(i->key() == "Exif.GPSInfo.GPSLatitudeRef" && !gps_from_filename)
{
gps.lat_coord.ref = QString::fromStdString(i->value().toString());
}
else if(i->key() == "Exif.GPSInfo.GPSLongitudeRef" && !gps_from_filename)
{
gps.long_coord.ref = QString::fromStdString(i->value().toString());
}
else if(i->key() == "Exif.Photo.UserComment")
{
const char* tn = i->typeName();
std::cout << std::setw(44) << std::setfill(' ') << std::left
<< i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< (tn ? tn : "Unknown") << " "
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< i->count() << " "
<< std::dec << i->value()
<< "\n";
//need to reset user comment if hasn't been set before
if(i->count() == 264)
{
(*exif_data)["Exif.Photo.UserComment"] = "";
image->writeMetadata();
}
}
}
if(!gps_found)
{
clearGPSdata(gps);
}
}