mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-23 13:55:36 +08:00
refs #358, new finders for client list
This commit is contained in:
@@ -10,6 +10,8 @@
|
|||||||
#include "nwclientlist.h"
|
#include "nwclientlist.h"
|
||||||
#include "predicates.h"
|
#include "predicates.h"
|
||||||
|
|
||||||
|
using namespace BlackMisc::Aviation;
|
||||||
|
|
||||||
namespace BlackMisc
|
namespace BlackMisc
|
||||||
{
|
{
|
||||||
namespace Network
|
namespace Network
|
||||||
@@ -39,5 +41,21 @@ namespace BlackMisc
|
|||||||
registerMetaValueType<CClientList>();
|
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
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "nwclient.h"
|
#include "nwclient.h"
|
||||||
#include "sequence.h"
|
#include "sequence.h"
|
||||||
#include "collection.h"
|
#include "collection.h"
|
||||||
|
#include "blackmisc/avcallsign.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
@@ -39,6 +40,11 @@ namespace BlackMisc
|
|||||||
//! Register metadata
|
//! Register metadata
|
||||||
static void registerMetadata();
|
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
|
} //namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user