LCOV - code coverage report
Current view: top level - lang/cpp/src - swdbresult.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 1 0.0 %
Date: 2018-11-15 08:49:49 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /*
       2             :   swdbresult.h - wraps a gpgme swdb query / rsult
       3             :   Copyright (C) 2016 by Bundesamt für Sicherheit in der Informationstechnik
       4             :   Software engineering by Intevation GmbH
       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             : #ifndef __GPGMEPP_SWDB_H__
      24             : #define __GPGMEPP_SWDB_H__
      25             : 
      26             : #include "gpgmepp_export.h"
      27             : 
      28             : #include "global.h"
      29             : #include "engineinfo.h"
      30             : 
      31             : #include <vector>
      32             : #include <string>
      33             : #include <iostream>
      34             : #include <ostream>
      35             : 
      36             : namespace GpgME
      37             : {
      38             : 
      39           0 : class GPGMEPP_EXPORT SwdbResult
      40             : {
      41             : public:
      42             :     /* Obtain swdb results through query() */
      43             :     SwdbResult();
      44             :     explicit SwdbResult(gpgme_query_swdb_result_t result);
      45             : 
      46             :     /** Query the swdb to get information about updates.
      47             :      *
      48             :      * Runs gpgconf --query-swdb through gpgme and
      49             :      * returns a list of results.
      50             :      * If iversion is given as NULL a check is only done if GPGME
      51             :      * can figure out the version by itself (for example when using
      52             :      * "gpgme" or "gnupg").
      53             :      *
      54             :      * If NULL is used for name the current gpgme version is
      55             :      * checked.
      56             :      *
      57             :      * @param name: Name of the component to query.
      58             :      * @param iversion: Optionally the installed version.
      59             :      * @param err: Optional error.
      60             :      */
      61             :     static std::vector<SwdbResult> query(const char *name,
      62             :                                          const char *iversion = NULL,
      63             :                                          Error *err = NULL);
      64             : 
      65             :     const SwdbResult &operator=(SwdbResult other)
      66             :     {
      67             :         swap(other);
      68             :         return *this;
      69             :     }
      70             : 
      71             :     void swap(SwdbResult &other)
      72             :     {
      73             :         using std::swap;
      74             :         swap(this->d, other.d);
      75             :     }
      76             :     bool isNull() const;
      77             : 
      78             :     /* The name of the package (e.g. "gpgme", "gnupg") */
      79             :     std::string name() const;
      80             : 
      81             :     /* The version of the installed version.  */
      82             :     EngineInfo::Version installedVersion() const;
      83             : 
      84             :     /* The time the online info was created.  */
      85             :     unsigned long created() const;
      86             : 
      87             :     /* The time the online info was retrieved.  */
      88             :     unsigned long retrieved() const;
      89             : 
      90             :     /* This bit is set if an error occurred or some of the information
      91             :      * in this structure may not be set.  */
      92             :     bool warning() const;
      93             : 
      94             :     /* An update is available.  */
      95             :     bool update() const;
      96             : 
      97             :     /* The update is important.  */
      98             :     bool urgent() const;
      99             : 
     100             :     /* No information at all available.  */
     101             :     bool noinfo() const;
     102             : 
     103             :     /* The package name is not known. */
     104             :     bool unknown() const;
     105             : 
     106             :     /* The information here is too old.  */
     107             :     bool tooOld() const;
     108             : 
     109             :     /* Other error.  */
     110             :     bool error() const;
     111             : 
     112             :     /* The version of the latest released version.  */
     113             :     EngineInfo::Version version() const;
     114             : 
     115             :     /* The release date of that version.  */
     116             :     unsigned long releaseDate() const;
     117             : 
     118             : private:
     119             :     class Private;
     120             :     std::shared_ptr<Private> d;
     121             : };
     122             : 
     123             : GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const SwdbResult &info);
     124             : 
     125             : } // namespace GpgME
     126             : 
     127             : GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(SwdbResult)
     128             : 
     129             : #endif

Generated by: LCOV version 1.13