server/stat.h

Go to the documentation of this file.
00001 /* $Id:stat.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 __STAT_H
00015 #define __STAT_H
00016 
00017 #include <string>
00018 #include <map>
00019 #include <list>
00020 using namespace std;
00021 
00022 
00023 
00024 class stat {
00025     string name;
00026     int type;
00027     string description;
00028 public:
00029     stat();
00030 
00031     // Field : name
00032     const string getName() const;
00033     void setName(const string v);
00034 
00035     // Field : type
00036     enum type_enum{type_item,type_person,type_unit,type_all};
00037     const int getType() const;
00038     const string showType() const;
00039     void setType(const int v);
00040     void setType(const string v);
00041 
00042     // Field : description
00043     const string getDescription() const;
00044     void setDescription(const string v);
00045 
00046     void save(class channel &ch);
00047     void load(class channel &ch);
00048     void xml(ofstream &f, int l=0, int r=0);
00049 };
00050 
00051 // Repository
00052 
00053 #define loopStats(v) loopMap(stat_repo.listStat(),v,class stat)
00054 
00055 class statRepository {
00056     map<string,stat> stats;
00057 public:
00058     class stat& getStat(const string v);
00059     void setStat(class stat& v);
00060     map<string,class stat>& listStat();
00061     void delStat(const string v);
00062     const bool isStat(const string v) const;
00063     multimap<string, sigc::signal<void, class stat& > > relations;
00064     bool load(class channel &ch);
00065     void save(class channel &ch);
00066 };
00067 
00068 extern statRepository stat_repo;
00069 
00070 #endif // __STAT_H


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