Blame lang/cpp/src/swdbresult.h

Packit Service 672cf4
/*
Packit Service 672cf4
  swdbresult.h - wraps a gpgme swdb query / rsult
Packit Service 672cf4
  Copyright (C) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Packit Service 672cf4
  Software engineering by Intevation GmbH
Packit Service 672cf4
Packit Service 672cf4
  This file is part of GPGME++.
Packit Service 672cf4
Packit Service 672cf4
  GPGME++ is free software; you can redistribute it and/or
Packit Service 672cf4
  modify it under the terms of the GNU Library General Public
Packit Service 672cf4
  License as published by the Free Software Foundation; either
Packit Service 672cf4
  version 2 of the License, or (at your option) any later version.
Packit Service 672cf4
Packit Service 672cf4
  GPGME++ is distributed in the hope that it will be useful,
Packit Service 672cf4
  but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 672cf4
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service 672cf4
  GNU Library General Public License for more details.
Packit Service 672cf4
Packit Service 672cf4
  You should have received a copy of the GNU Library General Public License
Packit Service 672cf4
  along with GPGME++; see the file COPYING.LIB.  If not, write to the
Packit Service 672cf4
  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Packit Service 672cf4
  Boston, MA 02110-1301, USA.
Packit Service 672cf4
*/
Packit Service 672cf4
#ifndef __GPGMEPP_SWDB_H__
Packit Service 672cf4
#define __GPGMEPP_SWDB_H__
Packit Service 672cf4
Packit Service 672cf4
#include "gpgmepp_export.h"
Packit Service 672cf4
Packit Service 672cf4
#include "global.h"
Packit Service 672cf4
#include "engineinfo.h"
Packit Service 672cf4
Packit Service 672cf4
#include <vector>
Packit Service 672cf4
#include <string>
Packit Service 672cf4
#include <iostream>
Packit Service 672cf4
#include <ostream>
Packit Service 672cf4
Packit Service 672cf4
namespace GpgME
Packit Service 672cf4
{
Packit Service 672cf4
Packit Service 672cf4
class GPGMEPP_EXPORT SwdbResult
Packit Service 672cf4
{
Packit Service 672cf4
public:
Packit Service 672cf4
    /* Obtain swdb results through query() */
Packit Service 672cf4
    SwdbResult();
Packit Service 672cf4
    explicit SwdbResult(gpgme_query_swdb_result_t result);
Packit Service 672cf4
Packit Service 672cf4
    /** Query the swdb to get information about updates.
Packit Service 672cf4
     *
Packit Service 672cf4
     * Runs gpgconf --query-swdb through gpgme and
Packit Service 672cf4
     * returns a list of results.
Packit Service 672cf4
     * If iversion is given as NULL a check is only done if GPGME
Packit Service 672cf4
     * can figure out the version by itself (for example when using
Packit Service 672cf4
     * "gpgme" or "gnupg").
Packit Service 672cf4
     *
Packit Service 672cf4
     * If NULL is used for name the current gpgme version is
Packit Service 672cf4
     * checked.
Packit Service 672cf4
     *
Packit Service 672cf4
     * @param name: Name of the component to query.
Packit Service 672cf4
     * @param iversion: Optionally the installed version.
Packit Service 672cf4
     * @param err: Optional error.
Packit Service 672cf4
     */
Packit Service 672cf4
    static std::vector<SwdbResult> query(const char *name,
Packit Service 672cf4
                                         const char *iversion = NULL,
Packit Service 672cf4
                                         Error *err = NULL);
Packit Service 672cf4
Packit Service 672cf4
    const SwdbResult &operator=(SwdbResult other)
Packit Service 672cf4
    {
Packit Service 672cf4
        swap(other);
Packit Service 672cf4
        return *this;
Packit Service 672cf4
    }
Packit Service 672cf4
Packit Service 672cf4
    void swap(SwdbResult &other)
Packit Service 672cf4
    {
Packit Service 672cf4
        using std::swap;
Packit Service 672cf4
        swap(this->d, other.d);
Packit Service 672cf4
    }
Packit Service 672cf4
    bool isNull() const;
Packit Service 672cf4
Packit Service 672cf4
    /* The name of the package (e.g. "gpgme", "gnupg") */
Packit Service 672cf4
    std::string name() const;
Packit Service 672cf4
Packit Service 672cf4
    /* The version of the installed version.  */
Packit Service 672cf4
    EngineInfo::Version installedVersion() const;
Packit Service 672cf4
Packit Service 672cf4
    /* The time the online info was created.  */
Packit Service 672cf4
    unsigned long created() const;
Packit Service 672cf4
Packit Service 672cf4
    /* The time the online info was retrieved.  */
Packit Service 672cf4
    unsigned long retrieved() const;
Packit Service 672cf4
Packit Service 672cf4
    /* This bit is set if an error occurred or some of the information
Packit Service 672cf4
     * in this structure may not be set.  */
Packit Service 672cf4
    bool warning() const;
Packit Service 672cf4
Packit Service 672cf4
    /* An update is available.  */
Packit Service 672cf4
    bool update() const;
Packit Service 672cf4
Packit Service 672cf4
    /* The update is important.  */
Packit Service 672cf4
    bool urgent() const;
Packit Service 672cf4
Packit Service 672cf4
    /* No information at all available.  */
Packit Service 672cf4
    bool noinfo() const;
Packit Service 672cf4
Packit Service 672cf4
    /* The package name is not known. */
Packit Service 672cf4
    bool unknown() const;
Packit Service 672cf4
Packit Service 672cf4
    /* The information here is too old.  */
Packit Service 672cf4
    bool tooOld() const;
Packit Service 672cf4
Packit Service 672cf4
    /* Other error.  */
Packit Service 672cf4
    bool error() const;
Packit Service 672cf4
Packit Service 672cf4
    /* The version of the latest released version.  */
Packit Service 672cf4
    EngineInfo::Version version() const;
Packit Service 672cf4
Packit Service 672cf4
    /* The release date of that version.  */
Packit Service 672cf4
    unsigned long releaseDate() const;
Packit Service 672cf4
Packit Service 672cf4
private:
Packit Service 672cf4
    class Private;
Packit Service 672cf4
    std::shared_ptr<Private> d;
Packit Service 672cf4
};
Packit Service 672cf4
Packit Service 672cf4
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const SwdbResult &info;;
Packit Service 672cf4
Packit Service 672cf4
} // namespace GpgME
Packit Service 672cf4
Packit Service 672cf4
GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(SwdbResult)
Packit Service 672cf4
Packit Service 672cf4
#endif