| 1 |
#ifndef _UI_FILTER_H_ |
| 2 |
#define _UI_FILTER_H_ |
| 3 |
|
| 4 |
#include "ifilter.h" |
| 5 |
#include <vector> |
| 6 |
#include <memory> |
| 7 |
|
| 8 |
namespace ui { |
| 9 |
|
| 10 |
// This object represents a filter in the filtersystem. |
| 11 |
class Filter |
| 12 |
{ |
| 13 |
// The name at construction time, can't be altered |
| 14 |
std::string _originalName; |
| 15 |
|
| 16 |
public: |
| 17 |
// The name |
| 18 |
std::string name; |
| 19 |
|
| 20 |
// Filter is enabled or disabled |
| 21 |
bool state; |
| 22 |
|
| 23 |
// Whether this is read-only |
| 24 |
bool readOnly; |
| 25 |
|
| 26 |
// The rules defining this filter |
| 27 |
FilterRules rules; |
| 28 |
|
| 29 |
Filter(const std::string& _name, const bool _state, const bool _readOnly) : |
| 30 |
_originalName(_name), |
| 31 |
name(_name), |
| 32 |
state(_state), |
| 33 |
readOnly(_readOnly) |
| 34 |
{} |
| 35 |
|
| 36 |
bool nameHasChanged() { |
| 37 |
return _originalName != name; |
| 38 |
} |
| 39 |
|
| 40 |
const std::string& getOriginalName() const { |
| 41 |
return _originalName; |
| 42 |
} |
| 43 |
}; |
| 44 |
typedef std::shared_ptr<Filter> FilterPtr; |
| 45 |
|
| 46 |
} // namespace ui |
| 47 |
|
| 48 |
#endif /* _UI_FILTER_H_ */ |