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

          Line data    Source code
       1             : /*
       2             :   importresult.h - wraps a gpgme import 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_IMPORTRESULT_H__
      26             : #define __GPGMEPP_IMPORTRESULT_H__
      27             : 
      28             : #include "gpgmefw.h"
      29             : #include "result.h"
      30             : #include "gpgmepp_export.h"
      31             : 
      32             : #include <memory>
      33             : 
      34             : #include <vector>
      35             : 
      36             : namespace GpgME
      37             : {
      38             : 
      39             : class Error;
      40             : class Import;
      41             : 
      42          26 : class GPGMEPP_EXPORT ImportResult : public Result
      43             : {
      44             : public:
      45             :     ImportResult();
      46             :     ImportResult(gpgme_ctx_t ctx, int error);
      47             :     ImportResult(gpgme_ctx_t ctx, const Error &error);
      48             :     explicit ImportResult(const Error &error);
      49             : 
      50           4 :     const ImportResult &operator=(ImportResult other)
      51             :     {
      52           4 :         swap(other);
      53           4 :         return *this;
      54             :     }
      55             : 
      56           4 :     void swap(ImportResult &other)
      57             :     {
      58           4 :         Result::swap(other);
      59             :         using std::swap;
      60           4 :         swap(this->d, other.d);
      61           4 :     }
      62             : 
      63             :     bool isNull() const;
      64             : 
      65             :     int numConsidered() const;
      66             :     int numKeysWithoutUserID() const;
      67             :     int numImported() const;
      68             :     int numRSAImported() const;
      69             :     int numUnchanged() const;
      70             : 
      71             :     int newUserIDs() const;
      72             :     int newSubkeys() const;
      73             :     int newSignatures() const;
      74             :     int newRevocations() const;
      75             : 
      76             :     int numSecretKeysConsidered() const;
      77             :     int numSecretKeysImported() const;
      78             :     int numSecretKeysUnchanged() const;
      79             : 
      80             :     int notImported() const;
      81             :     int numV3KeysSkipped() const;
      82             : 
      83             :     Import import(unsigned int idx) const;
      84             :     std::vector<Import> imports() const;
      85             : 
      86             :     class Private;
      87             : private:
      88             :     void init(gpgme_ctx_t ctx);
      89             :     std::shared_ptr<Private> d;
      90             : };
      91             : 
      92           6 : class GPGMEPP_EXPORT Import
      93             : {
      94             :     friend class ::GpgME::ImportResult;
      95             :     Import(const std::shared_ptr<ImportResult::Private> &parent, unsigned int idx);
      96             : public:
      97             :     Import();
      98             : 
      99             :     const Import &operator=(Import other)
     100             :     {
     101             :         swap(other);
     102             :         return *this;
     103             :     }
     104             : 
     105             :     void swap(Import &other)
     106             :     {
     107             :         using std::swap;
     108             :         swap(this->d, other.d);
     109             :         swap(this->idx, other.idx);
     110             :     }
     111             : 
     112             :     bool isNull() const;
     113             : 
     114             :     const char *fingerprint() const;
     115             :     Error error() const;
     116             : 
     117             :     enum Status {
     118             :         Unknown = 0x0,
     119             :         NewKey = 0x1,
     120             :         NewUserIDs = 0x2,
     121             :         NewSignatures = 0x4,
     122             :         NewSubkeys = 0x8,
     123             :         ContainedSecretKey = 0x10
     124             :     };
     125             :     Status status() const;
     126             : 
     127             : private:
     128             :     std::shared_ptr<ImportResult::Private> d;
     129             :     unsigned int idx;
     130             : };
     131             : 
     132             : }
     133             : 
     134             : GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(ImportResult)
     135             : GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(Import)
     136             : 
     137             : #endif // __GPGMEPP_IMPORTRESULT_H__

Generated by: LCOV version 1.13