Line data Source code
1 : /*
2 : engineinfo.h
3 : Copyright (C) 2004 Klarälvdalens Datakonsult AB
4 :
5 : This file is part of GPGME++.
6 :
7 : GPGME++ is free software; you can redistribute it and/or
8 : modify it under the terms of the GNU Library General Public
9 : License as published by the Free Software Foundation; either
10 : version 2 of the License, or (at your option) any later version.
11 :
12 : GPGME++ is distributed in the hope that it will be useful,
13 : but WITHOUT ANY WARRANTY; without even the implied warranty of
14 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 : GNU Library General Public License for more details.
16 :
17 : You should have received a copy of the GNU Library General Public License
18 : along with GPGME++; see the file COPYING.LIB. If not, write to the
19 : Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 : Boston, MA 02110-1301, USA.
21 : */
22 :
23 : #include "engineinfo.h"
24 :
25 : #include <gpgme.h>
26 :
27 : class GpgME::EngineInfo::Private
28 : {
29 : public:
30 6 : Private(gpgme_engine_info_t engine = 0) : info(engine) {}
31 6 : ~Private()
32 : {
33 6 : info = 0;
34 6 : }
35 :
36 : gpgme_engine_info_t info;
37 : };
38 :
39 0 : GpgME::EngineInfo::EngineInfo() : d() {}
40 :
41 6 : GpgME::EngineInfo::EngineInfo(gpgme_engine_info_t engine)
42 6 : : d(new Private(engine))
43 : {
44 :
45 6 : }
46 :
47 6 : bool GpgME::EngineInfo::isNull() const
48 : {
49 6 : return !d || !d->info;
50 : }
51 :
52 0 : GpgME::Protocol GpgME::EngineInfo::protocol() const
53 : {
54 0 : if (isNull()) {
55 0 : return UnknownProtocol;
56 : }
57 0 : switch (d->info->protocol) {
58 0 : case GPGME_PROTOCOL_OpenPGP: return OpenPGP;
59 0 : case GPGME_PROTOCOL_CMS: return CMS;
60 : default:
61 0 : return UnknownProtocol;
62 : }
63 : }
64 :
65 0 : const char *GpgME::EngineInfo::fileName() const
66 : {
67 0 : return isNull() ? 0 : d->info->file_name;
68 : }
69 :
70 6 : const char *GpgME::EngineInfo::version() const
71 : {
72 6 : return isNull() ? 0 : d->info->version;
73 : }
74 :
75 6 : GpgME::EngineInfo::Version GpgME::EngineInfo::engineVersion() const
76 : {
77 6 : return Version(version());
78 : }
79 :
80 0 : const char *GpgME::EngineInfo::requiredVersion() const
81 : {
82 0 : return isNull() ? 0 : d->info->req_version;
83 : }
84 :
85 0 : const char *GpgME::EngineInfo::homeDirectory() const
86 : {
87 0 : return isNull() ? 0 : d->info->home_dir;
88 18 : }
|