cpp: Get rid of AssuanResult due to its deprecation.
* lang/cpp/src/assuanresult.cpp: Remove. * lang/cpp/src/assuanresult.h: Remove. * lang/cpp/src/Makefile.am: Remove these files. * lang/cpp/src/context.cpp: Remove header assuanresult.h (assuanTransact): Change return type to Error. Use gpgme_op_assuan_transact_ext. (startAssuanTransaction): Change return type to Error. (assuanResult): Remove * lang/cpp/src/context.h (assuanResult): Adjust for changes. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
d2e40fb7ad
commit
e20b0f0201
@ -25,7 +25,7 @@ lib_LTLIBRARIES = libgpgmepp.la
|
|||||||
|
|
||||||
main_sources = \
|
main_sources = \
|
||||||
exception.cpp context.cpp key.cpp trustitem.cpp data.cpp callbacks.cpp \
|
exception.cpp context.cpp key.cpp trustitem.cpp data.cpp callbacks.cpp \
|
||||||
eventloopinteractor.cpp editinteractor.cpp assuanresult.cpp \
|
eventloopinteractor.cpp editinteractor.cpp \
|
||||||
keylistresult.cpp keygenerationresult.cpp importresult.cpp \
|
keylistresult.cpp keygenerationresult.cpp importresult.cpp \
|
||||||
decryptionresult.cpp verificationresult.cpp \
|
decryptionresult.cpp verificationresult.cpp \
|
||||||
signingresult.cpp encryptionresult.cpp \
|
signingresult.cpp encryptionresult.cpp \
|
||||||
@ -36,7 +36,7 @@ main_sources = \
|
|||||||
vfsmountresult.cpp configuration.cpp tofuinfo.cpp
|
vfsmountresult.cpp configuration.cpp tofuinfo.cpp
|
||||||
|
|
||||||
gpgmepp_headers = \
|
gpgmepp_headers = \
|
||||||
assuanresult.h configuration.h context.h data.h decryptionresult.h \
|
configuration.h context.h data.h decryptionresult.h \
|
||||||
defaultassuantransaction.h editinteractor.h encryptionresult.h \
|
defaultassuantransaction.h editinteractor.h encryptionresult.h \
|
||||||
engineinfo.h error.h eventloopinteractor.h exception.h global.h \
|
engineinfo.h error.h eventloopinteractor.h exception.h global.h \
|
||||||
gpgadduserideditinteractor.h gpgagentgetinfoassuantransaction.h \
|
gpgadduserideditinteractor.h gpgagentgetinfoassuantransaction.h \
|
||||||
|
@ -1,90 +0,0 @@
|
|||||||
/*
|
|
||||||
assuanresult.cpp - wraps a gpgme assuan result
|
|
||||||
Copyright (C) 2009 Klarälvdalens Datakonsult AB
|
|
||||||
|
|
||||||
This file is part of GPGME++.
|
|
||||||
|
|
||||||
GPGME++ is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
GPGME++ is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public License
|
|
||||||
along with GPGME++; see the file COPYING.LIB. If not, write to the
|
|
||||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <assuanresult.h>
|
|
||||||
#include "result_p.h"
|
|
||||||
|
|
||||||
#include <gpgme.h>
|
|
||||||
|
|
||||||
#include <istream>
|
|
||||||
|
|
||||||
using namespace GpgME;
|
|
||||||
|
|
||||||
class AssuanResult::Private
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit Private(const gpgme_assuan_result_t r)
|
|
||||||
{
|
|
||||||
if (!r) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
error = r->err;
|
|
||||||
}
|
|
||||||
|
|
||||||
gpgme_error_t error;
|
|
||||||
};
|
|
||||||
|
|
||||||
AssuanResult::AssuanResult(gpgme_ctx_t ctx, int error)
|
|
||||||
: Result(error), d()
|
|
||||||
{
|
|
||||||
init(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
AssuanResult::AssuanResult(gpgme_ctx_t ctx, const Error &error)
|
|
||||||
: Result(error), d()
|
|
||||||
{
|
|
||||||
init(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AssuanResult::init(gpgme_ctx_t ctx)
|
|
||||||
{
|
|
||||||
(void)ctx;
|
|
||||||
if (!ctx) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
gpgme_assuan_result_t res = gpgme_op_assuan_result(ctx);
|
|
||||||
if (!res) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
d.reset(new Private(res));
|
|
||||||
}
|
|
||||||
|
|
||||||
make_standard_stuff(AssuanResult)
|
|
||||||
|
|
||||||
Error AssuanResult::assuanError() const
|
|
||||||
{
|
|
||||||
if (d) {
|
|
||||||
return Error(d->error);
|
|
||||||
}
|
|
||||||
return Error();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream &GpgME::operator<<(std::ostream &os, const AssuanResult &result)
|
|
||||||
{
|
|
||||||
os << "GpgME::AssuanResult(";
|
|
||||||
if (!result.isNull()) {
|
|
||||||
os << "\n error: " << result.error()
|
|
||||||
<< "\n assuanError: " << result.assuanError()
|
|
||||||
<< "\n";
|
|
||||||
}
|
|
||||||
return os << ')';
|
|
||||||
}
|
|
@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
assuanresult.h - wraps a gpgme assuan result
|
|
||||||
Copyright (C) 2009 Klarälvdalens Datakonsult AB <info@kdab.com>
|
|
||||||
Author: Marc Mutz <marc@kdab.com>
|
|
||||||
|
|
||||||
This file is part of GPGME++.
|
|
||||||
|
|
||||||
GPGME++ is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
GPGME++ is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public License
|
|
||||||
along with GPGME++; see the file COPYING.LIB. If not, write to the
|
|
||||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GPGMEPP_ASSUANRESULT_H__
|
|
||||||
#define __GPGMEPP_ASSUANRESULT_H__
|
|
||||||
|
|
||||||
#include "gpgmefw.h"
|
|
||||||
#include "result.h"
|
|
||||||
#include "gpgmepp_export.h"
|
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <iosfwd>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
namespace GpgME
|
|
||||||
{
|
|
||||||
|
|
||||||
class Error;
|
|
||||||
|
|
||||||
class GPGMEPP_EXPORT AssuanResult : public Result
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
AssuanResult();
|
|
||||||
AssuanResult(gpgme_ctx_t ctx, int error);
|
|
||||||
AssuanResult(gpgme_ctx_t ctx, const Error &error);
|
|
||||||
explicit AssuanResult(const Error &err);
|
|
||||||
|
|
||||||
const AssuanResult &operator=(AssuanResult other)
|
|
||||||
{
|
|
||||||
swap(other);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void swap(AssuanResult &other)
|
|
||||||
{
|
|
||||||
Result::swap(other);
|
|
||||||
using std::swap;
|
|
||||||
swap(this->d, other.d);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isNull() const;
|
|
||||||
|
|
||||||
Error assuanError() const;
|
|
||||||
|
|
||||||
class Private;
|
|
||||||
private:
|
|
||||||
void init(gpgme_ctx_t ctx);
|
|
||||||
std::shared_ptr<Private> d;
|
|
||||||
};
|
|
||||||
|
|
||||||
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const AssuanResult &result);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(AssuanResult)
|
|
||||||
|
|
||||||
#endif // __GPGMEPP_ASSUANRESULT_H__
|
|
@ -23,7 +23,6 @@
|
|||||||
#include <context.h>
|
#include <context.h>
|
||||||
#include <eventloopinteractor.h>
|
#include <eventloopinteractor.h>
|
||||||
#include <trustitem.h>
|
#include <trustitem.h>
|
||||||
#include <assuanresult.h>
|
|
||||||
#include <keylistresult.h>
|
#include <keylistresult.h>
|
||||||
#include <keygenerationresult.h>
|
#include <keygenerationresult.h>
|
||||||
#include <importresult.h>
|
#include <importresult.h>
|
||||||
@ -801,26 +800,36 @@ static gpgme_error_t assuan_transaction_status_callback(void *opaque, const char
|
|||||||
return t->status(status, a.c_str()).encodedError();
|
return t->status(status, a.c_str()).encodedError();
|
||||||
}
|
}
|
||||||
|
|
||||||
AssuanResult Context::assuanTransact(const char *command)
|
Error Context::assuanTransact(const char *command)
|
||||||
{
|
{
|
||||||
return assuanTransact(command, std::unique_ptr<AssuanTransaction>(new DefaultAssuanTransaction));
|
return assuanTransact(command, std::unique_ptr<AssuanTransaction>(new DefaultAssuanTransaction));
|
||||||
}
|
}
|
||||||
|
|
||||||
AssuanResult Context::assuanTransact(const char *command, std::unique_ptr<AssuanTransaction> transaction)
|
Error Context::assuanTransact(const char *command, std::unique_ptr<AssuanTransaction> transaction)
|
||||||
{
|
{
|
||||||
|
gpgme_error_t err, operr;
|
||||||
|
|
||||||
d->lastop = Private::AssuanTransact;
|
d->lastop = Private::AssuanTransact;
|
||||||
d->lastAssuanTransaction = std::move(transaction);
|
d->lastAssuanTransaction = std::move(transaction);
|
||||||
if (!d->lastAssuanTransaction.get()) {
|
if (!d->lastAssuanTransaction.get()) {
|
||||||
return AssuanResult(Error(d->lasterr = make_error(GPG_ERR_INV_ARG)));
|
return Error(d->lasterr = make_error(GPG_ERR_INV_ARG));
|
||||||
}
|
}
|
||||||
d->lasterr = gpgme_op_assuan_transact(d->ctx, command,
|
err = gpgme_op_assuan_transact_ext
|
||||||
|
(d->ctx,
|
||||||
|
command,
|
||||||
assuan_transaction_data_callback,
|
assuan_transaction_data_callback,
|
||||||
d->lastAssuanTransaction.get(),
|
d->lastAssuanTransaction.get(),
|
||||||
assuan_transaction_inquire_callback,
|
assuan_transaction_inquire_callback,
|
||||||
d, // sic!
|
d,
|
||||||
assuan_transaction_status_callback,
|
assuan_transaction_status_callback,
|
||||||
d->lastAssuanTransaction.get());
|
d->lastAssuanTransaction.get(),
|
||||||
return AssuanResult(d->ctx, d->lasterr);
|
&operr);
|
||||||
|
|
||||||
|
if (!err)
|
||||||
|
err = operr;
|
||||||
|
d->lasterr = err;
|
||||||
|
|
||||||
|
return Error(d->lasterr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Error Context::startAssuanTransaction(const char *command)
|
Error Context::startAssuanTransaction(const char *command)
|
||||||
@ -830,27 +839,26 @@ Error Context::startAssuanTransaction(const char *command)
|
|||||||
|
|
||||||
Error Context::startAssuanTransaction(const char *command, std::unique_ptr<AssuanTransaction> transaction)
|
Error Context::startAssuanTransaction(const char *command, std::unique_ptr<AssuanTransaction> transaction)
|
||||||
{
|
{
|
||||||
|
gpgme_error_t err;
|
||||||
|
|
||||||
d->lastop = Private::AssuanTransact;
|
d->lastop = Private::AssuanTransact;
|
||||||
d->lastAssuanTransaction = std::move(transaction);
|
d->lastAssuanTransaction = std::move(transaction);
|
||||||
if (!d->lastAssuanTransaction.get()) {
|
if (!d->lastAssuanTransaction.get()) {
|
||||||
return Error(d->lasterr = make_error(GPG_ERR_INV_ARG));
|
return Error(d->lasterr = make_error(GPG_ERR_INV_ARG));
|
||||||
}
|
}
|
||||||
return Error(d->lasterr = gpgme_op_assuan_transact_start(d->ctx, command,
|
err = gpgme_op_assuan_transact_start
|
||||||
|
(d->ctx,
|
||||||
|
command,
|
||||||
assuan_transaction_data_callback,
|
assuan_transaction_data_callback,
|
||||||
d->lastAssuanTransaction.get(),
|
d->lastAssuanTransaction.get(),
|
||||||
assuan_transaction_inquire_callback,
|
assuan_transaction_inquire_callback,
|
||||||
d, // sic!
|
d,
|
||||||
assuan_transaction_status_callback,
|
assuan_transaction_status_callback,
|
||||||
d->lastAssuanTransaction.get()));
|
d->lastAssuanTransaction.get());
|
||||||
}
|
|
||||||
|
|
||||||
AssuanResult Context::assuanResult() const
|
d->lasterr = err;
|
||||||
{
|
|
||||||
if (d->lastop & Private::AssuanTransact) {
|
return Error(d->lasterr);
|
||||||
return AssuanResult(d->ctx, d->lasterr);
|
|
||||||
} else {
|
|
||||||
return AssuanResult();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AssuanTransaction *Context::lastAssuanTransaction() const
|
AssuanTransaction *Context::lastAssuanTransaction() const
|
||||||
|
@ -46,7 +46,6 @@ class EventLoopInteractor;
|
|||||||
class EditInteractor;
|
class EditInteractor;
|
||||||
class AssuanTransaction;
|
class AssuanTransaction;
|
||||||
|
|
||||||
class AssuanResult;
|
|
||||||
class KeyListResult;
|
class KeyListResult;
|
||||||
class KeyGenerationResult;
|
class KeyGenerationResult;
|
||||||
class ImportResult;
|
class ImportResult;
|
||||||
@ -240,11 +239,10 @@ public:
|
|||||||
// Assuan Transactions
|
// Assuan Transactions
|
||||||
//
|
//
|
||||||
|
|
||||||
AssuanResult assuanTransact(const char *command, std::unique_ptr<AssuanTransaction> transaction);
|
GpgME::Error assuanTransact(const char *command, std::unique_ptr<AssuanTransaction> transaction);
|
||||||
AssuanResult assuanTransact(const char *command);
|
GpgME::Error assuanTransact(const char *command);
|
||||||
GpgME::Error startAssuanTransaction(const char *command, std::unique_ptr<AssuanTransaction> transaction);
|
GpgME::Error startAssuanTransaction(const char *command, std::unique_ptr<AssuanTransaction> transaction);
|
||||||
GpgME::Error startAssuanTransaction(const char *command);
|
GpgME::Error startAssuanTransaction(const char *command);
|
||||||
AssuanResult assuanResult() const;
|
|
||||||
|
|
||||||
AssuanTransaction *lastAssuanTransaction() const;
|
AssuanTransaction *lastAssuanTransaction() const;
|
||||||
std::unique_ptr<AssuanTransaction> takeLastAssuanTransaction();
|
std::unique_ptr<AssuanTransaction> takeLastAssuanTransaction();
|
||||||
|
@ -73,4 +73,4 @@ GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const VfsMountResult &
|
|||||||
|
|
||||||
GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(VfsMountResult)
|
GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(VfsMountResult)
|
||||||
|
|
||||||
#endif // __GPGMEPP_ASSUANRESULT_H__
|
#endif // __GPGMEPP_VFSMOUNTRESULT_H__
|
||||||
|
Loading…
Reference in New Issue
Block a user