ctkEvent.cpp

Go to the documentation of this file.
00001 
00002 #include "ctkEvent.h"
00003 
00004 
00005 class ctkEventPrivate {
00006 
00007 public:
00008 
00009   ctkEventPrivate(const QString& topic, const ctkLDAPSearchFilter::Dictionary& properties)
00010     : ref(1), topic(topic), properties(properties)
00011   {
00012 
00013   }
00014 
00015   QAtomicInt ref;
00016   const QString topic;
00017   const ctkLDAPSearchFilter::Dictionary properties;
00018 
00019 };
00020 
00021 
00022 ctkEvent::ctkEvent(const QString& topic, const ctkLDAPSearchFilter::Dictionary& properties)
00023   : d(new ctkEventPrivate(topic, properties))
00024 {
00025 
00026 }
00027 
00028 /*
00029  * This is fast thanks to implicit sharing
00030  */
00031 ctkEvent::ctkEvent(const ctkEvent &event)
00032   : d(event.d)
00033 {
00034   d->ref.ref();
00035 }
00036 
00037 ctkEvent::~ctkEvent()
00038 {
00039   if (!d->ref.deref())
00040     delete d;
00041 }
00042 
00043 bool ctkEvent::operator==(const ctkEvent& other) const
00044 {
00045   if (d == other.d)
00046     return true;
00047 
00048   if (d->topic == other.d->topic &&
00049       d->properties == other.d->properties)
00050     return true;
00051 
00052   return false;
00053 }
00054 
00055 const QVariant& ctkEvent::property(const QString& name) const
00056 {
00057   return d->properties[name];
00058 }
00059 
00060 QStringList ctkEvent::propertyNames() const
00061 {
00062   return d->properties.keys();
00063 }
00064 
00065 const QString& ctkEvent::topic() const
00066 {
00067   return d->topic;
00068 }
00069 
00070 bool ctkEvent::matches(const ctkLDAPSearchFilter& filter) const
00071 {
00072   // TODO
00073   return true;
00074 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated on 21 May 2010 for CTK by  doxygen 1.6.1