keygenerationresult.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/keygenerationresult.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::KeyGenerationResult::Private : public GpgME::Shared {
00035 public:
00036 Private( const _gpgme_op_genkey_result & r ) : Shared(), res( r ) {
00037 if ( res.fpr )
00038 res.fpr = strdup( res.fpr );
00039 }
00040 ~Private() {
00041 if ( res.fpr )
00042 std::free( res.fpr );
00043 res.fpr = 0;
00044 }
00045
00046 _gpgme_op_genkey_result res;
00047 };
00048
00049 GpgME::KeyGenerationResult::KeyGenerationResult( gpgme_ctx_t ctx, int error )
00050 : GpgME::Result( error ), d( 0 )
00051 {
00052 if ( error || !ctx )
00053 return;
00054 gpgme_genkey_result_t res = gpgme_op_genkey_result( ctx );
00055 if ( !res )
00056 return;
00057 d = new Private( *res );
00058 d->ref();
00059 }
00060
00061 make_standard_stuff(KeyGenerationResult)
00062
00063 bool GpgME::KeyGenerationResult::primaryKeyGenerated() const {
00064 return d && d->res.primary;
00065 }
00066
00067 bool GpgME::KeyGenerationResult::subkeyGenerated() const {
00068 return d && d->res.sub;
00069 }
00070
00071 const char * GpgME::KeyGenerationResult::fingerprint() const {
00072 return d ? d->res.fpr : 0 ;
00073 }
This file is part of the documentation for libkdenetwork Library Version 3.3.2.