LCOV - code coverage report
Current view: top level - lang/cpp/src - tofuinfo.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 7 7 100.0 %
Date: 2016-11-29 15:07:43 Functions: 4 4 100.0 %

          Line data    Source code
       1             : /*
       2             :   tofuinfo.h - wraps gpgme tofu info
       3             :   Copyright (C) 2016 Intevation GmbH
       4             : 
       5             :   This file is part of GPGME++.
       6             : 
       7             :   GPGME++ is free software; you can redistribute it and/or
       8             :   modify it under the terms of the GNU Library General Public
       9             :   License as published by the Free Software Foundation; either
      10             :   version 2 of the License, or (at your option) any later version.
      11             : 
      12             :   GPGME++ is distributed in the hope that it will be useful,
      13             :   but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15             :   GNU Library General Public License for more details.
      16             : 
      17             :   You should have received a copy of the GNU Library General Public License
      18             :   along with GPGME++; see the file COPYING.LIB.  If not, write to the
      19             :   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
      20             :   Boston, MA 02110-1301, USA.
      21             : */
      22             : 
      23             : #ifndef __GPGMEPP_TOFUINFO_H__
      24             : #define __GPGMEPP_TOFUINFO_H__
      25             : 
      26             : #include "gpgmepp_export.h"
      27             : 
      28             : #include "global.h"
      29             : 
      30             : #include <memory>
      31             : 
      32             : namespace GpgME
      33             : {
      34             : 
      35          24 : class GPGMEPP_EXPORT TofuInfo
      36             : {
      37             : public:
      38             :     TofuInfo();
      39             :     explicit TofuInfo(gpgme_tofu_info_t info);
      40             : 
      41           2 :     const TofuInfo &operator=(TofuInfo other)
      42             :     {
      43           2 :         swap(other);
      44           2 :         return *this;
      45             :     }
      46             : 
      47           2 :     void swap(TofuInfo &other)
      48             :     {
      49             :         using std::swap;
      50           2 :         swap(this->d, other.d);
      51           2 :     }
      52             : 
      53             :     bool isNull() const;
      54             : 
      55             :     /* @enum Validity
      56             :      * @brief The TOFU Validity. */
      57             :     enum Validity : unsigned int {
      58             :         /*! Unknown (uninitialized).*/
      59             :         ValidityUnknown,
      60             :         /*! TOFU Conflict.*/
      61             :         Conflict,
      62             :         /*! Key without history.*/
      63             :         NoHistory,
      64             :         /*! Key with too little history.*/
      65             :         LittleHistory,
      66             :         /*! Key with enough history for basic trust.*/
      67             :         BasicHistory,
      68             :         /*! Key with a lot of history.*/
      69             :         LargeHistory,
      70             :     };
      71             :     Validity validity() const;
      72             : 
      73             :     /* @enum Policy
      74             :      * @brief The TOFU Validity. */
      75             :     enum Policy : unsigned int {
      76             :         /*! GPGME_TOFU_POLICY_NONE */
      77             :         PolicyNone,
      78             :         /*! GPGME_TOFU_POLICY_AUTO */
      79             :         PolicyAuto,
      80             :         /*! GPGME_TOFU_POLICY_GOOD */
      81             :         PolicyGood,
      82             :         /*! GPGME_TOFU_POLICY_UNKNOWN */
      83             :         PolicyUnknown,
      84             :         /*! GPGME_TOFU_POLICY_BAD */
      85             :         PolicyBad,
      86             :         /*! GPGME_TOFU_POLICY_ASK */
      87             :         PolicyAsk,
      88             :     };
      89             :     Policy policy() const;
      90             : 
      91             :     /* Number of signatures seen for this binding.  Capped at USHRT_MAX.  */
      92             :     unsigned short signCount() const;
      93             : 
      94             :     /* Number of encryption done to this binding.  Capped at USHRT_MAX.  */
      95             :     unsigned short encrCount() const;
      96             : 
      97             :     /** Number of seconds since epoch when the first message was verified */
      98             :     unsigned long signFirst() const;
      99             : 
     100             :     /** Number of seconds since epoch when the last message was verified */
     101             :     unsigned long signLast() const;
     102             : 
     103             :     /** Number of seconds since epoch when the first message was encrypted */
     104             :     unsigned long encrFirst() const;
     105             : 
     106             :     /** Number of seconds since epoch when the last message was encrypted */
     107             :     unsigned long encrLast() const;
     108             : 
     109             :     /* If non-NULL a human readable string summarizing the TOFU data. */
     110             :     const char *description() const;
     111             : 
     112             : private:
     113             :     class Private;
     114             :     std::shared_ptr<Private> d;
     115             : };
     116             : 
     117             : GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const TofuInfo &info);
     118             : 
     119             : } // namespace GpgME
     120             : 
     121             : GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(TofuInfo)
     122             : #endif // __GPGMEPP_TOFUINFO_H__

Generated by: LCOV version 1.11