diff --git a/src/blackcore/db/databasereader.cpp b/src/blackcore/db/databasereader.cpp index d22a7b138..30c8f8586 100644 --- a/src/blackcore/db/databasereader.cpp +++ b/src/blackcore/db/databasereader.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include using namespace BlackMisc; @@ -47,7 +48,7 @@ namespace BlackCore namespace Db { CDatabaseReader::CDatabaseReader(QObject *owner, const CDatabaseReaderConfigList &config, const QString &name) : - BlackCore::CThreadedReader(owner, name), m_config(config) + CThreadedReader(owner, name), m_config(config) { } void CDatabaseReader::readInBackgroundThread(CEntityFlags::Entity entities, const QDateTime &newerThan) @@ -724,7 +725,7 @@ namespace BlackCore QString CDatabaseReader::queryLatestTimestamp(const QDateTime &ts) { if (!ts.isValid()) return {}; - const QString q = parameterLatestTimestamp() + "=" + dateTimeToDbLatestTs(ts); + const QString q = parameterLatestTimestamp() % u"=" % dateTimeToDbLatestTs(ts); return q; } diff --git a/src/blackmisc/aviation/aircraftcategory.cpp b/src/blackmisc/aviation/aircraftcategory.cpp index 05d7920af..3f71c619c 100644 --- a/src/blackmisc/aviation/aircraftcategory.cpp +++ b/src/blackmisc/aviation/aircraftcategory.cpp @@ -131,10 +131,10 @@ namespace BlackMisc const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexName: return m_name.compare(compareValue.getName(), Qt::CaseInsensitive); - case IndexPath: return m_description.compare(compareValue.getPath(), Qt::CaseInsensitive); + case IndexName: return m_name.compare(compareValue.getName(), Qt::CaseInsensitive); + case IndexPath: return m_description.compare(compareValue.getPath(), Qt::CaseInsensitive); case IndexDescription: return m_path.compare(compareValue.getDescription(), Qt::CaseInsensitive); - case IndexAssignable: return Compare::compare(this->isAssignable(), compareValue.isAssignable()); + case IndexAssignable: return Compare::compare(this->isAssignable(), compareValue.isAssignable()); default: return CValueObject::comparePropertyByIndex(index, *this); } Q_ASSERT_X(false, Q_FUNC_INFO, "No comparison"); diff --git a/src/blackmisc/aviation/aircraftcategorylist.h b/src/blackmisc/aviation/aircraftcategorylist.h index 7d1b32c28..65ad24815 100644 --- a/src/blackmisc/aviation/aircraftcategorylist.h +++ b/src/blackmisc/aviation/aircraftcategorylist.h @@ -13,8 +13,8 @@ #define BLACKMISC_AVIATION_AIRCRAFTCATEGORYLIST_H #include "aircraftcategory.h" -#include "blackmisc/collection.h" #include "blackmisc/db/datastoreobjectlist.h" +#include "blackmisc/collection.h" #include "blackmisc/sequence.h" #include "blackmisc/variant.h" #include "blackmisc/blackmiscexport.h" diff --git a/src/blackmisc/db/dbinfo.cpp b/src/blackmisc/db/dbinfo.cpp index 85e29dab8..ae916565e 100644 --- a/src/blackmisc/db/dbinfo.cpp +++ b/src/blackmisc/db/dbinfo.cpp @@ -9,7 +9,7 @@ #include "dbinfo.h" #include "blackmisc/comparefunctions.h" -#include +#include using namespace BlackMisc::Network; @@ -22,17 +22,17 @@ namespace BlackMisc m_tableName(tableName.trimmed().toLower()), m_entries(entries) { this->setEntity(this->getEntity()); - Q_ASSERT_X(tableName.isEmpty() || this->m_entity != CEntityFlags::NoEntity, Q_FUNC_INFO, "Wrong entity"); + Q_ASSERT_X(tableName.isEmpty() || m_entity != CEntityFlags::NoEntity, Q_FUNC_INFO, "Wrong entity"); } bool CDbInfo::isValid() const { - return this->m_entity != CEntityFlags::NoEntity && !this->m_tableName.isEmpty(); + return m_entity != CEntityFlags::NoEntity && !m_tableName.isEmpty(); } CEntityFlags::Entity CDbInfo::getEntity() const { - if (this->m_entity != CEntityFlags::NoEntity) { return this->m_entity; } + if (m_entity != CEntityFlags::NoEntity) { return m_entity; } const QString tn(this->getTableName()); return CEntityFlags::singleEntityByName(tn); } @@ -51,7 +51,7 @@ namespace BlackMisc void CDbInfo::setEntity(CEntityFlags::Entity entity) { - this->m_entity = entity; + m_entity = entity; } bool CDbInfo::matchesEntity(CEntityFlags::Entity entity) const @@ -62,27 +62,24 @@ namespace BlackMisc void CDbInfo::setTableName(const QString &tableName) { m_tableName = tableName.trimmed().toLower(); - this->m_entity = this->getEntity(); + m_entity = this->getEntity(); } QString CDbInfo::convertToQString(bool i18n) const { Q_UNUSED(i18n); - return QStringLiteral("Table %1 with entries %1").arg(this->m_tableName).arg(this->m_entries); + return QStringLiteral("Table %1 with entries %1").arg(m_tableName).arg(m_entries); } CVariant CDbInfo::propertyByIndex(const BlackMisc::CPropertyIndex &index) const { if (index.isMyself()) { return CVariant::from(*this); } - ColumnIndex i = index.frontCasted(); + const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexTableName: - return CVariant::fromValue(m_tableName); - case IndexEntries: - return CVariant::fromValue(m_entries); - case IndexEntity: - return CVariant::fromValue(m_entity); + case IndexTableName: return CVariant::fromValue(m_tableName); + case IndexEntries: return CVariant::fromValue(m_entries); + case IndexEntity: return CVariant::fromValue(m_entity); default: return (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) ? IDatastoreObjectWithIntegerKey::propertyByIndex(index) : @@ -93,18 +90,12 @@ namespace BlackMisc void CDbInfo::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) { if (index.isMyself()) { (*this) = variant.to(); return; } - ColumnIndex i = index.frontCasted(); + const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexTableName: - this->setTableName(variant.toQString()); - break; - case IndexEntries: - this->setTableName(variant.toQString()); - break; - case IndexEntity: - this->setEntity(static_cast(variant.toInt())); - break; + case IndexTableName: this->setTableName(variant.toQString()); break; + case IndexEntries: this->setTableName(variant.toQString()); break; + case IndexEntity: this->setEntity(static_cast(variant.toInt())); break; default: if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { @@ -122,15 +113,12 @@ namespace BlackMisc { if (index.isMyself()) { return getTableName().compare(compareValue.getTableName(), Qt::CaseInsensitive); } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::comparePropertyByIndex(index, compareValue);} - ColumnIndex i = index.frontCasted(); + const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexTableName: - return getTableName().compare(compareValue.getTableName(), Qt::CaseInsensitive); - case IndexEntries: - return Compare::compare(this->getEntries(), compareValue.getEntries()); - case IndexEntity: - return Compare::compare(this->getEntity(), compareValue.getEntity()); + case IndexTableName: return this->getTableName().compare(compareValue.getTableName(), Qt::CaseInsensitive); + case IndexEntries: return Compare::compare(this->getEntries(), compareValue.getEntries()); + case IndexEntity: return Compare::compare(this->getEntity(), compareValue.getEntity()); default: Q_ASSERT_X(false, Q_FUNC_INFO, "No comparison possible"); } @@ -144,9 +132,9 @@ namespace BlackMisc // when using relationship, this can be null return CDbInfo(); } - const int id(json.value(prefix + "id").toInt()); - const int entries(json.value(prefix + "entries").toInt()); - const QString tableName(json.value(prefix + "tablename").toString()); + const int id(json.value(prefix % u"id").toInt()); + const int entries(json.value(prefix % u"entries").toInt()); + const QString tableName(json.value(prefix % u"tablename").toString()); CDbInfo dbInfo(id, tableName, entries); dbInfo.setKeyVersionTimestampFromDatabaseJson(json, prefix); return dbInfo; diff --git a/src/blackmisc/db/dbinfo.h b/src/blackmisc/db/dbinfo.h index 0154f1967..7b5b39739 100644 --- a/src/blackmisc/db/dbinfo.h +++ b/src/blackmisc/db/dbinfo.h @@ -16,7 +16,6 @@ #include "blackmisc/network/entityflags.h" #include "blackmisc/valueobject.h" #include "blackmisc/blackmiscexport.h" -#include namespace BlackMisc { @@ -33,7 +32,7 @@ namespace BlackMisc //! Properties by index enum ColumnIndex { - IndexTableName = BlackMisc::CPropertyIndex::GlobalIndexCDbInfo, + IndexTableName = CPropertyIndex::GlobalIndexCDbInfo, IndexEntries, IndexEntity }; @@ -107,7 +106,7 @@ namespace BlackMisc private: QString m_tableName; //!< table name int m_entries; //!< number of entries - BlackMisc::Network::CEntityFlags::Entity m_entity = BlackMisc::Network::CEntityFlags::NoEntity; //!< lazy initialized entity + Network::CEntityFlags::Entity m_entity = Network::CEntityFlags::NoEntity; //!< lazy initialized entity BLACK_METACLASS( CDbInfo,