123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- #include "ctkEvent.h"
- namespace ctk {
- class EventPrivate {
- public:
- EventPrivate(const QString& topic, const LDAPSearchFilter::Dictionary& properties)
- : ref(1), topic(topic), properties(properties)
- {
- }
- QAtomicInt ref;
- const QString topic;
- const LDAPSearchFilter::Dictionary properties;
- };
- Event::Event(const QString& topic, const LDAPSearchFilter::Dictionary& properties)
- : d(new EventPrivate(topic, properties))
- {
- }
- /*
- * This is fast thanks to implicit sharing
- */
- Event::Event(const Event &event)
- : d(event.d)
- {
- d->ref.ref();
- }
- Event::~Event()
- {
- if (!d->ref.deref())
- delete d;
- }
- bool Event::operator==(const Event& 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& Event::property(const QString& name) const
- {
- d->properties[name];
- }
- QStringList Event::propertyNames() const
- {
- d->properties.keys();
- }
- const QString& Event::topic() const
- {
- d->topic;
- }
- bool Event::matches(const LDAPSearchFilter& filter) const
- {
- // TODO
- return true;
- }
- }
|