LCOV - code coverage report
Current view: top level - lang/cpp/src - result.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 8 9 88.9 %
Date: 2018-11-14 16:53:58 Functions: 6 8 75.0 %

          Line data    Source code
       1             : /*
       2             :   result.h - base class for results
       3             :   Copyright (C) 2004 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             : #ifndef __GPGMEPP_RESULT_H__
      26             : #define __GPGMEPP_RESULT_H__
      27             : 
      28             : #include "gpgmefw.h"
      29             : #include "error.h"
      30             : 
      31             : #include <algorithm> // std::swap
      32             : 
      33             : namespace GpgME
      34             : {
      35             : 
      36         470 : class GPGMEPP_EXPORT Result
      37             : {
      38             : protected:
      39          88 :     explicit Result() : mError() {}
      40           0 :     explicit Result(int err) : mError(err) {}
      41          46 :     explicit Result(const Error &err) : mError(err) {}
      42             : 
      43          59 :     void swap(Result &other)
      44             :     {
      45          59 :         std::swap(other.mError, mError);
      46          59 :     }
      47             : 
      48             : public:
      49          37 :     const Error &error() const
      50             :     {
      51          37 :         return mError;
      52             :     }
      53             : 
      54             : protected:
      55             :     Error mError;
      56             : };
      57             : 
      58             : }
      59             : 
      60             : #endif // __GPGMEPP_RESULT_H__

Generated by: LCOV version 1.13