• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

servicebackend.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2008 Nokia Corporation.
00003  *
00004  * Contact: Marius Vollmer <marius.vollmer@nokia.com>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public License
00008  * version 2.1 as published by the Free Software Foundation.
00009  *
00010  * This library is distributed in the hope that it will be useful, but
00011  * WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00018  * 02110-1301 USA
00019  *
00020  */
00021 
00022 #ifndef SERVICEBACKEND_H
00023 #define SERVICEBACKEND_H
00024 
00025 #include <QObject>
00026 #include <QString>
00027 #include <QStringList>
00028 #include <QDBusConnection>
00029 #include <QHash>
00030 #include <QVariant>
00031 #include <QSet>
00032 
00033 class ServiceBackendUnitTest;
00034 
00035 namespace ContextProvider {
00036 
00037 class PropertyAdaptor;
00038 class PropertyPrivate;
00039 
00040 class ServiceBackend : public QObject
00041 {
00042     Q_OBJECT
00043 
00044 public:
00045     explicit ServiceBackend(QDBusConnection connection);
00046     ServiceBackend(QDBusConnection connection, const QString &busName);
00047     virtual ~ServiceBackend();
00048 
00049     bool sharedConnection();
00050     bool start();
00051     void stop();
00052 
00053     void addProperty(const QString& key, PropertyPrivate* property);
00054 
00055     void setAsDefault();
00056     void setValue(const QString &key, const QVariant &val);
00057 
00058     void ref();
00059     void unref();
00060 
00061     static ServiceBackend* instance(QDBusConnection connection);
00062     static ServiceBackend* instance(QDBusConnection::BusType busType,
00063                                     const QString &busName,
00064                                     bool autoStart);
00065     static ServiceBackend *defaultServiceBackend;
00066     friend class ::ServiceBackendUnitTest;
00067     friend class Service;
00068 
00069 private:
00070     bool registerProperty(const QString& key, PropertyPrivate* property);
00071 
00072     int refCount; 
00073 
00076     QDBusConnection connection;
00077 
00080     QString busName;
00081 
00083     static QHash <QString, ServiceBackend*> instances;
00084 
00086     QHash<QString, PropertyPrivate*> properties;
00087 
00090     QHash<QString, PropertyAdaptor*> createdAdaptors;
00091 };
00092 
00093 } // end namespace
00094 
00095 #endif

Generated on Tue Aug 16 2011 15:43:54 for libcontextprovider by  doxygen 1.7.1