cpp: Improve debug output of some enums
* lang/cpp/src/verificationresult.cpp (operator<<): Fix output of Signature::PKAStatus which doesn't represent flags. Print corresponding name of enum value if Signature::Summary or Notation::Flags are 0. -- GnuPG-bug-id: 6368
This commit is contained in:
parent
7098c14b23
commit
3aaed9cfbf
@ -544,32 +544,41 @@ std::ostream &GpgME::operator<<(std::ostream &os, const VerificationResult &resu
|
|||||||
|
|
||||||
std::ostream &GpgME::operator<<(std::ostream &os, Signature::PKAStatus pkaStatus)
|
std::ostream &GpgME::operator<<(std::ostream &os, Signature::PKAStatus pkaStatus)
|
||||||
{
|
{
|
||||||
#define OUTPUT( x ) if ( !(pkaStatus & (GpgME::Signature:: x)) ) {} else do { os << #x " "; } while(0)
|
|
||||||
os << "GpgME::Signature::PKAStatus(";
|
os << "GpgME::Signature::PKAStatus(";
|
||||||
OUTPUT(UnknownPKAStatus);
|
switch (pkaStatus) {
|
||||||
OUTPUT(PKAVerificationFailed);
|
#define OUTPUT( x ) case GpgME::Signature:: x: os << #x; break
|
||||||
OUTPUT(PKAVerificationSucceeded);
|
OUTPUT(UnknownPKAStatus);
|
||||||
|
OUTPUT(PKAVerificationFailed);
|
||||||
|
OUTPUT(PKAVerificationSucceeded);
|
||||||
#undef OUTPUT
|
#undef OUTPUT
|
||||||
|
default:
|
||||||
|
os << "??? (" << static_cast<int>(pkaStatus) << ')';
|
||||||
|
break;
|
||||||
|
}
|
||||||
return os << ')';
|
return os << ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream &GpgME::operator<<(std::ostream &os, Signature::Summary summary)
|
std::ostream &GpgME::operator<<(std::ostream &os, Signature::Summary summary)
|
||||||
{
|
{
|
||||||
#define OUTPUT( x ) if ( !(summary & (GpgME::Signature:: x)) ) {} else do { os << #x " "; } while(0)
|
|
||||||
os << "GpgME::Signature::Summary(";
|
os << "GpgME::Signature::Summary(";
|
||||||
OUTPUT(Valid);
|
if (summary == Signature::None) {
|
||||||
OUTPUT(Green);
|
os << "None";
|
||||||
OUTPUT(Red);
|
} else {
|
||||||
OUTPUT(KeyRevoked);
|
#define OUTPUT( x ) if ( !(summary & (GpgME::Signature:: x)) ) {} else do { os << #x " "; } while(0)
|
||||||
OUTPUT(KeyExpired);
|
OUTPUT(Valid);
|
||||||
OUTPUT(SigExpired);
|
OUTPUT(Green);
|
||||||
OUTPUT(KeyMissing);
|
OUTPUT(Red);
|
||||||
OUTPUT(CrlMissing);
|
OUTPUT(KeyRevoked);
|
||||||
OUTPUT(CrlTooOld);
|
OUTPUT(KeyExpired);
|
||||||
OUTPUT(BadPolicy);
|
OUTPUT(SigExpired);
|
||||||
OUTPUT(SysError);
|
OUTPUT(KeyMissing);
|
||||||
OUTPUT(TofuConflict);
|
OUTPUT(CrlMissing);
|
||||||
|
OUTPUT(CrlTooOld);
|
||||||
|
OUTPUT(BadPolicy);
|
||||||
|
OUTPUT(SysError);
|
||||||
|
OUTPUT(TofuConflict);
|
||||||
#undef OUTPUT
|
#undef OUTPUT
|
||||||
|
}
|
||||||
return os << ')';
|
return os << ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -603,10 +612,14 @@ std::ostream &GpgME::operator<<(std::ostream &os, const Signature &sig)
|
|||||||
std::ostream &GpgME::operator<<(std::ostream &os, Notation::Flags flags)
|
std::ostream &GpgME::operator<<(std::ostream &os, Notation::Flags flags)
|
||||||
{
|
{
|
||||||
os << "GpgME::Notation::Flags(";
|
os << "GpgME::Notation::Flags(";
|
||||||
|
if (flags == Notation::NoFlags) {
|
||||||
|
os << "NoFlags";
|
||||||
|
} else {
|
||||||
#define OUTPUT( x ) if ( !(flags & (GpgME::Notation:: x)) ) {} else do { os << #x " "; } while(0)
|
#define OUTPUT( x ) if ( !(flags & (GpgME::Notation:: x)) ) {} else do { os << #x " "; } while(0)
|
||||||
OUTPUT(HumanReadable);
|
OUTPUT(HumanReadable);
|
||||||
OUTPUT(Critical);
|
OUTPUT(Critical);
|
||||||
#undef OUTPUT
|
#undef OUTPUT
|
||||||
|
}
|
||||||
return os << ')';
|
return os << ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user