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

Generated by: LCOV version 1.13