swift
|
Class from which a derived class can inherit datastore-related functions. More...
Public Types | |
enum | ColumnIndex { IndexDbIntegerKey = CPropertyIndexRef::GlobalIndexIDatastoreInteger , IndexDbKeyAsString , IndexIsLoadedFromDb , IndexDatabaseIcon , IndexVersion , IndexEndMarker } |
Property index. More... | |
![]() | |
enum | ColumnIndex { IndexUtcTimestamp = CPropertyIndexRef::GlobalIndexITimestampBased , IndexUtcTimestampFormattedYmdhms , IndexUtcTimestampFormattedYmdhmsz , IndexUtcTimestampFormattedMdhms , IndexUtcTimestampFormattedMdhmsz , IndexUtcTimestampFormattedDhms , IndexUtcTimestampFormattedHms , IndexUtcTimestampFormattedHm , IndexMSecsSinceEpoch } |
Properties by index. | |
Public Member Functions | |
int | getDbKey () const |
Get DB key. | |
QString | getDbKeyAsString () const |
DB key as string. | |
QJsonValue | getDbKeyAsJsonValue () const |
Key as JSON value, or null. | |
QString | getDbKeyAsStringInParentheses (const QString &prefix={}) const |
Db key in parentheses, e.g. "(3)". | |
void | setDbKey (int key) |
Set the DB key. | |
void | setDbKey (const QString &key) |
DB key passed as string. | |
bool | hasValidDbKey () const |
Has valid DB key. | |
bool | isDbEqual (const IDatastoreObjectWithIntegerKey &other) const |
Same DB key and hence equal. | |
bool | isLoadedFromDb () const |
Loaded from DB. More... | |
bool | matchesDbKeyState (db::DbKeyStateFilter filter) const |
Matches filter? | |
const CIcon & | toDatabaseIcon () const |
Database icon if this has valid key, otherwise empty. | |
![]() | |
const QString & | getVersion () const |
Version info. | |
QVersionNumber | getQVersion () const |
Version as QVersion. | |
bool | hasVersion () const |
Having a version?s. | |
void | setVersion (const QString &version) |
Version info. | |
![]() | |
QDateTime | getUtcTimestamp () const |
Get timestamp. | |
qint64 | getMSecsSinceEpoch () const |
Timestamp as ms value. | |
qint64 | getTimeDifferenceMs (qint64 compareTime) const |
Time difference in ms. | |
qint64 | getTimeDifferenceAbsMs (qint64 compareTime) const |
Time difference in ms. | |
qint64 | getTimeDifferenceToNowMs () const |
Time difference to now. | |
qint64 | getTimeDifferenceMs (const ITimestampBased &compare) const |
Time difference in ms. | |
qint64 | getAbsTimeDifferenceMs (qint64 compareTime) const |
Time difference in ms. | |
qint64 | getAbsTimeDifferenceMs (const ITimestampBased &compare) const |
Time difference in ms. | |
void | setTimestampToNull () |
Set to null. | |
void | setMSecsSinceEpoch (qint64 mSecsSinceEpoch) |
Timestamp as ms value. | |
void | setByYearMonthDayHourMinute (const QString &yyyyMMddhhmmss) |
Set by value such as "20141003231045". | |
void | setUtcTimestamp (const QDateTime ×tamp) |
Set timestamp. | |
bool | isNewerThan (const ITimestampBased &otherTimestampObj) const |
Is this newer than other? | |
bool | isNewerThan (qint64 mSecsSinceEpoch) const |
Is newer than epoch value? | |
bool | isOlderThan (const ITimestampBased &otherTimestampObj) const |
Is this older than other? | |
bool | isOlderThan (qint64 mSecsSinceEpoch) const |
Is this older than other? | |
bool | isOlderThanNowMinusOffset (int offsetMs) const |
Older than now-offset. | |
bool | isSame (const ITimestampBased &otherTimestampObj) const |
Same timestamp. | |
qint64 | msecsTo (const ITimestampBased &otherTimestampObj) const |
Time difference. | |
qint64 | absMsecsTo (const ITimestampBased &otherTimestampObj) const |
Time difference. | |
qint64 | msecsToNow () const |
Milliseconds to now. | |
void | setCurrentUtcTime () |
Set the current time as timestamp. | |
void | addMsecs (qint64 ms) |
Add the given number of milliseconds to the timestamp. | |
QString | getFormattedUtcTimestampHms () const |
As hh:mm:ss. | |
QString | getFormattedUtcTimestampHmsz () const |
As hh:mm:ss.zzz. | |
QString | getFormattedUtcTimestampHm () const |
As hh:mm. | |
QString | getFormattedUtcTimestampDhms () const |
As dd HH mm ss. | |
QString | getFormattedUtcTimestampMdhms () const |
As MM dd HH mm ss. | |
QString | getFormattedUtcTimestampMdhmsz () const |
As MM dd HH mm ss.zzz. | |
QString | getFormattedUtcTimestampYmdhms () const |
As yyyy MM dd HH mm ss. | |
QString | getFormattedUtcTimestampYmdhmsz () const |
As yyyy MM dd HH mm ss.zzz. | |
bool | hasValidTimestamp () const |
Valid timestamp? | |
Static Public Member Functions | |
static int | invalidDbKey () |
Invalid key. | |
static int | stringToDbKey (const QString &candidate) |
Convert string to DB key. | |
static const CPropertyIndex & | keyIndex () |
The key index. | |
![]() | |
static bool | isAnyTimestampIndex (int index) |
Any of the timestamp indexes. | |
static bool | canHandleIndex (CPropertyIndexRef index) |
Can given index be handled. | |
Protected Member Functions | |
IDatastoreObjectWithIntegerKey () | |
Constructor. | |
IDatastoreObjectWithIntegerKey (int key) | |
Constructor. | |
void | setKeyVersionTimestampFromDatabaseJson (const QJsonObject &json, const QString &prefix=QString()) |
Set key and timestamp values. | |
QVariant | propertyByIndex (swift::misc::CPropertyIndexRef index) const |
Property by index. More... | |
void | setPropertyByIndex (swift::misc::CPropertyIndexRef index, const QVariant &variant) |
Set property by index. More... | |
int | comparePropertyByIndex (CPropertyIndexRef index, const IDatastoreObjectWithIntegerKey &compareValue) const |
Compare for index. More... | |
![]() | |
void | setTimestampVersionFromDatabaseJson (const QJsonObject &json, const QString &prefix=QString()) |
Set versionn and timestamp values. | |
![]() | |
ITimestampBased () | |
Constructor. | |
ITimestampBased (qint64 msSincePoch) | |
Constructor. | |
ITimestampBased (const QDateTime ×tamp) | |
Constructor. | |
QVariant | propertyByIndex (CPropertyIndexRef index) const |
Property by index. More... | |
void | setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant) |
Set property by index. More... | |
int | comparePropertyByIndex (CPropertyIndexRef index, const ITimestampBased &compareValue) const |
Compare for index. More... | |
void | updateMissingParts (const ITimestampBased &other) |
Update missing parts. | |
Static Protected Member Functions | |
static bool | existsKey (const QJsonObject &json, const QString &prefix=QString()) |
Is a key available? | |
static bool | canHandleIndex (swift::misc::CPropertyIndexRef index) |
Can given index be handled? | |
Protected Attributes | |
int | m_dbKey = -1 |
key | |
![]() | |
QString | m_version |
version info | |
![]() | |
qint64 | m_timestampMSecsSinceEpoch = -1 |
timestamp value | |
Class from which a derived class can inherit datastore-related functions.
Definition at line 69 of file datastore.h.
Property index.
Enumerator | |
---|---|
IndexEndMarker | keep as last element |
Definition at line 73 of file datastore.h.
|
protected |
Compare for index.
Definition at line 127 of file datastore.cpp.
bool swift::misc::db::IDatastoreObjectWithIntegerKey::isLoadedFromDb | ( | ) | const |
Loaded from DB.
Definition at line 49 of file datastore.cpp.
|
protected |
Property by index.
Definition at line 94 of file datastore.cpp.
|
protected |
Set property by index.
Definition at line 110 of file datastore.cpp.