KDNSSD

servicebase.cpp
1 /*
2  This file is part of the KDE project
3 
4  SPDX-FileCopyrightText: 2004 Jakub Stachowski <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #include "servicebase.h"
10 #include "servicebase_p.h"
11 #include <QRegExp>
12 #include <QDataStream>
13 #include <QUrl>
14 
15 namespace KDNSSD
16 {
17 
18 ServiceBase::ServiceBase(const QString &name, const QString &type, const QString &domain,
19  const QString &host, unsigned short port)
20  : d(new ServiceBasePrivate(name, type, domain, host, port))
21 {}
22 
23 ServiceBase::ServiceBase(ServiceBasePrivate *const _d)
24  : d(_d)
25 {}
26 
27 ServiceBase::~ServiceBase()
28 {
29  delete d;
30 }
31 
33 {
34  return d->m_serviceName;
35 }
36 
38 {
39  return d->m_type;
40 }
41 
43 {
44  return d->m_domain;
45 }
46 
48 {
49  return d->m_hostName;
50 }
51 
52 unsigned short ServiceBase::port() const
53 {
54  return d->m_port;
55 }
57 {
58  return d->m_textData;
59 }
60 
62 {
63  return d->m_domain == o.d->m_domain && d->m_serviceName == o.d->m_serviceName && d->m_type == o.d->m_type;
64 }
65 
67 {
68  return !(*this == o);
69 }
70 
71 void ServiceBase::virtual_hook(int, void *)
72 {}
73 
74 bool domainIsLocal(const QString &domain)
75 {
76  return domain.section(QLatin1Char('.'), -1, -1).toLower() == QLatin1String("local");
77 }
78 
79 }
QString serviceName() const
The name of the service.
Definition: servicebase.cpp:32
ServiceBase(const QString &name=QString(), const QString &type=QString(), const QString &domain=QString(), const QString &host=QString(), unsigned short port=0)
Creates a ServiceBase object.
Definition: servicebase.cpp:18
QMap< QString, QByteArray > textData() const
Additional text data associated with the service.
Definition: servicebase.cpp:56
bool operator!=(const ServiceBase &o) const
Compares services based on name, type and domain.
Definition: servicebase.cpp:66
Describes a service.
Definition: servicebase.h:39
unsigned short port() const
The port number of the service.
Definition: servicebase.cpp:52
bool operator==(const ServiceBase &o) const
Compares services based on name, type and domain.
Definition: servicebase.cpp:61
QString toLower() const const
QString type() const
The type of the service.
Definition: servicebase.cpp:37
QString domain() const
The domain that the service belongs to.
Definition: servicebase.cpp:42
QString hostName() const
The hostname of the service.
Definition: servicebase.cpp:47
QString section(QChar sep, int start, int end, QString::SectionFlags flags) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun May 31 2020 23:07:27 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.