Home · All Classes · All Namespaces · Modules · Functions · Files |
00001 00023 #ifndef _TelepathyQt4_not_filter_h_HEADER_GUARD_ 00024 #define _TelepathyQt4_not_filter_h_HEADER_GUARD_ 00025 00026 #ifndef IN_TELEPATHY_QT4_HEADER 00027 #error IN_TELEPATHY_QT4_HEADER 00028 #endif 00029 00030 #include <TelepathyQt4/Filter> 00031 #include <TelepathyQt4/Types> 00032 00033 namespace Tp 00034 { 00035 00036 template <class T> 00037 class NotFilter : public Filter<T> 00038 { 00039 public: 00040 static SharedPtr<NotFilter<T> > create( 00041 const SharedPtr<const Filter<T> > &filter = SharedPtr<const Filter<T> >()) 00042 { 00043 return SharedPtr<NotFilter<T> >(new NotFilter<T>(filter)); 00044 } 00045 00046 inline virtual ~NotFilter() { } 00047 00048 inline virtual bool isValid() const 00049 { 00050 return mFilter && mFilter->isValid(); 00051 } 00052 00053 inline virtual bool matches(const SharedPtr<T> &t) const 00054 { 00055 if (!isValid()) { 00056 return false; 00057 } 00058 00059 return !mFilter->matches(t); 00060 } 00061 00062 inline SharedPtr<const Filter<T> > filter() const { return mFilter; } 00063 00064 private: 00065 NotFilter(const SharedPtr<const Filter<T> > &filter) 00066 : Filter<T>(), mFilter(filter) { } 00067 00068 SharedPtr<const Filter<T> > mFilter; 00069 }; 00070 00071 } // Tp 00072 00073 #endif
Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation |
Telepathy-Qt4 0.6.5
|