KDNSSD

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

KDE's Doxygen guidelines are available online.