From 261245a2e0e76568607c79a0c80372cb6f46444e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Fri, 27 Jan 2023 09:37:05 +0100 Subject: [PATCH] cpp: Add convenience overload to set file name * lang/cpp/src/data.h, lang/cpp/src/data.cpp (setFileName): Add overload. -- GnuPG-bug-id: 6342 --- NEWS | 1 + lang/cpp/src/data.cpp | 5 +++++ lang/cpp/src/data.h | 1 + 3 files changed, 7 insertions(+) diff --git a/NEWS b/NEWS index 365d4f95..4830dd51 100644 --- a/NEWS +++ b/NEWS @@ -42,6 +42,7 @@ Noteworthy changes in version 1.18.1 (unreleased) gpgme_op_verify_ext NEW. cpp: GpgGenCardKeyInteractor::Curve NEW. cpp: GpgGenCardKeyInteractor::setCurve NEW. + cpp: Data::setFileName EXTENDED: New overload qt: ListAllKeysJob::Option NEW. qt: ListAllKeysJob::Options NEW. qt: ListAllKeysJob::setOptions NEW. diff --git a/lang/cpp/src/data.cpp b/lang/cpp/src/data.cpp index 7a93cbc2..dd8b1740 100644 --- a/lang/cpp/src/data.cpp +++ b/lang/cpp/src/data.cpp @@ -217,6 +217,11 @@ GpgME::Error GpgME::Data::setFileName(const char *name) return Error(gpgme_data_set_file_name(d->data, name)); } +GpgME::Error GpgME::Data::setFileName(const std::string &name) +{ + return Error(gpgme_data_set_file_name(d->data, name.c_str())); +} + ssize_t GpgME::Data::read(void *buffer, size_t length) { return gpgme_data_read(d->data, buffer, length); diff --git a/lang/cpp/src/data.h b/lang/cpp/src/data.h index 649e4104..9a5d5b0c 100644 --- a/lang/cpp/src/data.h +++ b/lang/cpp/src/data.h @@ -106,6 +106,7 @@ public: char *fileName() const; Error setFileName(const char *name); + Error setFileName(const std::string &name); ssize_t read(void *buffer, size_t length); ssize_t write(const void *buffer, size_t length);