diff options
author | Saturneric <[email protected]> | 2021-10-02 14:08:50 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-10-02 14:16:27 +0000 |
commit | 3c65d087eeee687ac01af2e80f3dd538f9a2c230 (patch) | |
tree | 1e860dc6343c1897e2224a002f2ca44c574381b3 /src/gpg/model/GpgSubKey.h | |
parent | The basic functions of the core pass the test. (diff) | |
download | GpgFrontend-3c65d087eeee687ac01af2e80f3dd538f9a2c230.tar.gz GpgFrontend-3c65d087eeee687ac01af2e80f3dd538f9a2c230.zip |
UI Framework Modified.
Diffstat (limited to '')
-rw-r--r-- | src/gpg/model/GpgSubKey.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/gpg/model/GpgSubKey.h b/src/gpg/model/GpgSubKey.h index c251141b..edb52f44 100644 --- a/src/gpg/model/GpgSubKey.h +++ b/src/gpg/model/GpgSubKey.h @@ -32,7 +32,7 @@ namespace GpgFrontend { class GpgSubKey { -public: + public: [[nodiscard]] std::string id() const { return _subkey_ref->keyid; } [[nodiscard]] std::string fpr() const { return _subkey_ref->fpr; } @@ -77,24 +77,26 @@ public: explicit GpgSubKey(gpgme_subkey_t subkey); - GpgSubKey(GpgSubKey &&o) noexcept { swap(_subkey_ref, o._subkey_ref); } + GpgSubKey(GpgSubKey&& o) noexcept { swap(_subkey_ref, o._subkey_ref); } - GpgSubKey(const GpgSubKey &) = delete; + GpgSubKey(const GpgSubKey&) = delete; - GpgSubKey &operator=(GpgSubKey &&o) noexcept { + GpgSubKey& operator=(GpgSubKey&& o) noexcept { swap(_subkey_ref, o._subkey_ref); return *this; }; - GpgSubKey &operator=(const GpgSubKey &) = delete; + GpgSubKey& operator=(const GpgSubKey&) = delete; -private: + bool operator==(const GpgSubKey& o) const { return fpr() == o.fpr(); } + + private: using SubkeyRefHandler = std::unique_ptr<struct _gpgme_subkey, std::function<void(gpgme_subkey_t)>>; SubkeyRefHandler _subkey_ref = nullptr; }; -} // namespace GpgFrontend +} // namespace GpgFrontend -#endif // GPGFRONTEND_GPGSUBKEY_H +#endif // GPGFRONTEND_GPGSUBKEY_H |