6#ifndef SWIFT_CORE_THREADED_READER_H
7#define SWIFT_CORE_THREADED_READER_H
14#include <QReadWriteLock>
86 QPair<qint64, qint64> getNetworkReplyBytes()
const;
130 static constexpr int OutdatedPendingCallMs = 30 * 1000;
133 size_t m_contentHash = 0;
134 std::atomic_bool m_markedAsFailed {
false };
135 bool m_unitTest {
false };
std::atomic_llong m_networkReplyCurrent
current bytes
QDateTime getUpdateTimestamp() const
Thread safe, get update timestamp.
void setUpdateTimestamp(const QDateTime &updateTimestamp=QDateTime::currentDateTimeUtc())
Thread safe, set update timestamp.
static const QStringList & getLogCategories()
Log categories.
virtual void networkReplyProgress(int logId, qint64 current, qint64 max, const QUrl &url)
Network request progress.
static void logInconsistentData(const swift::misc::CStatusMessage &msg, const char *funcInfo=nullptr)
Use this to log inconsistent data.
swift::misc::network::CUrlLogList getReadLog() const
Get the read log.
void setMarkedAsFailed(bool failed)
Set marker for read failed.
std::atomic_int m_networkReplyProgress
Progress percentage 0...100.
bool isMarkedAsFailed() const
Is marked as read failed.
void threadAssertCheck() const
Make sure everything runs correctly in own thread.
void logNetworkReplyReceived(QNetworkReply *reply)
Network reply received, mark in m_urlReadLog.
CThreadedReader(CThreadedReader &&)=delete
Move constructor.
QReadWriteLock m_lock
lock which can be used from the derived classes
void markAsUsedInUnitTest()
Used in unit test.
bool didContentChange(const QString &content, int startPosition=-1)
Stores new content hash and returns if content changed (based on hash value.
CThreadedReader & operator=(CThreadedReader &&)=delete
Move assignment.
CThreadedReader(const CThreadedReader &)=delete
Copy constructor.
QNetworkReply * getFromNetworkAndLog(const swift::misc::network::CUrl &url, const swift::misc::CSlot< void(QNetworkReply *)> &callback)
Get request from network, and log with m_urlReadLog.
~CThreadedReader()=default
Destructor.
bool doWorkCheck() const
Still enabled etc.?
CThreadedReader & operator=(const CThreadedReader &)=delete
Copy assignment.
qint64 lastModifiedMsSinceEpoch(QNetworkReply *nwReply) const
When was reply last modified, -1 if N/A.
std::atomic_llong m_networkReplyMax
max bytes
Base class for a long-lived worker object which lives in its own thread.
const QObject * owner() const
Owner of the worker.
Callable wrapper for a member function with function signature F.
Streamable status message, e.g.
Value object encapsulating information of a location, kind of simplified CValueObject compliant versi...
Value object encapsulating a list of voice rooms.
Backend services of the swift project, like dealing with the network or the simulators.
QDateTime currentDateTimeUtc()
#define SWIFT_CORE_EXPORT
Export a class or function from the library.