1 | /* |
2 | SPDX-FileCopyrightText: 2008, 2011 Will Stephenson <wstephenson@kde.org> |
3 | SPDX-FileCopyrightText: 2013 Daniel Nicoletti <dantti12@gmail.com> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
6 | */ |
7 | |
8 | #include "ipaddress.h" |
9 | |
10 | namespace NetworkManager |
11 | { |
12 | class IpAddress::Private |
13 | { |
14 | public: |
15 | QHostAddress gateway; |
16 | }; |
17 | |
18 | } |
19 | |
20 | NetworkManager::IpAddress::IpAddress() |
21 | : d(new Private) |
22 | { |
23 | } |
24 | |
25 | NetworkManager::IpAddress::~IpAddress() |
26 | { |
27 | delete d; |
28 | } |
29 | |
30 | NetworkManager::IpAddress::IpAddress(const NetworkManager::IpAddress &other) |
31 | : QNetworkAddressEntry(other) |
32 | , d(new Private) |
33 | { |
34 | *this = other; |
35 | } |
36 | |
37 | bool NetworkManager::IpAddress::isValid() const |
38 | { |
39 | return !ip().isNull(); |
40 | } |
41 | |
42 | void NetworkManager::IpAddress::setGateway(const QHostAddress &gateway) |
43 | { |
44 | d->gateway = gateway; |
45 | } |
46 | |
47 | QHostAddress NetworkManager::IpAddress::gateway() const |
48 | { |
49 | return d->gateway; |
50 | } |
51 | |
52 | NetworkManager::IpAddress &NetworkManager::IpAddress::operator=(const NetworkManager::IpAddress &other) |
53 | { |
54 | if (this == &other) { |
55 | return *this; |
56 | } |
57 | |
58 | QNetworkAddressEntry::operator=(other); |
59 | *d = *other.d; |
60 | |
61 | return *this; |
62 | } |
63 | |