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