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

listeners.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 LISTENERS_H
00023 #define LISTENERS_H
00024 
00025 #include <QObject>
00026 #include <QString>
00027 #include <QStringList>
00028 
00029 #include "service.h"
00030 #include "property.h"
00031 #include "group.h"
00032 #include "contextc.h"
00033 
00034 namespace ContextProvider {
00035 
00036 class PropertyListener;
00037 class Listener;
00038 class ContextGroupListener;
00039 
00040 class Listener : public QObject
00041 {
00042     Q_OBJECT
00043 
00044 public:
00045     Listener(bool clears, ContextProviderSubscriptionChangedCallback cb, void *dt);
00046 
00047 private Q_SLOTS:
00048     void onFirstSubscriberAppeared();
00049     void onLastSubscriberDisappeared();
00050 
00051 protected:
00052     virtual void clear() = 0;
00053 
00054 private:
00055     ContextProviderSubscriptionChangedCallback callback;
00056     void *user_data;
00057     bool clearsOnSubscribe;
00058 };
00059 
00060 class PropertyListener : public Listener
00061 {
00062     Q_OBJECT
00063 
00064 public:
00065     PropertyListener(Service &service, const QString &key,
00066                      bool clears, ContextProviderSubscriptionChangedCallback cb, void *dt);
00067     Property prop;
00068 
00069 protected:
00070     virtual void clear();
00071 };
00072 
00073 class GroupListener : public Listener 
00074 {
00075     Q_OBJECT
00076 
00077 public:
00078     GroupListener(Service &service, const QStringList &keys,
00079                   bool clears, ContextProviderSubscriptionChangedCallback cb, void *dt);
00080 
00081 protected:
00082     virtual void clear();
00083 
00084 private:
00085     Group group;
00086     QStringList keyList;
00087 };
00088 
00089 } // end namespace
00090 
00091 #endif

Generated on Sun Jun 1 2014 17:31:05 for libcontextprovider by  doxygen 1.7.1