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: 2016-11-29 15:07:43 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             : 
       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             : #ifndef __GPGMEPP_RESULT_H__
      24             : #define __GPGMEPP_RESULT_H__
      25             : 
      26             : #include "gpgmefw.h"
      27             : #include "error.h"
      28             : 
      29             : #include <algorithm> // std::swap
      30             : 
      31             : namespace GpgME
      32             : {
      33             : 
      34         349 : class GPGMEPP_EXPORT Result
      35             : {
      36             : protected:
      37          66 :     explicit Result() : mError() {}
      38           0 :     explicit Result(int err) : mError(err) {}
      39          35 :     explicit Result(const Error &err) : mError(err) {}
      40             : 
      41          45 :     void swap(Result &other)
      42             :     {
      43          45 :         std::swap(other.mError, mError);
      44          45 :     }
      45             : 
      46             : public:
      47          27 :     const Error &error() const
      48             :     {
      49          27 :         return mError;
      50             :     }
      51             : 
      52             : protected:
      53             :     Error mError;
      54             : };
      55             : 
      56             : }
      57             : 
      58             : #endif // __GPGMEPP_RESULT_H__

Generated by: LCOV version 1.11