libkdenetwork Library API Documentation

keygenerationresult.cpp

00001 /* keygenerationresult.cpp - wraps a gpgme keygen result
00002    Copyright (C) 2004 Klarälvdalens Datakonsult AB
00003 
00004    This file is part of GPGME++.
00005  
00006    GPGME++ is free software; you can redistribute it and/or modify it
00007    under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010  
00011    GPGME++ is distributed in the hope that it will be useful, but
00012    WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with GPGME++; if not, write to the Free Software Foundation,
00018    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA.
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 }
KDE Logo
This file is part of the documentation for libkdenetwork Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Aug 23 18:18:10 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003