decryptionresult.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifdef HAVE_CONFIG_H
00022 #include <config.h>
00023 #endif
00024
00025 #include <gpgmepp/decryptionresult.h>
00026 #include "shared.h"
00027 #include "result_p.h"
00028
00029 #include <gpgme.h>
00030
00031 #include <cstring>
00032 #include <cstdlib>
00033
00034 class GpgME::DecryptionResult::Private : public GpgME::Shared {
00035 public:
00036 Private( const _gpgme_op_decrypt_result & r ) : Shared(), res( r ) {
00037 if ( res.unsupported_algorithm )
00038 res.unsupported_algorithm = strdup( res.unsupported_algorithm );
00039 }
00040 ~Private() {
00041 if ( res.unsupported_algorithm )
00042 std::free( res.unsupported_algorithm );
00043 res.unsupported_algorithm = 0;
00044 }
00045
00046 _gpgme_op_decrypt_result res;
00047 };
00048
00049 GpgME::DecryptionResult::DecryptionResult( gpgme_ctx_t ctx, int error )
00050 : GpgME::Result( error ), d( 0 )
00051 {
00052 if ( error || !ctx )
00053 return;
00054 gpgme_decrypt_result_t res = gpgme_op_decrypt_result( ctx );
00055 if ( !res )
00056 return;
00057 d = new Private( *res );
00058 d->ref();
00059 }
00060
00061 make_standard_stuff(DecryptionResult)
00062
00063 const char * GpgME::DecryptionResult::unsupportedAlgortihm() const {
00064 return d ? d->res.unsupported_algorithm : 0 ;
00065 }
00066
00067 bool GpgME::DecryptionResult::wrongKeyUsage() const {
00068 #ifdef HAVE_GPGME_WRONG_KEY_USAGE
00069 if ( d )
00070 return d->res.wrong_key_usage;
00071 #endif
00072 return false;
00073 }
This file is part of the documentation for libkdenetwork Library Version 3.3.2.