20 #ifndef HURRICANE_FILTER
21 #define HURRICANE_FILTER
23 #include "hurricane/Commons.h"
27 template<
class Type>
class GenericFilter;
28 template<
class Type>
class NotFilter;
49 public:
virtual ~
Filter() {};
70 public:
virtual bool accept(Type type)
const = 0;
75 public:
virtual string _getTypeName()
const {
return _TName(
"Filter"); };
76 public:
virtual string _getString()
const = 0;
112 _filter(filter.getClone())
119 _filter(genericFilter.getClone())
138 if (_filter)
delete _filter;
144 public: GenericFilter& operator=(
const Filter<Type>& filter)
147 if (_filter)
delete _filter;
152 public: GenericFilter& operator=(
const GenericFilter& genericFilter)
155 if (_filter)
delete _filter;
160 public: GenericFilter& operator=(Filter<Type>* filter)
165 if (_filter)
delete _filter;
173 public:
virtual Filter<Type>* getClone() const
176 return (_filter) ? _filter->
getClone() : NULL;
182 public:
virtual bool accept(Type type)
const
185 return (_filter) ? _filter->
accept(type) :
false;
191 public:
virtual string _getTypeName() const
194 return _TName(
"GenericFilter");
197 public:
virtual string _getString() const
201 return "<" + _getTypeName() +
" unbound>";
203 return "<" + _getTypeName() +
" " + getString(_filter) +
">";
240 _genericFilter(filter)
247 _genericFilter(notFilter._genericFilter)
257 _genericFilter = notFilter._genericFilter;
264 public:
virtual Filter<Type>* getClone() const
267 return new NotFilter(*
this);
273 public:
virtual bool accept(Type type)
const
276 return !_genericFilter.accept(type);
282 public:
virtual string _getTypeName() const
285 return _TName(
"GenericNotFilter");
288 public:
virtual string _getString() const
291 return "<" + _getTypeName() +
" " + getString(_genericFilter) +
">";
Filter description (API)
Definition: Filter.h:36
virtual Filter< Type > * getClone() const =0
GenericFilter< Type > operator!() const
Definition: Filter.h:56
virtual bool accept(Type type) const =0
Generic Filter auto-pointer.
Definition: Filter.h:86
GenericFilter(const Filter< Type > &filter)
Definition: Filter.h:109
GenericFilter(Filter< Type > *filter)
Definition: Filter.h:123
GenericFilter(const GenericFilter< Type > &genericFilter)
Definition: Filter.h:116
Filter negation.
Definition: Filter.h:214
NotFilter(const NotFilter< Type > ¬Filter)
Definition: Filter.h:244
NotFilter(const Filter< Type > &filter)
Definition: Filter.h:237
The namespace dedicated to Hurricane.
Definition: Generalities.dox:5