mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 18:35:35 +08:00
refs #899, added replaceOrAddObjectsByCallsign utility function
This commit is contained in:
committed by
Mathew Sutcliffe
parent
f71e717ec1
commit
297fef7c3c
@@ -173,6 +173,24 @@ namespace BlackMisc
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class OBJ, class CONTAINER>
|
||||||
|
int ICallsignObjectList<OBJ, CONTAINER>::replaceOrAddObjectsByCallsign(const CONTAINER &others)
|
||||||
|
{
|
||||||
|
if (others.isEmpty()) { return 0; }
|
||||||
|
int c = 0;
|
||||||
|
CONTAINER copy(this->container());
|
||||||
|
for (const OBJ &obj : others)
|
||||||
|
{
|
||||||
|
const CCallsign cs(obj.getCallsign());
|
||||||
|
if (cs.isEmpty()) continue;
|
||||||
|
copy.removeByCallsign(cs);
|
||||||
|
copy.push_back(obj);
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
*this = copy;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
template <class OBJ, class CONTAINER>
|
template <class OBJ, class CONTAINER>
|
||||||
void ICallsignObjectList<OBJ, CONTAINER>::sortByCallsign()
|
void ICallsignObjectList<OBJ, CONTAINER>::sortByCallsign()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ namespace BlackMisc
|
|||||||
//! Split into 0..n containers as per callsign
|
//! Split into 0..n containers as per callsign
|
||||||
QHash<BlackMisc::Aviation::CCallsign, CONTAINER> splitPerCallsign() const;
|
QHash<BlackMisc::Aviation::CCallsign, CONTAINER> splitPerCallsign() const;
|
||||||
|
|
||||||
|
//! Replace or add objects by callsign
|
||||||
|
int replaceOrAddObjectsByCallsign(const CONTAINER &others);
|
||||||
|
|
||||||
//! Incremental update or add object
|
//! Incremental update or add object
|
||||||
int incrementalUpdateOrAdd(const OBJ &objectBeforeChanged, const BlackMisc::CPropertyIndexVariantMap &changedValues);
|
int incrementalUpdateOrAdd(const OBJ &objectBeforeChanged, const BlackMisc::CPropertyIndexVariantMap &changedValues);
|
||||||
|
|||||||
Reference in New Issue
Block a user