Add network device discovery result sorting by ip address

pull/432/head
Simon Stürz 2021-06-11 11:24:40 +02:00
parent cbb7a2a7f1
commit 19e21b9dd4
3 changed files with 3 additions and 54 deletions

View File

@ -96,50 +96,6 @@ bool NetworkDeviceInfo::isValid() const
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)
{
dbg.nospace() << "NetworkDeviceInfo(" << networkDeviceInfo.address().toString();

View File

@ -62,13 +62,6 @@ public:
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:
QHostAddress m_address;
QString m_macAddress;

View File

@ -101,9 +101,9 @@ NetworkDeviceInfo NetworkDeviceInfos::get(const QString &macAddress)
void NetworkDeviceInfos::sortNetworkDevices()
{
// std::sort(*this->begin(), *this->end(), [](const NetworkDeviceInfo& a, const NetworkDeviceInfo& b) {
// return a.address().toIPv4Address() < b.address().toIPv4Address();
// });
std::sort(this->begin(), this->end(), [](const NetworkDeviceInfo& a, const NetworkDeviceInfo& b) {
return a.address().toIPv4Address() < b.address().toIPv4Address();
});
}
NetworkDeviceInfos &NetworkDeviceInfos::operator <<(const NetworkDeviceInfo &networkDeviceInfo)