| Home · All Classes · All Namespaces · Modules · Functions · Files

not-filter.h
1
23 #ifndef _TelepathyQt_not_filter_h_HEADER_GUARD_
24 #define _TelepathyQt_not_filter_h_HEADER_GUARD_
25
26 #ifndef IN_TP_QT_HEADER
27 #error IN_TP_QT_HEADER
28 #endif
29
30 #include <TelepathyQt/Filter>
31 #include <TelepathyQt/Types>
32
33 namespace Tp
34 {
35
36 template <class T>
37 class NotFilter : public Filter<T>
38 {
39 public:
40 static SharedPtr<NotFilter<T> > create(
41 const SharedPtr<const Filter<T> > &filter = SharedPtr<const Filter<T> >())
42 {
43 return SharedPtr<NotFilter<T> >(new NotFilter<T>(filter));
44 }
45
46 inline virtual ~NotFilter() { }
47
48 inline virtual bool isValid() const
49 {
50 return mFilter && mFilter->isValid();
51 }
52
53 inline virtual bool matches(const SharedPtr<T> &t) const
54 {
55 if (!isValid()) {
56 return false;
57 }
58
59 return !mFilter->matches(t);
60 }
61
62 inline SharedPtr<const Filter<T> > filter() const { return mFilter; }
63
64 private:
65 NotFilter(const SharedPtr<const Filter<T> > &filter)
66 : Filter<T>(), mFilter(filter) { }
67
68 SharedPtr<const Filter<T> > mFilter;
69 };
70
71 } // Tp
72
73 #endif
Tp::NotFilter
The NotFilter class provides a generic filter object to be used in conjunction of other filters...
Definition: not-filter.h:37
Tp::NotFilter::create
static SharedPtr< NotFilter< T > > create(const SharedPtr< const Filter< T > > &filter=SharedPtr< const Filter< T > >())
Definition: not-filter.h:40
Tp
Definition: abstract-adaptor.cpp:31
Tp::NotFilter::isValid
virtual bool isValid() const
Definition: not-filter.h:48
Tp::NotFilter::matches
virtual bool matches(const SharedPtr< T > &t) const
Definition: not-filter.h:53
Tp::Filter
The Filter class provides a base class to be used by specialized filters such as GenericCapabilityFil...
Definition: filter.h:37
Tp::NotFilter::filter
SharedPtr< const Filter< T > > filter() const
Definition: not-filter.h:62
Tp::SharedPtr
The SharedPtr class is a pointer to an explicitly shared object.
Definition: shared-ptr.h:39
Tp::NotFilter::~NotFilter
virtual ~NotFilter()
Definition: not-filter.h:46