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

Generated by: LCOV version 1.11