mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 15:45:46 +08:00
refs #358, new finders for client list
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
#include "nwclientlist.h"
|
||||
#include "predicates.h"
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Network
|
||||
@@ -39,5 +41,21 @@ namespace BlackMisc
|
||||
registerMetaValueType<CClientList>();
|
||||
}
|
||||
|
||||
/*
|
||||
* Find by callsign
|
||||
*/
|
||||
CClientList CClientList::findByCallsign(const CCallsign &callsign) const
|
||||
{
|
||||
return findBy(&CClient::getCallsign, callsign);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find by callsign
|
||||
*/
|
||||
CClient CClientList::findFirstByCallsign(const CCallsign &callsign, const CClient &ifNotFound) const
|
||||
{
|
||||
return this->findByCallsign(callsign).frontOrDefault(ifNotFound);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "nwclient.h"
|
||||
#include "sequence.h"
|
||||
#include "collection.h"
|
||||
#include "blackmisc/avcallsign.h"
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
@@ -39,6 +40,11 @@ namespace BlackMisc
|
||||
//! Register metadata
|
||||
static void registerMetadata();
|
||||
|
||||
//! Find by callsign
|
||||
CClientList findByCallsign(const BlackMisc::Aviation::CCallsign &callsign) const;
|
||||
|
||||
//! First by callsign
|
||||
CClient findFirstByCallsign(const BlackMisc::Aviation::CCallsign &callsign, const CClient &ifNotFound = CClient()) const;
|
||||
};
|
||||
|
||||
} //namespace
|
||||
|
||||
Reference in New Issue
Block a user