swift
Loading...
Searching...
No Matches
distributionlist.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2017 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#ifndef SWIFT_MISC_DB_DISTRIBUTIONLIST_H
7#define SWIFT_MISC_DB_DISTRIBUTIONLIST_H
8
9#include <QSet>
10#include <QString>
11
12#include "misc/collection.h"
15#include "misc/platform.h"
16#include "misc/sequence.h"
18
19SWIFT_DECLARE_SEQUENCE_MIXINS(swift::misc::db, CDistribution, CDistributionList)
20
21namespace swift::misc::db
22{
28 public CSequence<CDistribution>,
29 public IDatastoreObjectList<CDistribution, CDistributionList, int>,
30 public mixin::MetaType<CDistributionList>
31 {
32 public:
35
37 CDistributionList() = default;
38
41
44
47
49 bool containsEqualOrMoreStable(CDistribution &distribution) const;
50
52 bool containsUnrestricted() const;
53
55 bool containsChannel(const QString &channel) const;
56
59
61 CDistributionList findByRestriction(bool restricted) const;
62
65
68
71
73 static CDistributionList fromDatabaseJson(const QString &json);
74 };
75} // namespace swift::misc::db
76
77Q_DECLARE_METATYPE(swift::misc::db::CDistributionList)
79
80#endif // SWIFT_MISC_DB_DISTRIBUTIONLIST_H
Generic ordered container with value semantics.
Definition collection.h:113
CSequence()=default
Default constructor.
Distributions for channel.
Multiple distributions for different channels:
bool containsUnrestricted() const
Contains any unrestricted.
CDistribution getMostStableOrDefault() const
Most stable or default.
CSequence()=default
Default constructor.
CDistributionList()=default
Empty constructor.
CDistribution findFirstByChannelOrDefault(const QString &channel) const
Find by channel.
QStringList getChannels() const
All channels.
void sortByStability(Qt::SortOrder order=Qt::AscendingOrder)
Stability.
CDistributionList findByRestriction(bool restricted) const
Find by restriction flag.
bool containsChannel(const QString &channel) const
Contains channel?
CDistribution getLeastStableOrDefault() const
Least stable or default.
static CDistributionList fromDatabaseJson(const QJsonArray &array)
From database JSON by array.
bool containsEqualOrMoreStable(CDistribution &distribution) const
Contains distributions considered of same stability or more stable.
CRTP class template from which a derived class can inherit common methods dealing with the metatype o...
#define SWIFT_MISC_DECLARE_USING_MIXIN_METATYPE(DERIVED)
When a derived class and a base class both inherit from mixin::MetaType, the derived class uses this ...
SortOrder
#define SWIFT_DECLARE_SEQUENCE_MIXINS(Namespace, T, List)
Explicit template declaration of mixins for a CSequence subclass to be placed near the top of the hea...
Definition sequence.h:62
#define SWIFT_MISC_EXPORT
Export a class or function from the library.