<commit_before>/*
 * Part of Appstream, a library for accessing AppStream on-disk database
 * Copyright 2014  <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#ifndef APPSTREAMQT_COMPONENT_H
#define APPSTREAMQT_COMPONENT_H

#include <QSharedDataPointer>
#include <QObject>
#include <QUrl>
#include <QStringList>
#include <QSize>
#include "appstreamqt_export.h"
#include "provides.h"


namespace Appstream {

class Screenshot;

class ComponentData;

/**
 * Describes a Component (package) in appstream
 */
class APPSTREAMQT_EXPORT Component {
    Q_GADGET
    Q_ENUMS(Kind UrlKind)
    public:
        enum Kind  {
            KindUnknown,
            KindGeneric,
            KindDesktop,
            KindFont,
            KindCodec,
            KindInputmethod,
            KindAddon
        };
        enum UrlKind {
            UrlKindUnknown,
            UrlKindHomepage,
            UrlKindBugtracker,
            UrlKindFaq,
            UrlKindHelp,
            UrlKindDonation
        };

        Component();
        Component(const Component& other);
        ~Component();
        Component& operator=(const Component& other);
        bool operator==(const Component& other);

        Kind kind () const;
        void setKind (Component::Kind kind);

        QString id() const;
        void setId(const QString& id);

        QStringList packageNames() const;
        void setPackageNames(const QStringList& packageName);

        QString name() const;
        void setName(const QString& name);

        QString summary() const;
        void setSummary(const QString& summary);

        QString description() const;
        void setDescription(const QString& description);

        QString projectLicense() const;
        void setProjectLicense(const QString& license);

        QString projectGroup() const;
        void setProjectGroup(const QString& group);

        QString developerName() const;
        void setDeveloperName(const QString& developerName);

        QStringList compulsoryForDesktops() const;
        void setCompulsoryForDesktops(const QStringList& desktops);
        bool isCompulsoryForDesktop(const QString& desktop) const;

        QStringList categories() const;
        void setCategories(const QStringList& categories);
        bool hasCategory(const QString& category) const;

        /**
         * \return generic (stock) icon name
         */
        QString icon() const;
        void setIcon(const QString& icon);

        /**
         * \return absolute path to an icon of the given size
         */
        QUrl iconUrl() const;
        QUrl iconUrl(const QSize& size) const;
        void setIconUrl(const QUrl& iconUrl);
        void addIconUrl(const QUrl& iconUrl, const QSize& size);


        void setUrls(const QMultiHash<UrlKind , QUrl >& urls);
        QMultiHash<UrlKind, QUrl> urls() const;
        QList<QUrl> urls(UrlKind kind) const;


        /**
         * \param kind for provides
         * \return a list of all provides for this \param kind
         */<commit_msg>qt: Add documentation to the deprecated methods<commit_after>/*
 * Part of Appstream, a library for accessing AppStream on-disk database
 * Copyright 2014  <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#ifndef APPSTREAMQT_COMPONENT_H
#define APPSTREAMQT_COMPONENT_H

#include <QSharedDataPointer>
#include <QObject>
#include <QUrl>
#include <QStringList>
#include <QSize>
#include "appstreamqt_export.h"
#include "provides.h"


namespace Appstream {

class Screenshot;

class ComponentData;

/**
 * Describes a Component (package) in appstream
 */
class APPSTREAMQT_EXPORT Component {
    Q_GADGET
    Q_ENUMS(Kind UrlKind)
    public:
        enum Kind  {
            KindUnknown,
            KindGeneric,
            KindDesktop,
            KindFont,
            KindCodec,
            KindInputmethod,
            KindAddon
        };
        enum UrlKind {
            UrlKindUnknown,
            UrlKindHomepage,
            UrlKindBugtracker,
            UrlKindFaq,
            UrlKindHelp,
            UrlKindDonation
        };

        Component();
        Component(const Component& other);
        ~Component();
        Component& operator=(const Component& other);
        bool operator==(const Component& other);

        Kind kind () const;
        void setKind (Component::Kind kind);

        QString id() const;
        void setId(const QString& id);

        QStringList packageNames() const;
        void setPackageNames(const QStringList& packageName);

        QString name() const;
        void setName(const QString& name);

        QString summary() const;
        void setSummary(const QString& summary);

        QString description() const;
        void setDescription(const QString& description);

        QString projectLicense() const;
        void setProjectLicense(const QString& license);

        QString projectGroup() const;
        void setProjectGroup(const QString& group);

        QString developerName() const;
        void setDeveloperName(const QString& developerName);

        QStringList compulsoryForDesktops() const;
        void setCompulsoryForDesktops(const QStringList& desktops);
        bool isCompulsoryForDesktop(const QString& desktop) const;

        QStringList categories() const;
        void setCategories(const QStringList& categories);
        bool hasCategory(const QString& category) const;

        /**
         * \return generic (stock) icon name
         */
        QString icon() const;
        void setIcon(const QString& icon);

        /**
         * \return absolute path to a 64x64px sized icon
         *
         * \deprecated this method is deprecated
         */
        Q_DECL_DEPRECATED QUrl iconUrl() const;

        /**
         * \return absolute (local or remote) path to an icon of the given size
         */
        QUrl iconUrl(const QSize& size) const;

        /**
         * Sets the url for an icon of 64x64 pixels
         *
         * \deprecated this method is deprecated
         */
        Q_DECL_DEPRECATED void setIconUrl(const QUrl& iconUrl);

        /**
         * Sets the url for an icon
         *
         * The url can be an absolute filepath or a HTTP remote link.
         */
        void addIconUrl(const QUrl& iconUrl, const QSize& size);


        void setUrls(const QMultiHash<UrlKind , QUrl >& urls);
        QMultiHash<UrlKind, QUrl> urls() const;
        QList<QUrl> urls(UrlKind kind) const;


        /**
         * \param kind for provides
         * \return a list of all provides for this \param kind
         */
{'fraction_non_alphanumeric': 0.07554001748033462, 'fraction_numerical': 0.005244100387064552, 'mean_word_length': 2.433347621088727, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6467227', 'n_tokens_mistral': 2166, 'n_tokens_neox': 2068, 'n_words': 762}