DNSSD
servicebase.h
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 #ifndef DNSSDSERVICEBASE_H 00022 #define DNSSDSERVICEBASE_H 00023 00024 #include <qmap.h> 00025 #include <ksharedptr.h> 00026 00027 class QString; 00028 class QDataStream; 00029 namespace DNSSD 00030 { 00031 class ServiceBasePrivate; 00032 00040 class KDNSSD_EXPORT ServiceBase : public KShared 00041 { 00042 public: 00043 typedef KSharedPtr<ServiceBase> Ptr; 00044 00052 ServiceBase(const QString& name=QString::null,const QString& type=QString::null, 00053 const QString& domain=QString::null, const QString& host=QString::null, 00054 unsigned short port=0); 00055 00056 virtual ~ServiceBase(); 00057 00061 const QString& serviceName() const; 00062 00067 const QString& type() const; 00068 00072 const QString& domain() const; 00073 00077 const QString& hostName() const; 00078 00082 unsigned short port() const; 00083 00087 const QMap<QString,QString>& textData() const; 00088 00089 protected: 00090 QString m_serviceName; 00091 QString m_type; 00092 QString m_domain; 00093 QString m_hostName; 00094 unsigned short m_port; 00095 00099 QMap<QString,QString> m_textData; 00103 QString encode(); 00108 void decode(const QString& name); 00109 00110 friend KDNSSD_EXPORT QDataStream & operator<< (QDataStream & s, const ServiceBase & a); 00111 friend KDNSSD_EXPORT QDataStream & operator>> (QDataStream & s, ServiceBase & a); 00112 00113 virtual void virtual_hook(int, void*); 00114 private: 00115 ServiceBasePrivate* d; 00116 00117 }; 00118 00119 } 00120 00121 #endif