mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
Ref T104, utility function
This commit is contained in:
committed by
Mathew Sutcliffe
parent
4c5dca40d7
commit
922e39f61d
@@ -79,6 +79,20 @@ namespace BlackMisc
|
||||
return keys;
|
||||
}
|
||||
|
||||
template<class OBJ, class CONTAINER, typename KEYTYPE>
|
||||
QString IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::dbKeysAsStrings(const QString &separator) const
|
||||
{
|
||||
if (ITimestampObjectList<OBJ, CONTAINER>::container().isEmpty()) { return ""; }
|
||||
const QSet<KEYTYPE> keys = IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::toDbKeySet();
|
||||
QString s;
|
||||
for (const KEYTYPE &k : keys)
|
||||
{
|
||||
if (!s.isEmpty()) { s += separator; }
|
||||
s = s.append(k); // append works with string and int
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
template <class OBJ, class CONTAINER, typename KEYTYPE>
|
||||
KEYTYPE IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::getMaxKey(bool *ok) const
|
||||
{
|
||||
|
||||
@@ -38,6 +38,9 @@ namespace BlackMisc
|
||||
//! All keys as list
|
||||
QSet<KEYTYPE> toDbKeySet() const;
|
||||
|
||||
//! The DB keys as string
|
||||
QString dbKeysAsStrings(const QString &separator) const;
|
||||
|
||||
//! Max.key value (making sense with integer key)
|
||||
KEYTYPE getMaxKey(bool *ok = nullptr) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user