keylistresult.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/keylistresult.h>
00026 #include "shared.h"
00027 #include "result_p.h"
00028
00029 #include <gpgme.h>
00030
00031 #include <cstring>
00032
00033 class GpgME::KeyListResult::Private : public GpgME::Shared {
00034 public:
00035 Private( const _gpgme_op_keylist_result & r ) : Shared(), res( r ) {}
00036 Private( const Private & other ) : Shared(), res( other.res ) {}
00037
00038 _gpgme_op_keylist_result res;
00039 };
00040
00041 GpgME::KeyListResult::KeyListResult( gpgme_ctx_t ctx, int error )
00042 : GpgME::Result( error ), d( 0 )
00043 {
00044 if ( error || !ctx )
00045 return;
00046 gpgme_keylist_result_t res = gpgme_op_keylist_result( ctx );
00047 if ( !res )
00048 return;
00049 d = new Private( *res );
00050 d->ref();
00051 }
00052
00053 GpgME::KeyListResult::KeyListResult( const Error & error, const _gpgme_op_keylist_result & res )
00054 : GpgME::Result( error ), d( 0 )
00055 {
00056 d = new Private( res );
00057 d->ref();
00058 }
00059
00060 make_standard_stuff(KeyListResult);
00061
00062 void GpgME::KeyListResult::detach() {
00063 if ( isNull() || d->refCount() <= 1 )
00064 return;
00065 d->unref();
00066 d = new Private( *d );
00067 }
00068
00069 void GpgME::KeyListResult::mergeWith( const KeyListResult & other ) {
00070 if ( other.isNull() )
00071 return;
00072 if ( isNull() ) {
00073 operator=( other );
00074 return;
00075 }
00076
00077 if ( other.d->res.truncated && !d->res.truncated ) {
00078 detach();
00079 d->res.truncated = true;
00080 }
00081 if ( !error() )
00082 Result::operator=( other );
00083 }
00084
00085 bool GpgME::KeyListResult::isTruncated() const {
00086 return d && d->res.truncated;
00087 }
This file is part of the documentation for libkdenetwork Library Version 3.3.0.