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

Generated by: LCOV version 1.11