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