swift
urlloglist.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_URLLOGLIST_H
7 #define SWIFT_MISC_NETWORK_URLLOGLIST_H
8 
9 #include <QNetworkReply>
10 
11 #include "misc/collection.h"
12 #include "misc/network/urllog.h"
13 #include "misc/sequence.h"
14 #include "misc/swiftmiscexport.h"
16 
17 SWIFT_DECLARE_SEQUENCE_MIXINS(swift::misc::network, CUrlLog, CUrlLogList)
18 
19 namespace swift::misc::network
20 {
23  public CSequence<CUrlLog>,
24  public ITimestampObjectList<CUrlLog, CUrlLogList>,
25  public mixin::MetaType<CUrlLogList>
26  {
27  public:
30 
32  CUrlLogList();
33 
35  CUrlLogList(const CSequence &other);
36 
38  int addPendingUrl(const CUrl &url, int maxNumber = 10);
39 
41  int addPendingUrl(const CUrl &url, QNetworkReply *nwReply, int maxNumber = 10);
42 
44  CUrlLogList findPending() const;
45 
47  CUrlLogList findOutdatedPending(int outdatedOffsetMs) const;
48 
50  CUrlLogList findErrors() const;
51 
53  int sizePending() const;
54 
56  bool hasPending() const;
57 
59  bool hasCompleted() const;
60 
62  int sizeErrors() const;
63 
65  CUrlLog findByIdOrDefault(int id) const;
66 
68  bool markAsReceived(int id, bool success);
69 
71  bool markAsReceived(const QNetworkReply *nwReply, bool success);
72 
74  bool containsId(int id) const;
75 
77  qint64 getMaxResponseTime() const;
78 
80  qint64 getMinResponseTime() const;
81 
83  qint64 getAverageResponseTime() const;
84 
86  QString getSummary() const;
87  };
88 } // namespace swift::misc::network
89 
90 Q_DECLARE_METATYPE(swift::misc::network::CUrlLogList)
92 
93 #endif // SWIFT_MISC_NETWORK_URLLOGLIST_H
Generic ordered container with value semantics.
Definition: collection.h:107
Generic sequential container with value semantics.
Definition: sequence.h:86
CSequence()=default
Default constructor.
List of objects with timestamp. Such objects should implement.
CRTP class template from which a derived class can inherit common methods dealing with the metatype o...
Definition: mixinmetatype.h:29
Value object encapsulating information of a location, kind of simplified CValueObject compliant versi...
Definition: url.h:27
Information about accessing one URL over the network.
Definition: urllog.h:24
Value object encapsulating a list of voice rooms.
Definition: urlloglist.h:26
#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 ...
#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.