LCOV - code coverage report
Current view: top level - lang/cpp/src - encryptionresult.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 8 9 88.9 %
Date: 2018-11-15 08:49:49 Functions: 4 6 66.7 %

          Line data    Source code
       1             : /*
       2             :   encryptionresult.h - wraps a gpgme sign result
       3             :   Copyright (C) 2004 Klarälvdalens Datakonsult AB
       4             :   2016 Bundesamt für Sicherheit in der Informationstechnik
       5             :   Software engineering by Intevation GmbH
       6             : 
       7             :   This file is part of GPGME++.
       8             : 
       9             :   GPGME++ is free software; you can redistribute it and/or
      10             :   modify it under the terms of the GNU Library General Public
      11             :   License as published by the Free Software Foundation; either
      12             :   version 2 of the License, or (at your option) any later version.
      13             : 
      14             :   GPGME++ is distributed in the hope that it will be useful,
      15             :   but WITHOUT ANY WARRANTY; without even the implied warranty of
      16             :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17             :   GNU Library General Public License for more details.
      18             : 
      19             :   You should have received a copy of the GNU Library General Public License
      20             :   along with GPGME++; see the file COPYING.LIB.  If not, write to the
      21             :   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
      22             :   Boston, MA 02110-1301, USA.
      23             : */
      24             : 
      25             : #ifndef __GPGMEPP_ENCRYPTIONRESULT_H__
      26             : #define __GPGMEPP_ENCRYPTIONRESULT_H__
      27             : 
      28             : #include "gpgmefw.h"
      29             : #include "result.h"
      30             : #include "gpgmepp_export.h"
      31             : 
      32             : #include <memory>
      33             : 
      34             : #include <vector>
      35             : #include <iosfwd>
      36             : 
      37             : namespace GpgME
      38             : {
      39             : 
      40             : class Error;
      41             : class InvalidRecipient;
      42             : 
      43          42 : class GPGMEPP_EXPORT EncryptionResult : public Result
      44             : {
      45             : public:
      46             :     EncryptionResult();
      47             :     EncryptionResult(gpgme_ctx_t ctx, int error);
      48             :     EncryptionResult(gpgme_ctx_t ctx, const Error &error);
      49             :     EncryptionResult(const Error &err);
      50             : 
      51           5 :     const EncryptionResult &operator=(EncryptionResult other)
      52             :     {
      53           5 :         swap(other);
      54           5 :         return *this;
      55             :     }
      56             : 
      57           5 :     void swap(EncryptionResult &other)
      58             :     {
      59           5 :         Result::swap(other);
      60             :         using std::swap;
      61           5 :         swap(this->d, other.d);
      62           5 :     }
      63             : 
      64             :     bool isNull() const;
      65             : 
      66             :     unsigned int numInvalidRecipients() const;
      67             : 
      68             :     InvalidRecipient invalidEncryptionKey(unsigned int index) const;
      69             :     std::vector<InvalidRecipient> invalidEncryptionKeys() const;
      70             : 
      71             :     class Private;
      72             : private:
      73             :     void init(gpgme_ctx_t ctx);
      74             :     std::shared_ptr<Private> d;
      75             : };
      76             : 
      77             : GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const EncryptionResult &result);
      78             : 
      79           0 : class GPGMEPP_EXPORT InvalidRecipient
      80             : {
      81             :     friend class ::GpgME::EncryptionResult;
      82             :     InvalidRecipient(const std::shared_ptr<EncryptionResult::Private> &parent, unsigned int index);
      83             : public:
      84             :     InvalidRecipient();
      85             : 
      86             :     const InvalidRecipient &operator=(InvalidRecipient other)
      87             :     {
      88             :         swap(other);
      89             :         return *this;
      90             :     }
      91             : 
      92             :     void swap(InvalidRecipient &other)
      93             :     {
      94             :         using std::swap;
      95             :         swap(this->d, other.d);
      96             :     }
      97             : 
      98             :     bool isNull() const;
      99             : 
     100             :     const char *fingerprint() const;
     101             :     Error reason() const;
     102             : 
     103             : private:
     104             :     std::shared_ptr<EncryptionResult::Private> d;
     105             :     unsigned int idx;
     106             : };
     107             : 
     108             : GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const InvalidRecipient &recipient);
     109             : 
     110             : }
     111             : 
     112             : GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(EncryptionResult)
     113             : GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(InvalidRecipient)
     114             : 
     115             : #endif // __GPGMEPP_ENCRYPTIONRESULT_H__

Generated by: LCOV version 1.13