cpp: Add ostream operators for import result
* lang/cpp/src/importresult.cpp: Add ostream operators. * lang/cpp/src/importresult.h: Update accordingly.
This commit is contained in:
parent
6175025c82
commit
73b2f40ae5
@ -35,6 +35,9 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <strings.h>
|
||||||
|
#include <istream>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
class GpgME::ImportResult::Private
|
class GpgME::ImportResult::Private
|
||||||
{
|
{
|
||||||
@ -224,3 +227,42 @@ GpgME::Import::Status GpgME::Import::status() const
|
|||||||
}
|
}
|
||||||
return static_cast<Status>(result);
|
return static_cast<Status>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ostream &GpgME::operator<<(std::ostream &os,
|
||||||
|
const GpgME::ImportResult &result)
|
||||||
|
{
|
||||||
|
os << "GpgME::ImportResult(";
|
||||||
|
if (!result.isNull()) {
|
||||||
|
os << "\n considered: " << result.numConsidered()
|
||||||
|
<< "\n without UID: " << result.numKeysWithoutUserID()
|
||||||
|
<< "\n imported: " << result.numImported()
|
||||||
|
<< "\n RSA Imported: " << result.numRSAImported()
|
||||||
|
<< "\n unchanged: " << result.numUnchanged()
|
||||||
|
<< "\n newUserIDs: " << result.newUserIDs()
|
||||||
|
<< "\n newSubkeys: " << result.newSubkeys()
|
||||||
|
<< "\n newSignatures: " << result.newSignatures()
|
||||||
|
<< "\n newRevocations: " << result.newRevocations()
|
||||||
|
<< "\n numSecretKeysConsidered: " << result.numSecretKeysConsidered()
|
||||||
|
<< "\n numSecretKeysImported: " << result.numSecretKeysImported()
|
||||||
|
<< "\n numSecretKeysUnchanged: " << result.numSecretKeysUnchanged()
|
||||||
|
<< "\n"
|
||||||
|
<< "\n notImported: " << result.notImported()
|
||||||
|
<< "\n numV3KeysSkipped: " << result.numV3KeysSkipped()
|
||||||
|
<< "\n imports:\n";
|
||||||
|
const std::vector<Import> imp = result.imports();
|
||||||
|
std::copy(imp.begin(), imp.end(),
|
||||||
|
std::ostream_iterator<Import>(os, "\n"));
|
||||||
|
}
|
||||||
|
return os << ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream &GpgME::operator<<(std::ostream &os, const GpgME::Import &imp)
|
||||||
|
{
|
||||||
|
os << "GpgME::Import(";
|
||||||
|
if (!imp.isNull()) {
|
||||||
|
os << "\n fpr: " << (imp.fingerprint() ? imp.fingerprint() : "null")
|
||||||
|
<< "\n status: " << imp.status()
|
||||||
|
<< "\n err: " << imp.error();
|
||||||
|
}
|
||||||
|
return os << ')';
|
||||||
|
}
|
||||||
|
@ -129,7 +129,10 @@ private:
|
|||||||
unsigned int idx;
|
unsigned int idx;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const ImportResult &irs);
|
||||||
|
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Import &imp);
|
||||||
|
|
||||||
|
} // namespace GpgME
|
||||||
|
|
||||||
GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(ImportResult)
|
GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(ImportResult)
|
||||||
GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(Import)
|
GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(Import)
|
||||||
|
Loading…
Reference in New Issue
Block a user