Alkimia API

alknewstuffentry.cpp
1/*
2 SPDX-FileCopyrightText: 2024 Ralf Habacker ralf.habacker @freenet.de
3
4 This file is part of libalkimia.
5
6 SPDX-License-Identifier: LGPL-2.1-or-later
7*/
8
9#include "alknewstuffentry.h"
10
11#include "alknewstuffentry_p.h"
12
14{
15 out << entry.name << entry.status;
16 return out;
17}
18
20{
21 out << "AlkNewStuffEntryList(";
22 for (const auto &e : entries) {
23 out << e;
24 }
25 out << ")";
26
27 return out;
28}
29
30#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
31QDebug operator<<(QDebug out, const KNSCore::Entry::List &entries)
32{
33 out << "KNSCore::Entry::List";
34 for (auto &e : entries) {
35 out << e;
36 }
37
38 return out;
39}
40
41AlkNewStuffEntry toAlkEntry(const KNSCore::Entry &entry)
42{
44 e.category = entry.category();
45 e.id = entry.uniqueId();
46 e.installedFiles = entry.installedFiles();
47 e.name = entry.name();
48 e.providerId = entry.providerId();
49 e.status = static_cast<AlkNewStuffEntry::Status>(entry.status());
50 e.version = entry.version();
51 return e;
52}
53
54void toAlkEntryList(AlkNewStuffEntryList &result, const KNSCore::Entry::List &entries)
55{
56 for (const KNSCore::Entry &entry : entries) {
57 result.append(toAlkEntry(entry));
58 }
59}
60#elif QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
61QDebug operator<<(QDebug out, const KNSCore::EntryInternal &entry)
62{
63 out << entry.name() << entry.status();
64 return out;
65}
66
67QDebug operator<<(QDebug out, const KNSCore::EntryInternal::List &entries)
68{
69 out << "KNSCore::EntryInternal::List";
70 for (auto &e : entries) {
71 out << e;
72 }
73
74 return out;
75}
76
77AlkNewStuffEntry toAlkEntry(const KNSCore::EntryInternal &entry)
78{
80 e.category = entry.category();
81 e.id = entry.uniqueId();
82 e.installedFiles = entry.installedFiles();
83 e.name = entry.name();
84 e.providerId = entry.providerId();
85 e.status = static_cast<AlkNewStuffEntry::Status>(entry.status());
86 e.version = entry.version();
87 return e;
88}
89
90void toAlkEntryList(AlkNewStuffEntryList &result, const KNSCore::EntryInternal::List &entries)
91{
92 for (const KNSCore::EntryInternal &entry : entries) {
93 result.append(toAlkEntry(entry));
94 }
95}
96#else
97QDebug operator<<(QDebug out, const KNS3::Entry &entry)
98{
99 out << entry.name() << entry.status();
100 return out;
101}
102
103QDebug operator<<(QDebug out, const KNS3::Entry::List &entries)
104{
105 out << "KNS3::Entry::List(";
106 for (auto &e : entries) {
107 out << e;
108 }
109 out << ")";
110
111 return out;
112}
113
114AlkNewStuffEntry toAlkEntry(const KNS3::Entry &entry)
115{
117 e.category = entry.category();
118 e.id = entry.id();
119 e.installedFiles = entry.installedFiles();
120 e.name = entry.name();
121 e.providerId = entry.providerId();
122 e.status = static_cast<AlkNewStuffEntry::Status>(entry.status());
123 e.version = entry.version();
124 return e;
125}
126
127void toAlkEntryList(AlkNewStuffEntryList &result, const KNS3::Entry::List &entries)
128{
129 for (const KNS3::Entry &entry : entries) {
130 result.append(toAlkEntry(entry));
131 }
132}
133#endif
Platform independent wrapper for new stuff entry.
QString providerId() const
QStringList installedFiles() const
QString category() const
QString name() const
QString uniqueId() const
QString version() const
KNSCore::Entry::Status status() const
QDebug operator<<(QDebug dbg, const DcrawInfoContainer &c)
void append(QList< T > &&value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.