engineinfo.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 "engineinfo.h"
00026 #include "shared.h"
00027
00028 #include <gpgme.h>
00029
00030 struct GpgME::EngineInfo::Private : public GpgME::Shared {
00031 Private( gpgme_engine_info_t engine=0 ) : Shared(), info( engine ) {}
00032 ~Private() { info = 0; }
00033
00034 gpgme_engine_info_t info;
00035 };
00036
00037
00038 GpgME::EngineInfo::EngineInfo() : d(0) {}
00039
00040 GpgME::EngineInfo::EngineInfo( gpgme_engine_info_t engine )
00041 : d(0)
00042 {
00043 d = new Private( engine );
00044 d->ref();
00045 }
00046
00047 GpgME::EngineInfo::EngineInfo( const EngineInfo & other )
00048 : d( other.d )
00049 {
00050 if ( d )
00051 d->ref();
00052 }
00053
00054
00055 GpgME::EngineInfo::~EngineInfo() {
00056 if ( d )
00057 d->deref();
00058 }
00059
00060 const GpgME::EngineInfo & GpgME::EngineInfo::operator=( const GpgME::EngineInfo & other ) {
00061 if ( this->d == other.d )
00062 return *this;
00063
00064 if ( other.d )
00065 other.d->ref();
00066 if ( this->d )
00067 this->d->unref();
00068
00069 this->d = other.d;
00070 return *this;
00071 }
00072
00073 bool GpgME::EngineInfo::isNull() const {
00074 return !d || !d->info;
00075 }
00076
00077 GpgME::Context::Protocol GpgME::EngineInfo::protocol() const {
00078 if ( isNull() )
00079 return Context::Unknown;
00080 switch( d->info->protocol ) {
00081 case GPGME_PROTOCOL_OpenPGP: return Context::OpenPGP;
00082 case GPGME_PROTOCOL_CMS: return Context::CMS;
00083 default:
00084 return Context::Unknown;
00085 }
00086 }
00087
00088 const char * GpgME::EngineInfo::fileName() const {
00089 return isNull() ? 0 : d->info->file_name;
00090 }
00091
00092 const char * GpgME::EngineInfo::version() const {
00093 return isNull() ? 0 : d->info->version;
00094 }
00095
00096 const char * GpgME::EngineInfo::requiredVersion() const {
00097 return isNull() ? 0 : d->info->req_version;
00098 }
00099
This file is part of the documentation for libkdenetwork Library Version 3.3.2.