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

          Line data    Source code
       1             : /*
       2             :   vfsmountresult.cpp - wraps a gpgme vfs mount result
       3             :   Copyright (C) 2009 Klarälvdalens Datakonsult AB
       4             :   2016 Bundesamt für Sicherheit in der Informationstechnik
       5             :   Software engineering by Intevation GmbH <info@kdab.com>
       6             :   Author: Marc Mutz <marc@kdab.com>, Volker Krause <volker@kdab.com>
       7             : 
       8             :   This file is part of GPGME++.
       9             : 
      10             :   GPGME++ is free software; you can redistribute it and/or
      11             :   modify it under the terms of the GNU Library General Public
      12             :   License as published by the Free Software Foundation; either
      13             :   version 2 of the License, or (at your option) any later version.
      14             : 
      15             :   GPGME++ is distributed in the hope that it will be useful,
      16             :   but WITHOUT ANY WARRANTY; without even the implied warranty of
      17             :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      18             :   GNU Library General Public License for more details.
      19             : 
      20             :   You should have received a copy of the GNU Library General Public License
      21             :   along with GPGME++; see the file COPYING.LIB.  If not, write to the
      22             :   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
      23             :   Boston, MA 02110-1301, USA.
      24             : */
      25             : 
      26             : #ifdef HAVE_CONFIG_H
      27             :  #include "config.h"
      28             : #endif
      29             : 
      30             : #include <vfsmountresult.h>
      31             : #include "result_p.h"
      32             : 
      33             : #include <gpgme.h>
      34             : 
      35             : #include <istream>
      36             : #include <string.h>
      37             : 
      38             : using namespace GpgME;
      39             : 
      40             : class VfsMountResult::Private
      41             : {
      42             : public:
      43           0 :     explicit Private(const gpgme_vfs_mount_result_t r) : mountDir(0)
      44             :     {
      45           0 :         if (r && r->mount_dir) {
      46           0 :             mountDir = strdup(r->mount_dir);
      47             :         }
      48           0 :     }
      49             : 
      50           0 :     ~Private()
      51           0 :     {
      52           0 :         std::free(mountDir);
      53           0 :     }
      54             : 
      55             :     char *mountDir;
      56             : };
      57             : 
      58           0 : VfsMountResult::VfsMountResult(gpgme_ctx_t ctx, const Error &error, const Error &opError)
      59           0 :     : Result(error ? error : opError), d()
      60             : {
      61           0 :     init(ctx);
      62           0 : }
      63             : 
      64           0 : void VfsMountResult::init(gpgme_ctx_t ctx)
      65             : {
      66             :     (void)ctx;
      67           0 :     if (!ctx) {
      68           0 :         return;
      69             :     }
      70           0 :     gpgme_vfs_mount_result_t res = gpgme_op_vfs_mount_result(ctx);
      71           0 :     if (!res) {
      72           0 :         return;
      73             :     }
      74           0 :     d.reset(new Private(res));
      75             : }
      76             : 
      77           0 : make_standard_stuff(VfsMountResult)
      78             : 
      79           0 : const char *VfsMountResult::mountDir() const
      80             : {
      81           0 :     if (d) {
      82           0 :         return d->mountDir;
      83             :     }
      84           0 :     return 0;
      85             : }
      86             : 
      87           0 : std::ostream &GpgME::operator<<(std::ostream &os, const VfsMountResult &result)
      88             : {
      89           0 :     os << "GpgME::VfsMountResult(";
      90           0 :     if (!result.isNull()) {
      91           0 :         os << "\n error:       " << result.error()
      92             :            << "\n mount dir: " << result.mountDir()
      93           0 :            << "\n";
      94             :     }
      95           0 :     return os << ')';
      96             : }

Generated by: LCOV version 1.13