Apply clang-format to Print::printMetadatum

v0.27.3
Luis Díaz Más 8 years ago
parent 45fe44aa2f
commit 01a5d863ad

@ -627,91 +627,90 @@ namespace Action {
bool Print::printMetadatum(const Exiv2::Metadatum& md, const Exiv2::Image* pImage) bool Print::printMetadatum(const Exiv2::Metadatum& md, const Exiv2::Image* pImage)
{ {
if (!grepTag(md.key())) return false; if (!grepTag(md.key()))
if (!keyTag (md.key())) return false; return false;
if (!keyTag(md.key()))
return false;
if ( Params::instance().unknown_ if (Params::instance().unknown_ && md.tagName().substr(0, 2) == "0x") {
&& md.tagName().substr(0, 2) == "0x") {
return false; return false;
} }
bool const manyFiles = Params::instance().files_.size() > 1; bool const manyFiles = Params::instance().files_.size() > 1;
if (manyFiles) { if (manyFiles) {
std::cout << std::setfill(' ') << std::left << std::setw(20) std::cout << std::setfill(' ') << std::left << std::setw(20) << path_ << " ";
<< path_ << " ";
} }
bool first = true; bool first = true;
if (Params::instance().printItems_ & Params::prTag) { if (Params::instance().printItems_ & Params::prTag) {
if (!first) std::cout << " "; if (!first)
std::cout << " ";
first = false; first = false;
std::cout << "0x" << std::setw(4) << std::setfill('0') std::cout << "0x" << std::setw(4) << std::setfill('0') << std::right << std::hex << md.tag();
<< std::right << std::hex
<< md.tag();
} }
if (Params::instance().printItems_ & Params::prSet) { if (Params::instance().printItems_ & Params::prSet) {
if (!first) std::cout << " "; if (!first)
std::cout << " ";
first = false; first = false;
std::cout << "set" ; std::cout << "set";
} }
if (Params::instance().printItems_ & Params::prGroup) { if (Params::instance().printItems_ & Params::prGroup) {
if (!first) std::cout << " "; if (!first)
std::cout << " ";
first = false; first = false;
std::cout << std::setw(12) << std::setfill(' ') << std::left std::cout << std::setw(12) << std::setfill(' ') << std::left << md.groupName();
<< md.groupName();
} }
if (Params::instance().printItems_ & Params::prKey) { if (Params::instance().printItems_ & Params::prKey) {
if (!first) std::cout << " "; if (!first)
std::cout << " ";
first = false; first = false;
std::cout << std::setfill(' ') << std::left << std::setw(44) std::cout << std::setfill(' ') << std::left << std::setw(44) << md.key();
<< md.key();
} }
if (Params::instance().printItems_ & Params::prName) { if (Params::instance().printItems_ & Params::prName) {
if (!first) std::cout << " "; if (!first)
std::cout << " ";
first = false; first = false;
std::cout << std::setw(27) << std::setfill(' ') << std::left std::cout << std::setw(27) << std::setfill(' ') << std::left << md.tagName();
<< md.tagName();
} }
if (Params::instance().printItems_ & Params::prLabel) { if (Params::instance().printItems_ & Params::prLabel) {
if (!first) std::cout << " "; if (!first)
std::cout << " ";
first = false; first = false;
std::cout << std::setw(30) << std::setfill(' ') << std::left std::cout << std::setw(30) << std::setfill(' ') << std::left << md.tagLabel();
<< md.tagLabel();
} }
if (Params::instance().printItems_ & Params::prType) { if (Params::instance().printItems_ & Params::prType) {
if (!first) std::cout << " "; if (!first)
std::cout << " ";
first = false; first = false;
std::cout << std::setw(9) << std::setfill(' ') << std::left; std::cout << std::setw(9) << std::setfill(' ') << std::left;
const char* tn = md.typeName(); const char* tn = md.typeName();
if (tn) { if (tn) {
std::cout << tn; std::cout << tn;
} } else {
else {
std::ostringstream os; std::ostringstream os;
os << "0x" << std::setw(4) << std::setfill('0') << std::hex << md.typeId(); os << "0x" << std::setw(4) << std::setfill('0') << std::hex << md.typeId();
std::cout << os.str(); std::cout << os.str();
} }
} }
if (Params::instance().printItems_ & Params::prCount) { if (Params::instance().printItems_ & Params::prCount) {
if (!first) std::cout << " "; if (!first)
std::cout << " ";
first = false; first = false;
std::cout << std::dec << std::setw(3) std::cout << std::dec << std::setw(3) << std::setfill(' ') << std::right << md.count();
<< std::setfill(' ') << std::right
<< md.count();
} }
if (Params::instance().printItems_ & Params::prSize) { if (Params::instance().printItems_ & Params::prSize) {
if (!first) std::cout << " "; if (!first)
std::cout << " ";
first = false; first = false;
std::cout << std::dec << std::setw(3) std::cout << std::dec << std::setw(3) << std::setfill(' ') << std::right << md.size();
<< std::setfill(' ') << std::right
<< md.size();
} }
if (Params::instance().printItems_ & Params::prValue && md.size() > 0) { if (Params::instance().printItems_ & Params::prValue && md.size() > 0) {
if (!first) if (!first)
std::cout << " "; std::cout << " ";
first = false; first = false;
if (md.size() > 128 && Params::instance().binary_ && ( if (md.size() > 128 && Params::instance().binary_ &&
md.typeId() == Exiv2::undefined (md.typeId() == Exiv2::undefined || md.typeId() == Exiv2::unsignedByte ||
|| md.typeId() == Exiv2::unsignedByte md.typeId() == Exiv2::signedByte)) {
|| md.typeId() == Exiv2::signedByte)) {
std::cout << _("(Binary value suppressed)") << std::endl; std::cout << _("(Binary value suppressed)") << std::endl;
return true; return true;
} }
@ -729,22 +728,22 @@ namespace Action {
} }
if (!done) { if (!done) {
// #1114 - show negative values for SByte // #1114 - show negative values for SByte
if (md.typeId() != Exiv2::signedByte){ if (md.typeId() != Exiv2::signedByte) {
std::cout << std::dec << md.value(); std::cout << std::dec << md.value();
} else { } else {
int value = md.value().toLong(); int value = md.value().toLong();
std::cout << std::dec << (value<128?value:value-256); std::cout << std::dec << (value < 128 ? value : value - 256);
} }
} }
} }
if (Params::instance().printItems_ & Params::prTrans) { if (Params::instance().printItems_ & Params::prTrans) {
if (!first) std::cout << " "; if (!first)
std::cout << " ";
first = false; first = false;
if ( Params::instance().binary_ if (Params::instance().binary_ &&
&& ( md.typeId() == Exiv2::undefined (md.typeId() == Exiv2::undefined || md.typeId() == Exiv2::unsignedByte ||
|| md.typeId() == Exiv2::unsignedByte md.typeId() == Exiv2::signedByte) &&
|| md.typeId() == Exiv2::signedByte) md.size() > 128) {
&& md.size() > 128) {
std::cout << _("(Binary value suppressed)") << std::endl; std::cout << _("(Binary value suppressed)") << std::endl;
return true; return true;
} }
@ -756,16 +755,17 @@ namespace Action {
done = true; done = true;
} }
} }
if (!done) std::cout << std::dec << md.print(&pImage->exifData()); if (!done)
std::cout << std::dec << md.print(&pImage->exifData());
} }
if (Params::instance().printItems_ & Params::prHex) { if (Params::instance().printItems_ & Params::prHex) {
if (!first) std::cout << std::endl; if (!first)
std::cout << std::endl;
first = false; first = false;
if ( Params::instance().binary_ if (Params::instance().binary_ &&
&& ( md.typeId() == Exiv2::undefined (md.typeId() == Exiv2::undefined || md.typeId() == Exiv2::unsignedByte ||
|| md.typeId() == Exiv2::unsignedByte md.typeId() == Exiv2::signedByte) &&
|| md.typeId() == Exiv2::signedByte) md.size() > 128) {
&& md.size() > 128) {
std::cout << _("(Binary value suppressed)") << std::endl; std::cout << _("(Binary value suppressed)") << std::endl;
return true; return true;
} }
@ -775,7 +775,7 @@ namespace Action {
} }
std::cout << std::endl; std::cout << std::endl;
return true; return true;
} // Print::printMetadatum } // Print::printMetadatum
int Print::printComment() int Print::printComment()
{ {

Loading…
Cancel
Save