Crossfire Server, Trunk  R20513
CREFilterDefinitionManager.cpp
Go to the documentation of this file.
2 #include "CREFilterDefinition.h"
3 
5 {
6 }
7 
9 {
10  copy(other);
11 }
12 
14 {
15  qDeleteAll(myFilters);
16 }
17 
19 {
20  qDeleteAll(myFilters);
21  myFilters.clear();
22  for (int f = 0; f < other.filters().size(); f++)
23  {
24  myFilters.append(new CREFilterDefinition(*other.filters()[f]));
25  }
26 }
27 
28 QList<CREFilterDefinition*>& CREFilterDefinitionManager::filters()
29 {
30  return myFilters;
31 }
32 
33 const QList<CREFilterDefinition*>& CREFilterDefinitionManager::filters() const
34 {
35  return myFilters;
36 }
37 
38 QDataStream &operator<<(QDataStream &out, const CREFilterDefinitionManager &manager)
39 {
40  out << manager.filters().size();
41  for (int f = 0; f < manager.filters().size(); f++)
42  out << (*manager.filters()[f]);
43  return out;
44 }
45 
46 QDataStream &operator>>(QDataStream &in, CREFilterDefinitionManager &manager)
47 {
48  int size;
49  in >> size;
50  while (size > 0)
51  {
53  in >> (*filter);
54  manager.filters().append(filter);
55  size--;
56  }
57  return in;
58 }
QDataStream & operator<<(QDataStream &out, const CREFilterDefinitionManager &manager)
QList< CREFilterDefinition * > & filters()
void copy(const CREFilterDefinitionManager &other)
QList< CREFilterDefinition * > myFilters
QDataStream & operator>>(QDataStream &in, CREFilterDefinitionManager &manager)