6 #ifndef SWIFT_MISC_DB_DATASTORE_H
7 #define SWIFT_MISC_DB_DATASTORE_H
13 #include <QVersionNumber>
35 Q_DECLARE_FLAGS(DbKeyStateFilter, DbKeyState)
51 QVersionNumber getQVersion()
const;
57 void setVersion(
const QString &version) { m_version = version; }
61 void setTimestampVersionFromDatabaseJson(
const QJsonObject &json,
const QString &prefix = QString());
75 IndexDbIntegerKey = CPropertyIndexRef::GlobalIndexIDatastoreInteger,
87 QString getDbKeyAsString()
const;
90 QJsonValue getDbKeyAsJsonValue()
const;
93 QString getDbKeyAsStringInParentheses(
const QString &prefix = {})
const;
99 void setDbKey(
const QString &key);
112 bool isLoadedFromDb()
const;
115 bool matchesDbKeyState(db::DbKeyStateFilter filter)
const;
118 const CIcon &toDatabaseIcon()
const;
124 static int stringToDbKey(
const QString &candidate);
141 void setKeyVersionTimestampFromDatabaseJson(
const QJsonObject &json,
const QString &prefix = QString());
144 static bool existsKey(
const QJsonObject &json,
const QString &prefix = QString());
171 IndexDbStringKey = CPropertyIndexRef::GlobalIndexIDatastoreString,
180 const QString &
getDbKey()
const {
return m_dbKey; }
186 QJsonValue getDbKeyAsJsonValue()
const;
189 QString getDbKeyAsStringInParentheses(
const QString &prefix = {})
const;
192 void setDbKey(
const QString &key) { m_dbKey = key.trimmed().toUpper(); }
210 bool matchesDbKeyState(db::DbKeyStateFilter filter)
const;
213 const CIcon &toDatabaseIcon()
const;
233 void setKeyVersionTimestampFromDatabaseJson(
const QJsonObject &json,
const QString &prefix = QString());
236 static bool existsKey(
const QJsonObject &json,
const QString &prefix = QString());
252 bool m_loadedFromDb =
259 Q_DECLARE_METATYPE(swift::misc::db::DbKeyStateFilter)
260 Q_DECLARE_OPERATORS_FOR_FLAGS(swift::misc::db::DbKeyStateFilter)
Value object for icons. An icon is stored in the global icon repository and identified by its index....
Non-owning reference to a CPropertyIndex with a subset of its features.
Supposed to be used only in filter operations.
QString m_version
version info
const QString & getVersion() const
Version info.
bool hasVersion() const
Having a version?s.
void setVersion(const QString &version)
Version info.
Class from which a derived class can inherit datastore-related functions.
int getDbKey() const
Get DB key.
IDatastoreObjectWithIntegerKey()
Constructor.
bool isLoadedFromDb() const
Loaded from DB.
ColumnIndex
Property index.
void setDbKey(int key)
Set the DB key.
static int invalidDbKey()
Invalid key.
bool isDbEqual(const IDatastoreObjectWithIntegerKey &other) const
Same DB key and hence equal.
IDatastoreObjectWithIntegerKey(int key)
Constructor.
static const CPropertyIndex & keyIndex()
The key index.
bool hasValidDbKey() const
Has valid DB key.
Class from which a derived class can inherit datastore-related functions.
QString getDbKeyAsString() const
DB key as string.
bool isLoadedFromDb() const
Loaded from DB.
void setLoadedFromDb(bool loaded)
Mark as loaded from DB.
IDatastoreObjectWithStringKey()
Constructor.
IDatastoreObjectWithStringKey(const QString &key)
Constructor.
bool hasValidDbKey() const
Has valid DB key.
static QString invalidDbKey()
Invalid key.
bool isDbEqual(const IDatastoreObjectWithStringKey &other) const
Same DB key and hence equal.
const QString & getDbKey() const
Get DB key.
ColumnIndex
Property index.
static const CPropertyIndex & keyIndex()
The key index.
void setDbKey(const QString &key)
Set the DB key.
DbKeyState
State of key (in DB, ...?)
Free functions in swift::misc.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.