mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-08 03:35:35 +08:00
Ref T280, definitions for QHash<CCallsign, T> for
* situation * situation list * client * parts * parts list * functions to convert standard swift containers into QMap/QHash<CCallign, T>
This commit is contained in:
@@ -30,15 +30,5 @@ namespace BlackMisc
|
||||
if (this->isEmpty()) { return static_cast<CClient::Capabilities>(CClient::None); }
|
||||
return this->findFirstByCallsign(callsign).getCapabilities();
|
||||
}
|
||||
|
||||
QMap<CCallsign, CClient> CClientList::asMap() const
|
||||
{
|
||||
QMap<CCallsign, CClient> map;
|
||||
for (const CClient &client : *this)
|
||||
{
|
||||
map.insert(client.getCallsign(), client);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
#define BLACKMISC_NETWORK_CLIENTLIST_H
|
||||
|
||||
#include "blackmisc/aviation/callsignobjectlist.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/collection.h"
|
||||
#include "blackmisc/network/client.h"
|
||||
#include "blackmisc/sequence.h"
|
||||
#include "blackmisc/variant.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include <QMap>
|
||||
#include <QMetaType>
|
||||
|
||||
@@ -45,15 +45,16 @@ namespace BlackMisc
|
||||
|
||||
//! Capabilities of client for callsign
|
||||
CClient::Capabilities getCapabilities(const Aviation::CCallsign &callsign) const;
|
||||
|
||||
//! As map
|
||||
QMap<Aviation::CCallsign, CClient> asMap() const;
|
||||
};
|
||||
|
||||
//! Client per callsign
|
||||
using CClientPerCallsign = QHash<Aviation::CCallsign, CClient>;
|
||||
} //namespace
|
||||
} // namespace
|
||||
|
||||
Q_DECLARE_METATYPE(BlackMisc::Network::CClientList)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Network::CClient>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Network::CClient>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Network::CClientPerCallsign)
|
||||
|
||||
#endif //guard
|
||||
|
||||
Reference in New Issue
Block a user