mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 11:05:44 +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;
|
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>
|
template <class OBJ, class CONTAINER, typename KEYTYPE>
|
||||||
KEYTYPE IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::getMaxKey(bool *ok) const
|
KEYTYPE IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::getMaxKey(bool *ok) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ namespace BlackMisc
|
|||||||
//! All keys as list
|
//! All keys as list
|
||||||
QSet<KEYTYPE> toDbKeySet() const;
|
QSet<KEYTYPE> toDbKeySet() const;
|
||||||
|
|
||||||
|
//! The DB keys as string
|
||||||
|
QString dbKeysAsStrings(const QString &separator) const;
|
||||||
|
|
||||||
//! Max.key value (making sense with integer key)
|
//! Max.key value (making sense with integer key)
|
||||||
KEYTYPE getMaxKey(bool *ok = nullptr) const;
|
KEYTYPE getMaxKey(bool *ok = nullptr) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user