swift
|
List of objects read from database. Such objects should implement. More...
Public Member Functions | |
OBJ | findByKey (KEYTYPE key, const OBJ ¬Found=OBJ()) const |
Object with key, notFound otherwise. | |
CONTAINER | findByKeys (const QSet< KEYTYPE > &keys) const |
Object with key, notFound otherwise. | |
CONTAINER | findObjectsWithDbKey () const |
Objects with DB key. | |
CONTAINER | findObjectsWithoutDbKey () const |
Objects without DB key. | |
OBJ | maxKeyObject () const |
Object with max.key. | |
void | sortByKey () |
Sort by timestamp. | |
QSet< KEYTYPE > | toDbKeySet () const |
All keys as set. | |
QMap< KEYTYPE, OBJ > | toDbKeyValueMap () const |
As map with DB key/object. | |
QSet< QString > | toDbKeyStringSet () const |
All keys as string set (also integer keys will be converted to string) | |
QString | dbKeysAsString (const QString &separator) const |
The DB keys as string. | |
KEYTYPE | getMaxKey (bool *ok=nullptr) const |
Max.key value (making sense with integer key) | |
int | removeObjectsWithKeys (const QSet< KEYTYPE > &keys) |
Remove objects with keys. | |
int | removeObjectsWithoutDbKey () |
Remove objects without key. | |
int | replaceOrAddObjectsByKey (const CONTAINER &container) |
Update or insert data (based on DB key) | |
QDateTime | latestDbTimestamp () const |
Latest DB timestamp (means objects with DB key) | |
QDateTime | oldestDbTimestamp () const |
Latest DB timestamp (means objects with DB key) | |
int | countWithValidDbKey (bool withKey) const |
Number of objects with/without key. | |
int | countWithValidDbKey () const |
Number of entries with valid DB key. | |
bool | containsAnyObjectWithoutKey () const |
Any object without key? | |
bool | containsDbKey (KEYTYPE key) const |
Contains object with key? | |
![]() | |
CONTAINER | findBefore (const QDateTime &dateTime) const |
List of objects before dateTime (older) | |
CONTAINER | findBefore (qint64 msSinceEpoch) const |
List of objects before msSinceEpoch (older) | |
OBJ | findObjectBeforeOrDefault (qint64 msSinceEpoch) const |
Object before timestamp or default (older) | |
CONTAINER | findBeforeAndRemove (qint64 msSinceEpoch) |
Get objects before msSinceEpoch and remove those. | |
CONTAINER | findBeforeNowMinusOffset (qint64 msOffset) const |
List of objects before now - offset. | |
CONTAINER | findAfter (const QDateTime &dateTime) const |
List of objects after dateTime (newer) | |
CONTAINER | findAfter (qint64 msSinceEpoch) const |
List of objects after msSinceEpoch (newer) | |
CONTAINER | findAfterNowMinusOffset (qint64 msOffset) const |
List of objects before now - offset. | |
OBJ | findObjectAfterOrDefault (qint64 msSinceEpoch) const |
List of objects after msSinceEpoch (newer) | |
CONTAINER | findInvalidTimestamps () const |
Objects without valid timestamp. | |
OBJ | findClosestTimeDistance (qint64 msSinceEpoch) const |
Find closest (or default) | |
bool | hasInvalidTimestamps () const |
Has invalid timestamp. | |
void | setCurrentUtcTime () |
Set all timestamps to now. | |
void | setUtcTime (qint64 msSinceEpoch) |
Set all timestamps to given time. | |
void | setInvalidTimestampsToCurrentUtcTime () |
Set invalid timestamps to now. | |
QDateTime | latestTimestamp () const |
Latest timestamp. | |
qint64 | latestTimestampMsecsSinceEpoch () const |
Latest timestamp. | |
QDateTime | oldestTimestamp () const |
Oldest timestamp. | |
qint64 | oldestTimestampMsecsSinceEpoch () const |
Oldest timestamp. | |
OBJ | latestObject () const |
Latest object. | |
OBJ | oldestObject () const |
Latest object. | |
int | removeBefore (const QDateTime &dateTime) |
Remove objects with timestamp before dateTime. | |
int | removeBefore (qint64 msSinceEpoch) |
Remove objects with timestamp before dateTime. | |
int | removeOlderThanNowMinusOffset (qint64 offsetMs) |
Remove objects older than seconds. | |
void | sortLatestFirst () |
Sort by timestamp. | |
void | sortOldestFirst () |
Sort by timestamp. | |
void | push_frontKeepLatestFirst (const OBJ &value, bool replaceSameTimestamp=true, int maxElements=-1) |
Insert as first element by keeping maxElements and the latest first. | |
void | push_backIncreaseTimestamp (const OBJ &newObject) |
Push back and increase the timestamp at least by +1ms if equal to last element. More... | |
void | push_backOverrideTimestamp (const OBJ &newObject, qint64 newTsMsSinceEpoch) |
Push back, but set new timestamp. | |
void | setNewTimestampStartingLast (qint64 startTimeStampMs, qint64 deltaTimeMs) |
Set new timestamps starting with the last element. | |
int | replaceIfSameTimestamp (const OBJ &newObject) |
Replace if an object has the same timestamp. | |
bool | isSortedLatestLast () const |
Is completely sorted: latest last. More... | |
bool | isSortedLatestFirst () const |
Is completely sorted: latest last. More... | |
void | addMsecs (qint64 msToAdd) |
Adds a time to all values. | |
void | setSortHint (HintTimestampSort hint) |
Set the hint. | |
MillisecondsMinMaxMean | getTimestampDifferenceMinMaxMean () const |
Difference of timestamp values. More... | |
Static Public Member Functions | |
static CONTAINER | fromMultipleJsonFormats (const QJsonObject &jsonObject) |
From multiple JSON formats. More... | |
static CONTAINER | fromMultipleJsonFormats (const QString &jsonString) |
From multiple JSON formats. More... | |
static CONTAINER | fromDatabaseJson (const QJsonArray &array) |
From DB JSON with default prefixes. More... | |
static CONTAINER | fromDatabaseJson (const QJsonArray &array, const QString &prefix) |
From DB JSON. More... | |
Protected Member Functions | |
IDatastoreObjectList ()=default | |
Constructor. | |
![]() | |
ITimestampObjectList ()=default | |
Constructor. | |
const CONTAINER & | container () const |
Container. | |
CONTAINER & | container () |
Container. | |
Additional Inherited Members | |
![]() | |
enum | HintTimestampSort { NoTimestampSortHint , TimestampLatestFirst , TimestampLatestLast } |
Hint if the list is sorted. | |
![]() | |
HintTimestampSort | m_tsSortHint = NoTimestampSortHint |
sort hint | |
List of objects read from database. Such objects should implement.
Definition at line 26 of file datastoreobjectlist.h.
|
inlinestatic |
From DB JSON with default prefixes.
Definition at line 328 of file datastoreobjectlist.h.
|
inlinestatic |
From DB JSON.
Definition at line 337 of file datastoreobjectlist.h.
|
inlinestatic |
From multiple JSON formats.
Definition at line 264 of file datastoreobjectlist.h.
|
inlinestatic |
From multiple JSON formats.
Definition at line 313 of file datastoreobjectlist.h.