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

          Line data    Source code
       1             : /*
       2             :   signingresult.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_SIGNINGRESULT_H__
      26             : #define __GPGMEPP_SIGNINGRESULT_H__
      27             : 
      28             : #include "global.h"
      29             : #include "result.h"
      30             : 
      31             : #include <time.h>
      32             : 
      33             : #include <memory>
      34             : 
      35             : #include <vector>
      36             : #include <iosfwd>
      37             : 
      38             : namespace GpgME
      39             : {
      40             : 
      41             : class Error;
      42             : class CreatedSignature;
      43             : class InvalidSigningKey;
      44             : 
      45          67 : class GPGMEPP_EXPORT SigningResult : public Result
      46             : {
      47             : public:
      48             :     SigningResult();
      49             :     SigningResult(gpgme_ctx_t ctx, int error);
      50             :     SigningResult(gpgme_ctx_t ctx, const Error &error);
      51             :     explicit SigningResult(const Error &err);
      52             : 
      53           7 :     const SigningResult &operator=(SigningResult other)
      54             :     {
      55           7 :         swap(other);
      56           7 :         return *this;
      57             :     }
      58             : 
      59           7 :     void swap(SigningResult &other)
      60             :     {
      61           7 :         Result::swap(other);
      62             :         using std::swap;
      63           7 :         swap(this->d, other.d);
      64           7 :     }
      65             : 
      66             :     bool isNull() const;
      67             : 
      68             :     CreatedSignature createdSignature(unsigned int index) const;
      69             :     std::vector<CreatedSignature> createdSignatures() const;
      70             : 
      71             :     InvalidSigningKey invalidSigningKey(unsigned int index) const;
      72             :     std::vector<InvalidSigningKey> invalidSigningKeys() const;
      73             : 
      74             :     class Private;
      75             : private:
      76             :     void init(gpgme_ctx_t ctx);
      77             :     std::shared_ptr<Private> d;
      78             : };
      79             : 
      80             : GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const SigningResult &result);
      81             : 
      82           0 : class GPGMEPP_EXPORT InvalidSigningKey
      83             : {
      84             :     friend class ::GpgME::SigningResult;
      85             :     InvalidSigningKey(const std::shared_ptr<SigningResult::Private> &parent, unsigned int index);
      86             : public:
      87             :     InvalidSigningKey();
      88             : 
      89             :     const InvalidSigningKey &operator=(InvalidSigningKey other)
      90             :     {
      91             :         swap(other);
      92             :         return *this;
      93             :     }
      94             : 
      95             :     void swap(InvalidSigningKey &other)
      96             :     {
      97             :         using std::swap;
      98             :         swap(this->d, other.d);
      99             :         swap(this->idx, other.idx);
     100             :     }
     101             : 
     102             :     bool isNull() const;
     103             : 
     104             :     const char *fingerprint() const;
     105             :     Error reason() const;
     106             : 
     107             : private:
     108             :     std::shared_ptr<SigningResult::Private> d;
     109             :     unsigned int idx;
     110             : };
     111             : 
     112             : GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const InvalidSigningKey &key);
     113             : 
     114           0 : class GPGMEPP_EXPORT CreatedSignature
     115             : {
     116             :     friend class ::GpgME::SigningResult;
     117             :     CreatedSignature(const std::shared_ptr<SigningResult::Private> &parent, unsigned int index);
     118             : public:
     119             : 
     120             :     CreatedSignature();
     121             : 
     122             :     const CreatedSignature &operator=(CreatedSignature other)
     123             :     {
     124             :         swap(other);
     125             :         return *this;
     126             :     }
     127             : 
     128             :     void swap(CreatedSignature &other)
     129             :     {
     130             :         using std::swap;
     131             :         swap(this->d, other.d);
     132             :         swap(this->idx, other.idx);
     133             :     }
     134             : 
     135             :     bool isNull() const;
     136             : 
     137             :     const char *fingerprint() const;
     138             : 
     139             :     time_t creationTime() const;
     140             : 
     141             :     SignatureMode mode() const;
     142             : 
     143             :     unsigned int publicKeyAlgorithm() const;
     144             :     const char *publicKeyAlgorithmAsString() const;
     145             : 
     146             :     unsigned int hashAlgorithm() const;
     147             :     const char *hashAlgorithmAsString() const;
     148             : 
     149             :     unsigned int signatureClass() const;
     150             : 
     151             : private:
     152             :     std::shared_ptr<SigningResult::Private> d;
     153             :     unsigned int idx;
     154             : };
     155             : 
     156             : GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const CreatedSignature &sig);
     157             : 
     158             : }
     159             : 
     160             : GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(SigningResult)
     161             : GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(InvalidSigningKey)
     162             : GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(CreatedSignature)
     163             : 
     164             : #endif // __GPGMEPP_SIGNINGRESULT_H__

Generated by: LCOV version 1.13