swift
Loading...
Searching...
No Matches
remotefilelist.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_NETWORK_REMOTEFILELIST_H
7#define SWIFT_MISC_NETWORK_REMOTEFILELIST_H
8
9#include <QJsonArray>
10#include <QMetaType>
11#include <QString>
12#include <QStringList>
13
14#include "misc/collection.h"
16#include "misc/sequence.h"
18
19SWIFT_DECLARE_SEQUENCE_MIXINS(swift::misc::network, CRemoteFile, CRemoteFileList)
20
21namespace swift::misc::network
22{
24 class SWIFT_MISC_EXPORT CRemoteFileList : public CSequence<CRemoteFile>, public mixin::MetaType<CRemoteFileList>
25 {
26 public:
29
31 CRemoteFileList() = default;
32
35
37 QStringList getNames(bool sorted = true) const;
38
40 QStringList getBaseNamesPlusSize(bool sorted = true) const;
41
44
47
50
53
55 qint64 getTotalFileSize() const;
56
59
61 static CRemoteFileList fromDatabaseJson(const QJsonArray &array);
62
64 static CRemoteFileList fromDatabaseJson(const QString &json);
65 };
66} // namespace swift::misc::network
67
70
71#endif // SWIFT_MISC_NETWORK_REMOTEFILELIST_H
Generic ordered container with value semantics.
Definition collection.h:113
CSequence()=default
Default constructor.
Q_REQUIRED_RESULT CSequence sorted(Predicate p) const
Definition sequence.h:610
CRTP class template from which a derived class can inherit common methods dealing with the metatype o...
Value object encapsulating a list of remote files.
CRemoteFile findFirstContainingNameOrDefault(const QString &name, Qt::CaseSensitivity cs) const
First by name contained of default.
QStringList getBaseNamesPlusSize(bool sorted=true) const
All file names plus size.
QString getTotalFileSizeHumanReadable() const
Size formatted.
QStringList getNames(bool sorted=true) const
All file names.
CSequence()=default
Default constructor.
CRemoteFileList findExecutableFiles() const
Find all executable files (decided by appendix).
CRemoteFileList()=default
Default constructor.
static CRemoteFileList fromDatabaseJson(const QJsonArray &array)
From our database JSON format.
CRemoteFile findFirstByNameOrDefault(const QString &name) const
First by name of default.
CRemoteFile findFirstByMatchingBaseNameOrDefault(const QString &name) const
Find first matching name of default.
qint64 getTotalFileSize() const
Size of all files.
#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 ...
CaseSensitivity
#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.