DNSSD
servicebase.cpp
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 * 00003 * Copyright (C) 2004 Jakub Stachowski <qbast@go2.pl> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #include "servicebase.h" 00022 #include "servicebase_p.h" 00023 #include <QtCore/QRegExp> 00024 #include <QtCore/QDataStream> 00025 #include <QtCore/QUrl> 00026 00027 namespace DNSSD 00028 { 00029 00030 ServiceBase::ServiceBase(const QString& name, const QString& type, const QString& domain, 00031 const QString& host, unsigned short port) 00032 : d(new ServiceBasePrivate(name,type,domain,host,port)) 00033 {} 00034 00035 ServiceBase::ServiceBase(ServiceBasePrivate* const _d) 00036 : d(_d) 00037 {} 00038 00039 ServiceBase::~ServiceBase() 00040 { 00041 delete d; 00042 } 00043 00044 QString ServiceBase::serviceName() const 00045 { 00046 return d->m_serviceName; 00047 } 00048 00049 QString ServiceBase::type() const 00050 { 00051 return d->m_type; 00052 } 00053 00054 QString ServiceBase::domain() const 00055 { 00056 return d->m_domain; 00057 } 00058 00059 QString ServiceBase::hostName() const 00060 { 00061 return d->m_hostName; 00062 } 00063 00064 unsigned short ServiceBase::port() const 00065 { 00066 return d->m_port; 00067 } 00068 QMap<QString,QByteArray> ServiceBase::textData() const 00069 { 00070 return d->m_textData; 00071 } 00072 00073 bool ServiceBase::operator==(const ServiceBase& o) const 00074 { 00075 return d->m_domain==o.d->m_domain && d->m_serviceName==o.d->m_serviceName && d->m_type==o.d->m_type; 00076 } 00077 00078 bool ServiceBase::operator!=(const ServiceBase& o) const 00079 { 00080 return !(*this == o); 00081 } 00082 00083 void ServiceBase::virtual_hook(int, void*) 00084 {} 00085 00086 00087 bool domainIsLocal(const QString& domain) 00088 { 00089 return domain.section('.',-1,-1).toLower()==QLatin1String("local"); 00090 } 00091 00092 }
KDE 4.6 API Reference