DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
interestinglist.h
Go to the documentation of this file.
1 #ifndef INTERESTINGLIST_H
2 #define INTERESTINGLIST_H
3 
4 #include <QList>
5 
6 template<typename T>
8 private:
9  QList<T> mList;
10  QString mLabelFormat;
11 public:
13  virtual ~InterestingList() noexcept = default;
14 
15  void set(T n) {
16  if (!mList.contains(n))
17  mList.append(n);
18  qSort(mList);
19  }
20 
21  void rem(T n) {
22  mList.removeAll(n);
23  }
24 
25  bool has(T n) const {
26  return mList.contains(n);
27  }
28 
29  void clear() {
30  mList.clear();
31  }
32 
33  size_t count() {
34  return mList.size();
35  }
36 
37  const QList<T> &list() const { return mList; }
38 };
39 
40 #endif // INTERESTINGLIST_H
void clear()
Definition: interestinglist.h:29
void set(T n)
Definition: interestinglist.h:15
InterestingList()
Definition: interestinglist.h:12
size_t count()
Definition: interestinglist.h:33
virtual ~InterestingList() noexcept=default
Definition: interestinglist.h:7
const QList< T > & list() const
Definition: interestinglist.h:37
void rem(T n)
Definition: interestinglist.h:21
bool has(T n) const
Definition: interestinglist.h:25