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 "ipconfig.h"
9
10namespace NetworkManager
11{
12class NetworkManager::IpRoute::Private
13{
14public:
15 Private()
16 : metric(0)
17 {
18 }
19 QHostAddress nextHop;
20 quint32 metric;
21};
22
23}
24
25NetworkManager::IpRoute::IpRoute()
26 : d(new Private)
27{
28}
29
30NetworkManager::IpRoute::~IpRoute()
31{
32 delete d;
33}
34
35NetworkManager::IpRoute::IpRoute(const NetworkManager::IpRoute &other)
36 : QNetworkAddressEntry(other)
37 , d(new Private)
38{
39 *this = other;
40}
41
42void NetworkManager::IpRoute::setNextHop(const QHostAddress &nextHop) const
43{
44 d->nextHop = nextHop;
45}
46
47QHostAddress NetworkManager::IpRoute::nextHop() const
48{
49 return d->nextHop;
50}
51
52void NetworkManager::IpRoute::setMetric(quint32 metric)
53{
54 d->metric = metric;
55}
56
57quint32 NetworkManager::IpRoute::metric() const
58{
59 return d->metric;
60}
61
62NetworkManager::IpRoute &NetworkManager::IpRoute::operator=(const NetworkManager::IpRoute &other)
63{
64 if (this == &other) {
65 return *this;
66 }
67
68 QNetworkAddressEntry::operator=(other);
69 *d = *other.d;
70
71 return *this;
72}
73
74bool NetworkManager::IpRoute::isValid() const
75{
76 return !ip().isNull();
77}
78

source code of networkmanager-qt/src/iproute.cpp