File indexing completed on 2024-05-05 17:33:20

0001 /*
0002  *   SPDX-FileCopyrightText: 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0003  *
0004  *   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #include "PackageState.h"
0008 #include "libdiscover_debug.h"
0009 
0010 PackageState::PackageState(const QString &name, const QString &description, bool installed)
0011     : PackageState(name, name, description, installed)
0012 {
0013 }
0014 
0015 PackageState::PackageState(QString packageName, QString name, QString description, bool installed)
0016     : m_packageName(std::move(packageName))
0017     , m_name(std::move(name))
0018     , m_description(std::move(description))
0019     , m_installed(installed)
0020 {
0021 }
0022 
0023 PackageState::PackageState(const PackageState &ps)
0024     : m_packageName(ps.m_packageName)
0025     , m_name(ps.m_name)
0026     , m_description(ps.m_description)
0027     , m_installed(ps.m_installed)
0028 {
0029 }
0030 
0031 QString PackageState::name() const
0032 {
0033     return m_name;
0034 }
0035 
0036 QString PackageState::description() const
0037 {
0038     return m_description;
0039 }
0040 
0041 QString PackageState::packageName() const
0042 {
0043     return m_packageName;
0044 }
0045 
0046 bool PackageState::isInstalled() const
0047 {
0048     return m_installed;
0049 }
0050 
0051 void PackageState::setInstalled(bool installed)
0052 {
0053     m_installed = installed;
0054 }
0055 
0056 QDebug operator<<(QDebug debug, const PackageState &state)
0057 {
0058     QDebugStateSaver saver(debug);
0059     debug.nospace() << "PackageState(";
0060     debug.nospace() << state.name() << ':';
0061     debug.nospace() << "installed: " << state.isInstalled() << ',';
0062     debug.nospace() << ')';
0063     return debug;
0064 }