LCOV - code coverage report
Current view: top level - lang/cpp/src - trustitem.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 38 0.0 %
Date: 2018-11-14 16:53:58 Functions: 0 13 0.0 %

          Line data    Source code
       1             : /*
       2             :   trustitem.cpp - wraps a gpgme trust item
       3             :   Copyright (C) 2003 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             : #ifdef HAVE_CONFIG_H
      26             :  #include "config.h"
      27             : #endif
      28             : 
      29             : #include <trustitem.h>
      30             : 
      31             : #include <gpgme.h>
      32             : 
      33             : #include <cassert>
      34             : 
      35             : namespace GpgME
      36             : {
      37             : 
      38             : class TrustItem::Private
      39             : {
      40             : public:
      41           0 :     Private(gpgme_trust_item_t aItem)
      42           0 :         : item(aItem)
      43             :     {
      44           0 :     }
      45             : 
      46             :     gpgme_trust_item_t item;
      47             : };
      48             : 
      49           0 : TrustItem::TrustItem(gpgme_trust_item_t item)
      50             : {
      51           0 :     d = new Private(item);
      52           0 :     if (d->item) {
      53           0 :         gpgme_trust_item_ref(d->item);
      54             :     }
      55           0 : }
      56             : 
      57           0 : TrustItem::TrustItem(const TrustItem &other)
      58             : {
      59           0 :     d = new Private(other.d->item);
      60           0 :     if (d->item) {
      61           0 :         gpgme_trust_item_ref(d->item);
      62             :     }
      63           0 : }
      64             : 
      65           0 : TrustItem::~TrustItem()
      66             : {
      67           0 :     if (d->item) {
      68           0 :         gpgme_trust_item_unref(d->item);
      69             :     }
      70           0 :     delete d; d = 0;
      71           0 : }
      72             : 
      73           0 : bool TrustItem::isNull() const
      74             : {
      75           0 :     return !d || !d->item;
      76             : }
      77             : 
      78           0 : gpgme_trust_item_t TrustItem::impl() const
      79             : {
      80           0 :     return d->item;
      81             : }
      82             : 
      83           0 : const char *TrustItem::keyID() const
      84             : {
      85           0 :     return d->item ? d->item->keyid : 0 ;
      86             : }
      87             : 
      88           0 : const char *TrustItem::userID() const
      89             : {
      90           0 :     return d->item ? d->item->name : 0 ;
      91             : }
      92             : 
      93           0 : const char *TrustItem::ownerTrustAsString() const
      94             : {
      95           0 :     return d->item ? d->item->owner_trust : 0 ;
      96             : }
      97             : 
      98           0 : const char *TrustItem::validityAsString() const
      99             : {
     100           0 :     return d->item ? d->item->validity : 0 ;
     101             : }
     102             : 
     103           0 : int TrustItem::trustLevel() const
     104             : {
     105           0 :     return d->item ? d->item->level : 0 ;
     106             : }
     107             : 
     108           0 : TrustItem::Type TrustItem::type() const
     109             : {
     110           0 :     if (!d->item) {
     111           0 :         return Unknown;
     112             :     } else {
     113             :         return
     114           0 :             d->item->type == 1 ? Key :
     115           0 :             d->item->type == 2 ? UserID :
     116           0 :             Unknown ;
     117             :     }
     118             : }
     119             : 
     120             : } // namespace GpgME

Generated by: LCOV version 1.13