Main Page   Class Hierarchy   Compound List   File List   Compound Members  

registry.h

00001 /*
00002  *  Interface to register SLP services
00003  *  Copyright (C) 2002-2003 Tim Jansen <tim@tjansen.de>
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., 59 Temple Place - Suite 330,
00018  *  Boston, MA 02111-1307, USA.
00019  */
00020 
00021 #ifndef KDE_SLP_REGISTRY_H
00022 #define KDE_SLP_REGISTRY_H
00023 
00024 #include <kde/slp/service.h>
00025 #include <kde/slp/filters.h>
00026 #include <kde/util/smartptr.h>
00027 #include <qstringlist.h>
00028 #include <qobject.h>
00029 
00030 namespace KDE {
00031 namespace SLP {
00032 
00033 class RegistryImpl;
00034 
00066 class Registry : public QObject {
00067         Q_OBJECT
00068 private:
00069         static int m_nextRegId;
00070 
00071         QString m_language;
00072         bool m_anyLanguage;
00073         KDE::Util::SmartPtr<RegistryImpl> m_impl;
00074         int m_regId;
00075         void *reserved;
00076 
00077         QString regIdToken(const QString &token);
00078         QString unregIdToken(const QString &token);
00079         bool isMyToken(const QString &token);
00080 
00081         KDE::Util::SmartPtr<RegistryImpl> createRegistryImpl(const QString &lang,
00082                                                              bool anyLang);
00083 public:
00084 
00091         static const unsigned short UnlimitedLifetime = 65535;
00092 
00096         static const unsigned short RecommendedLifetime = 900;
00097 
00102         static const QStringList DefaultScopes;
00103 
00108         static const QString DefaultAuthority;
00109 
00114         static const QString AllAuthorities;
00115 
00116 
00127         Registry(const QString &language = QString::null,
00128                  bool allowAnyLanguage = true);
00129 
00135         virtual ~Registry();
00136 
00144         Registry(const Registry &other);
00145 
00146 
00153         Registry &operator=(const Registry &other);
00154 
00155 
00162         bool available() const;
00163 
00169         bool supportsAutoAddress() const;
00170 
00224         bool registerService(const Service &service,
00225                       bool autoAddress,
00226                       bool autoDeregister = true,
00227                       const QStringList &scopes = DefaultScopes,
00228                       unsigned short lifetime = RecommendedLifetime,
00229                       bool autoLifetimeExtension = true);
00230 
00239         bool deregister(const QString &serviceURL);
00240 
00250         bool deregister(const Service &service);
00251 
00274         bool findServiceTypes(const QString &token = QString::null,
00275                               const QString &namingAuthority = AllAuthorities,
00276                               const QStringList &scopeList = DefaultScopes);
00277 
00299         bool findServiceTypesAsync(const QString &token = QString::null,
00300                                    const QString &namingAuthority = AllAuthorities,
00301                                    const QStringList &scopeList = DefaultScopes);
00302 
00330         bool findServices(const QString &token,
00331                           const QString &srvtype,
00332                           bool fetchAttributes = true,
00333                           const Filter::List &filters = Filter::List(),
00334                           const QString &scopeList = QString::null);
00335 
00362         bool findServicesAsync(const QString &token,
00363                                const QString &srvtype,
00364                                bool fetchAttributes = true,
00365                                const Filter::List &filters = Filter::List(),
00366                                const QString &scopeList = QString::null);
00367 
00368 
00384         bool findAttributes(const QString &token,
00385                             const QString &serviceUrl,
00386                             const QStringList &attributeIds = QStringList());
00387 
00402         bool findAttributesAsync(const QString &token,
00403                                  const QString &serviceUrl,
00404                                  const QStringList &attributeIds = QStringList());
00405 
00420         bool findScopes(const QString &token);
00421 
00435         bool findScopesAsync(const QString &token);
00436 
00437  signals:
00444         void foundServiceTypes(QString token, QStringList serviceTypes);
00445 
00453         void foundService(QString token,
00454                           Service service,
00455                           int lifetime);
00456 
00463         void foundAttributes(QString token,
00464                              Service service);
00465 
00471         void foundScopes(QString token,
00472                          QStringList scopeList);
00473 
00474 
00482         void operationFinished(QString token, bool success, QString msg);
00483 
00484 
00485 private slots:
00486         void slotFoundServiceTypes(QString token, QStringList serviceTypes);
00487         void slotFoundService(QString token,
00488                               Service service,
00489                               int lifetime);
00490         void slotFoundAttributes(QString token,
00491                                  Service service);
00492         void slotFoundScopes(QString token,
00493                              QStringList scopeList);
00494         void slotOperationFinished(QString token, bool success, QString msg);
00495 };
00496 
00497 }
00498 }
00499 
00500 #endif

Generated on Tue Jun 24 20:14:35 2003 for KDE::SLP by doxygen1.2.18