Ref T658, model list utility functions (to be exposed as Js object)

This commit is contained in:
Klaus Basan
2019-06-04 23:45:09 +02:00
committed by Mat Sutcliffe
parent ef2398f6a9
commit 6eb6cea9ad
4 changed files with 48 additions and 1 deletions

View File

@@ -261,6 +261,17 @@ namespace BlackMisc
return false;
}
template<class OBJ, class CONTAINER, typename KEYTYPE>
bool IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::containsDbKey(KEYTYPE key) const
{
for (const OBJ &obj : ITimestampObjectList<OBJ, CONTAINER>::container())
{
if (!obj.hasValidDbKey()) { continue; }
if (obj.getDbKey() == key) { return true; }
}
return false;
}
template<class OBJ, class CONTAINER, typename KEYTYPE>
CONTAINER IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::fromMultipleJsonFormats(const QJsonObject &jsonObject)
{

View File

@@ -84,6 +84,9 @@ namespace BlackMisc
//! Any object without key?
bool containsAnyObjectWithoutKey() const;
//! Contains object with key?
bool containsDbKey(KEYTYPE key) const;
//! From multiple JSON formats
//! \remark supports native swift C++ format, DB format, and cache format
static CONTAINER fromMultipleJsonFormats(const QJsonObject &jsonObject);