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

          Line data    Source code
       1             : /*
       2             :   decryptionresult.h - wraps a gpgme keygen 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_DECRYPTIONRESULT_H__
      26             : #define __GPGMEPP_DECRYPTIONRESULT_H__
      27             : 
      28             : #include "gpgmefw.h"
      29             : #include "result.h"
      30             : #include "gpgmepp_export.h"
      31             : 
      32             : #include <vector>
      33             : #include <algorithm>
      34             : #include <iosfwd>
      35             : #include <memory>
      36             : 
      37             : namespace GpgME
      38             : {
      39             : 
      40             : class Error;
      41             : 
      42          27 : class GPGMEPP_EXPORT DecryptionResult : public Result
      43             : {
      44             : public:
      45             :     DecryptionResult();
      46             :     DecryptionResult(gpgme_ctx_t ctx, int error);
      47             :     DecryptionResult(gpgme_ctx_t ctx, const Error &err);
      48             :     explicit DecryptionResult(const Error &err);
      49             : 
      50           3 :     const DecryptionResult &operator=(DecryptionResult other)
      51             :     {
      52           3 :         swap(other);
      53           3 :         return *this;
      54             :     }
      55             : 
      56           3 :     void swap(DecryptionResult &other)
      57             :     {
      58           3 :         Result::swap(other);
      59             :         using std::swap;
      60           3 :         swap(this->d, other.d);
      61           3 :     }
      62             : 
      63             :     bool isNull() const;
      64             : 
      65             :     GPGMEPP_DEPRECATED const char *unsupportedAlgortihm() const
      66             :     {
      67             :         return unsupportedAlgorithm();
      68             :     }
      69             :     const char *unsupportedAlgorithm() const;
      70             : 
      71             :     GPGMEPP_DEPRECATED bool wrongKeyUsage() const
      72             :     {
      73             :         return isWrongKeyUsage();
      74             :     }
      75             :     bool isWrongKeyUsage() const;
      76             :     bool isDeVs() const;
      77             : 
      78             :     const char *fileName() const;
      79             : 
      80             :     const char *sessionKey() const;
      81             : 
      82             :     const char *symkeyAlgo() const;
      83             : 
      84             :     class Recipient;
      85             : 
      86             :     unsigned int numRecipients() const;
      87             :     Recipient recipient(unsigned int idx) const;
      88             :     std::vector<Recipient> recipients() const;
      89             : 
      90             :     bool isLegacyCipherNoMDC() const;
      91             : 
      92             : private:
      93             :     class Private;
      94             :     void init(gpgme_ctx_t ctx);
      95             :     std::shared_ptr<Private> d;
      96             : };
      97             : 
      98             : GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const DecryptionResult &result);
      99             : 
     100           0 : class GPGMEPP_EXPORT DecryptionResult::Recipient
     101             : {
     102             : public:
     103             :     Recipient();
     104             :     explicit Recipient(gpgme_recipient_t reci);
     105             : 
     106             :     const Recipient &operator=(Recipient other)
     107             :     {
     108             :         swap(other);
     109             :         return *this;
     110             :     }
     111             : 
     112             :     void swap(Recipient &other)
     113             :     {
     114             :         using std::swap;
     115             :         swap(this->d, other.d);
     116             :     }
     117             : 
     118             :     bool isNull() const;
     119             : 
     120             :     const char *keyID() const;
     121             :     const char *shortKeyID() const;
     122             : 
     123             :     unsigned int publicKeyAlgorithm() const;
     124             :     const char *publicKeyAlgorithmAsString() const;
     125             : 
     126             :     Error status() const;
     127             : 
     128             : private:
     129             :     class Private;
     130             :     std::shared_ptr<Private> d;
     131             : };
     132             : 
     133             : GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const DecryptionResult::Recipient &reci);
     134             : 
     135             : }
     136             : 
     137             : GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(DecryptionResult)
     138             : 
     139             : #endif // __GPGMEPP_DECRYPTIONRESULT_H__

Generated by: LCOV version 1.13