Add network device discovery result sorting by ip address
This commit is contained in:
parent
cbb7a2a7f1
commit
19e21b9dd4
@ -96,50 +96,6 @@ bool NetworkDeviceInfo::isValid() const
|
|||||||
return (!m_address.isNull() || !m_macAddress.isEmpty()) && m_networkInterface.isValid();
|
return (!m_address.isNull() || !m_macAddress.isEmpty()) && m_networkInterface.isValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
//bool NetworkDeviceInfo::operator!=(const NetworkDeviceInfo &other) const
|
|
||||||
//{
|
|
||||||
// return !(*this == other);
|
|
||||||
//}
|
|
||||||
|
|
||||||
//bool NetworkDeviceInfo::operator==(const NetworkDeviceInfo &other) const
|
|
||||||
//{
|
|
||||||
// return m_address == other.address() &&
|
|
||||||
// m_macAddress == other.macAddress() &&
|
|
||||||
// m_macAddressManufacturer == other.macAddressManufacturer() &&
|
|
||||||
// m_hostName == other.hostName();
|
|
||||||
//}
|
|
||||||
|
|
||||||
//bool NetworkDeviceInfo::operator<(const NetworkDeviceInfo &other) const
|
|
||||||
//{
|
|
||||||
|
|
||||||
// return m_address.toIPv4Address() < other.address().toIPv4Address();
|
|
||||||
//}
|
|
||||||
|
|
||||||
//bool NetworkDeviceInfo::operator<=(const NetworkDeviceInfo &other) const
|
|
||||||
//{
|
|
||||||
// return m_address.toIPv4Address() <= other.address().toIPv4Address();
|
|
||||||
//}
|
|
||||||
|
|
||||||
//bool NetworkDeviceInfo::operator>(const NetworkDeviceInfo &other) const
|
|
||||||
//{
|
|
||||||
// return m_address.toIPv4Address() > other.address().toIPv4Address();
|
|
||||||
//}
|
|
||||||
|
|
||||||
//bool NetworkDeviceInfo::operator>=(const NetworkDeviceInfo &other) const
|
|
||||||
//{
|
|
||||||
// return m_address.toIPv4Address() != other.address().toIPv4Address();
|
|
||||||
//}
|
|
||||||
|
|
||||||
//bool NetworkDeviceInfo::operator-(const NetworkDeviceInfo &other) const
|
|
||||||
//{
|
|
||||||
// return m_address.toIPv4Address() - other.address().toIPv4Address();
|
|
||||||
//}
|
|
||||||
|
|
||||||
//bool NetworkDeviceInfo::operator+(const NetworkDeviceInfo &other) const
|
|
||||||
//{
|
|
||||||
// return m_address.toIPv4Address() + other.address().toIPv4Address();
|
|
||||||
//}
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug dbg, const NetworkDeviceInfo &networkDeviceInfo)
|
QDebug operator<<(QDebug dbg, const NetworkDeviceInfo &networkDeviceInfo)
|
||||||
{
|
{
|
||||||
dbg.nospace() << "NetworkDeviceInfo(" << networkDeviceInfo.address().toString();
|
dbg.nospace() << "NetworkDeviceInfo(" << networkDeviceInfo.address().toString();
|
||||||
|
|||||||
@ -62,13 +62,6 @@ public:
|
|||||||
|
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
// bool operator!=(const NetworkDeviceInfo& other) const;
|
|
||||||
// bool operator==(const NetworkDeviceInfo& other) const;
|
|
||||||
// bool operator<(const NetworkDeviceInfo& other) const;
|
|
||||||
// bool operator<=(const NetworkDeviceInfo& other) const;
|
|
||||||
// bool operator>(const NetworkDeviceInfo& other) const;
|
|
||||||
// bool operator>=(const NetworkDeviceInfo& other) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QHostAddress m_address;
|
QHostAddress m_address;
|
||||||
QString m_macAddress;
|
QString m_macAddress;
|
||||||
|
|||||||
@ -101,9 +101,9 @@ NetworkDeviceInfo NetworkDeviceInfos::get(const QString &macAddress)
|
|||||||
|
|
||||||
void NetworkDeviceInfos::sortNetworkDevices()
|
void NetworkDeviceInfos::sortNetworkDevices()
|
||||||
{
|
{
|
||||||
// std::sort(*this->begin(), *this->end(), [](const NetworkDeviceInfo& a, const NetworkDeviceInfo& b) {
|
std::sort(this->begin(), this->end(), [](const NetworkDeviceInfo& a, const NetworkDeviceInfo& b) {
|
||||||
// return a.address().toIPv4Address() < b.address().toIPv4Address();
|
return a.address().toIPv4Address() < b.address().toIPv4Address();
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkDeviceInfos &NetworkDeviceInfos::operator <<(const NetworkDeviceInfo &networkDeviceInfo)
|
NetworkDeviceInfos &NetworkDeviceInfos::operator <<(const NetworkDeviceInfo &networkDeviceInfo)
|
||||||
|
|||||||
Reference in New Issue
Block a user