8 namespace swift::misc::network
16 if (maxNumber > 0) this->
truncate(maxNumber - 1);
84 Q_ASSERT_X(nwReply, Q_FUNC_INFO,
"missing reply");
87 return (ok &&
id >= 0) ? this->
markAsReceived(
id, success) :
false;
106 qint64 min = std::numeric_limits<qint64>::max();
107 for (
const CUrlLog &rl : *
this)
119 for (
const CUrlLog &rl : *
this)
125 if (c == 0)
return 0;
131 static const QString s(
"Entries: %1, pending: %2, errors: %3, min: %4ms avg: %5ms max: %6ms");
132 if (this->
isEmpty())
return QStringLiteral(
"No data");
133 return s.arg(this->
size())
auto findFirstByOrDefault(Predicate p, const Value &def) const
Return a copy of the first element for which a given predicate returns true, or a default value if th...
bool contains(const T &object) const
Return true if there is an element equal to given object. Uses the most efficient implementation avai...
Generic sequential container with value semantics.
size_type size() const
Returns number of elements in the sequence.
CSequence findBy(Predicate p) const
Return a copy containing only those elements for which a given predicate returns true.
void truncate(size_type maxSize)
Changes the size of the sequence, if it is bigger than the given size.
void push_front(const CUrlLog &value)
Insert as first element.
bool isEmpty() const
Synonym for empty.
CONTAINER findBeforeNowMinusOffset(qint64 msOffset) const
List of objects before now - offset.
Value object encapsulating information of a location, kind of simplified CValueObject compliant versi...
Information about accessing one URL over the network.
static const char * propertyNameId()
Property name used for request.
qint64 getResponseTimeMs() const
Response time.
void setSuccess(bool s)
Set success.
bool isSuccess() const
Success?
bool isPending() const
Pending.
void setResponseTimestampToNow()
Set response time and response timestamp.
int getId() const
Unique id.
Value object encapsulating a list of voice rooms.
int sizePending() const
Pending calls.
bool markAsReceived(int id, bool success)
Mark as received.
CUrlLogList findPending() const
Find pending log entries.
bool hasCompleted() const
Any completed calls.
bool containsId(int id) const
Contains the id?
int sizeErrors() const
Erroneous calls.
CUrlLogList findOutdatedPending(int outdatedOffsetMs) const
Find outdated pending log entries.
bool hasPending() const
Any pending calls.
CUrlLogList()
Default constructor.
QString getSummary() const
Summary.
int addPendingUrl(const CUrl &url, int maxNumber=10)
Add a pending URL.
qint64 getMaxResponseTime() const
Maximum response time.
qint64 getAverageResponseTime() const
Average response time.
CUrlLogList findErrors() const
Find log entries with errors (not pending)
CUrlLog findByIdOrDefault(int id) const
Find by id.
qint64 getMinResponseTime() const
Minimum response time.
#define SWIFT_DEFINE_SEQUENCE_MIXINS(Namespace, T, List)
Explicit template definition of mixins for a CSequence subclass.