File indexing completed on 2025-03-23 12:49:51
0001 /* 0002 SPDX-FileCopyrightText: 2008, 2011 Will Stephenson <wstephenson@kde.org> 0003 SPDX-FileCopyrightText: 2013 Daniel Nicoletti <dantti12@gmail.com> 0004 0005 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 0008 #include "ipaddress.h" 0009 0010 namespace NetworkManager 0011 { 0012 class IpAddress::Private 0013 { 0014 public: 0015 QHostAddress gateway; 0016 }; 0017 0018 } 0019 0020 NetworkManager::IpAddress::IpAddress() 0021 : d(new Private) 0022 { 0023 } 0024 0025 NetworkManager::IpAddress::~IpAddress() 0026 { 0027 delete d; 0028 } 0029 0030 NetworkManager::IpAddress::IpAddress(const NetworkManager::IpAddress &other) 0031 : QNetworkAddressEntry(other) 0032 , d(new Private) 0033 { 0034 *this = other; 0035 } 0036 0037 bool NetworkManager::IpAddress::isValid() const 0038 { 0039 return !ip().isNull(); 0040 } 0041 0042 void NetworkManager::IpAddress::setGateway(const QHostAddress &gateway) 0043 { 0044 d->gateway = gateway; 0045 } 0046 0047 QHostAddress NetworkManager::IpAddress::gateway() const 0048 { 0049 return d->gateway; 0050 } 0051 0052 NetworkManager::IpAddress &NetworkManager::IpAddress::operator=(const NetworkManager::IpAddress &other) 0053 { 0054 if (this == &other) { 0055 return *this; 0056 } 0057 0058 QNetworkAddressEntry::operator=(other); 0059 *d = *other.d; 0060 0061 return *this; 0062 }