123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #include "ctkEvent.h"
- class ctkEventPrivate {
- public:
- ctkEventPrivate(const QString& topic, const ctkLDAPSearchFilter::Dictionary& properties)
- : ref(1), topic(topic), properties(properties)
- {
- }
- QAtomicInt ref;
- const QString topic;
- const ctkLDAPSearchFilter::Dictionary properties;
- };
- ctkEvent::ctkEvent(const QString& topic, const ctkLDAPSearchFilter::Dictionary& properties)
- : d(new ctkEventPrivate(topic, properties))
- {
- }
- /*
- * This is fast thanks to implicit sharing
- */
- ctkEvent::ctkEvent(const ctkEvent &event)
- : d(event.d)
- {
- d->ref.ref();
- }
- ctkEvent::~ctkEvent()
- {
- if (!d->ref.deref())
- delete d;
- }
- bool ctkEvent::operator==(const ctkEvent& other) const
- {
- if (d == other.d)
- return true;
- if (d->topic == other.d->topic &&
- d->properties == other.d->properties)
- return true;
- return false;
- }
- const QVariant& ctkEvent::property(const QString& name) const
- {
- return d->properties[name];
- }
- QStringList ctkEvent::propertyNames() const
- {
- return d->properties.keys();
- }
- const QString& ctkEvent::topic() const
- {
- return d->topic;
- }
- bool ctkEvent::matches(const ctkLDAPSearchFilter& filter) const
- {
- // TODO
- return true;
- }
|