server_new/army.h

Go to the documentation of this file.
00001 /* $Id:army.h $ */
00002 /*
00003    Copyright (C) 2007 by Jurjen Stellingwerff <jurjen@stwerff.xs4all.nl>
00004    Part of the Moros Project http://moros.sourceforge.net/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License version 3.
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY.
00010 
00011    See the COPYING file for more details.
00012 */
00013 
00014 #ifndef __ARMY_H
00015 #define __ARMY_H
00016 
00017 #include <string>
00018 #include <map>
00019 #include <list>
00020 using namespace std;
00021 
00022 #include "members.h"
00023 #include "material.h"
00024 #include "members.h"
00025 #include "material.h"
00026 
00027 #define loopArmyMembers(r,v) loopMap((r)->listMembers(),v,class members)
00028 #define loopArmyGoods(r,v) loopSingle((r)->listGoods(),v,class material,list)
00029 #define loopArmyMembers_wanted(r,v) loopMap((r)->listMembers_wanted(),v,class members)
00030 #define loopArmyGoods_wanted(r,v) loopSingle((r)->listGoods_wanted(),v,class material,list)
00031 
00032 class army {
00033     string name;
00034     map<string,class members> members;
00035     map<string,class material> goods;
00036     map<string,class members> members_wanted;
00037     map<string,class material> goods_wanted;
00038     int location;
00039 public:
00040     army();
00041 
00042     // Field : name
00043     const string getName() const;
00044     void setName(const string v);
00045 
00046     // Field : members
00047     class members& getMembers(const string v);
00048     map<string,class members>& listMembers();
00049     void setMembers(class members &v);
00050     void delMembers(const string v);
00051     const bool isMembers(const string v) const;
00052 
00053     // Field : goods
00054     class material& getGoods(const string v);
00055     list<class material>& listGoods();
00056     void setGoods(class material &v);
00057     void delGoods(const string v);
00058     const bool isGoods(const string v) const;
00059 
00060     // Field : members_wanted
00061     class members& getMembers_wanted(const string v);
00062     map<string,class members>& listMembers_wanted();
00063     void setMembers_wanted(class members &v);
00064     void delMembers_wanted(const string v);
00065     const bool isMembers_wanted(const string v) const;
00066 
00067     // Field : goods_wanted
00068     class material& getGoods_wanted(const string v);
00069     list<class material>& listGoods_wanted();
00070     void setGoods_wanted(class material &v);
00071     void delGoods_wanted(const string v);
00072     const bool isGoods_wanted(const string v) const;
00073 
00074     // Field : location
00075     const int getLocation() const;
00076     void setLocation(const int v);
00077     const string showLocation() const;
00078 
00079     void save(class channel &ch);
00080     void load(class channel &ch);
00081     void xml(ofstream &f, int l=0, int r=0);
00082 };
00083 
00084 // Repository
00085 
00086 #define loopArmys(v) loopMap(army_repo.listArmy(),v,class army)
00087 
00088 class armyRepository {
00089     map<string,army> armys;
00090 public:
00091     class army& getArmy(const string v);
00092     void setArmy(class army& v);
00093     map<string,class army>& listArmy();
00094     void delArmy(const string v);
00095     const bool isArmy(const string v) const;
00096     multimap<string, sigc::signal<void, class army& > > relations;
00097     bool load(class channel &ch);
00098     void save(class channel &ch);
00099 };
00100 
00101 extern armyRepository army_repo;
00102 
00103 #endif // __ARMY_H


Generated on Tue Jan 1 17:30:00 2008 for server_new/army.h Source File by  doxygen   Visit the project page on SourceForge.net Logo