1 /***************************************************************************
4 begin : Sun May 27 22:13:58 CEST 2001
5 copyright : (C) 2001 by Michael Andreen
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
20 // include files for QT
26 // application specific includes
29 //! The document class
30 /** This class is holding all the data, handles the transportation of the
31 * data to a couple of different mediums and informs users of the data
32 * if it's changed (through the documentChnaged() signal)
33 * \bug it's too open..
34 * \todo make this class more closed.
35 * \author Michael Andreen
38 class BSDoc : public QObject
47 bool saveAs(const QString &filename);
48 bool load(const QString &filename);
49 bool isModified() const;
51 /**Adds a new battle to the dokument and emits documentChanged.
52 * \todo add some checks to see if the battle exist and so and return the status.
53 * \return returns 0 if everything is ok.
55 int newBattle(QString name);
57 /**This returns the the data structure, so other can work on it, but not supposed
59 * \todo remove this, and replace it with a better more closed interface.
61 const std::map<QString, std::map<QString, std::map<QString, Fleet> > >& battles() const;
63 Fleet specificFleet(QString battle, QString group, QString fleet) const;
66 void documentChanged();
71 /**This is the main datastructure of the battlecalc, it's more or less the
72 * core that everything else works around. A short explanation of the fields:
73 * -# The name of the battle (usually coordinates)
74 * -# The name of the group (ie. Friendly/Hostile)
75 * -# The fleetname (Home Planet, coordinates, irc nicks and so on)
76 * - and in the end you got the actual Fleet object with it's data.
78 std::map<QString, std::map<QString, std::map<QString, Fleet> > > m_Battles;