diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-01 00:37:02 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-01 00:37:02 +0000 |
commit | cc29364f06178f8f6b457384f2ec37a042bd9d43 (patch) | |
tree | 7c77a3184c698bbf9d98cef09fb1ba8124daceba /libkdenetwork/gpgmepp/context.cpp | |
parent | 4f6c584bacc8c3c694228f36ada3de77a76614a6 (diff) | |
download | tdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.tar.gz tdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.zip |
* Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch
* Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed
* Added journal read support to the CalDAV resource
* Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkdenetwork/gpgmepp/context.cpp')
-rw-r--r-- | libkdenetwork/gpgmepp/context.cpp | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/libkdenetwork/gpgmepp/context.cpp b/libkdenetwork/gpgmepp/context.cpp index c0286fcbd..547adde95 100644 --- a/libkdenetwork/gpgmepp/context.cpp +++ b/libkdenetwork/gpgmepp/context.cpp @@ -43,6 +43,7 @@ //#include <string> //using std::string; +#include <istream> #ifndef NDEBUG #include <iostream> using std::cerr; @@ -77,6 +78,10 @@ namespace GpgME { return code() == GPG_ERR_CANCELED; } + std::ostream & operator<<( std::ostream & os, Error err ) { + return os << "GpgME::Error(" << err.operator int() << " (" << err.asString() << "))"; + } + Context::Context( gpgme_ctx_t ctx ) { d = new Private( ctx ); } @@ -628,6 +633,89 @@ namespace GpgME { return d->lasterr; } + std::ostream & operator<<( std::ostream & os, Context::Protocol proto ) { + os << "GpgME::Context::Protocol("; + switch ( proto ) { + case Context::OpenPGP: + os << "OpenPGP"; + break; + case Context::CMS: + os << "CMS"; + break; + default: + case Context::Unknown: + os << "Unknown"; + break; + } + return os << ')'; + } + + std::ostream & operator<<( std::ostream & os, Context::CertificateInclusion incl ) { + os << "GpgME::Context::CertificateInclusion(" << static_cast<int>( incl ); + switch ( incl ) { + case Context::DefaultCertificates: + os << "(DefaultCertificates)"; + break; + case Context::AllCertificatesExceptRoot: + os << "(AllCertificatesExceptRoot)"; + break; + case Context::AllCertificates: + os << "(AllCertificates)"; + break; + case Context::NoCertificates: + os << "(NoCertificates)"; + break; + case Context::OnlySenderCertificate: + os << "(OnlySenderCertificate)"; + break; + } + return os << ')'; + } + + std::ostream & operator<<( std::ostream & os, Context::KeyListMode mode ) { + os << "GpgME::Context::KeyListMode("; +#define CHECK( x ) if ( !(mode & (Context::x)) ) {} else do { os << #x " "; } while (0) + CHECK( Local ); + CHECK( Extern ); + CHECK( Signatures ); + CHECK( Validate ); +#undef CHECK + return os << ')'; + } + + std::ostream & operator<<( std::ostream & os, Context::SignatureMode mode ) { + os << "GpgME::Context::SignatureMode("; + switch ( mode ) { +#define CHECK( x ) case Context::x: os << #x; break + CHECK( Normal ); + CHECK( Detached ); + CHECK( Clearsigned ); +#undef CHECK + default: + os << "???" "(" << static_cast<int>( mode ) << ')'; + break; + } + return os << ')'; + } + + std::ostream & operator<<( std::ostream & os, Context::EncryptionFlags flags ) { + os << "GpgME::Context::EncryptionFlags("; +#define CHECK( x ) if ( !(flags & (Context::x)) ) {} else do { os << #x " "; } while (0) + CHECK( AlwaysTrust ); +#undef CHECK + return os << ')'; + } + + std::ostream & operator<<( std::ostream & os, Context::AuditLogFlags flags ) { + os << "GpgME::Context::AuditLogFlags("; +#define CHECK( x ) if ( !(flags & (Context::x)) ) {} else do { os << #x " "; } while (0) + CHECK( HtmlAuditLog ); + CHECK( AuditLogWithHelp ); +#undef CHECK + return os << ')'; + } + + } // namespace GpgME |