server_new/chapter.h

Go to the documentation of this file.
00001 /* $Id:chapter.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 __CHAPTER_H
00015 #define __CHAPTER_H
00016 
00017 #include <string>
00018 #include <map>
00019 #include <list>
00020 using namespace std;
00021 
00022 #include "rule.h"
00023 
00024 #define loopChapterRules(r,v) loopSingle((r)->listRules(),v,class rule,list)
00025 
00026 class chapter {
00027     int nr;
00028     string name;
00029     string description;
00030     map<string,class rule> rules;
00031     int maxRules;
00032 public:
00033     chapter();
00034 
00035     // Field : nr
00036     const int getNr() const;
00037     void setNr(const int v);
00038     int operator<(const class chapter &ck) const;
00039 
00040     // Field : name
00041     const string getName() const;
00042     void setName(const string v);
00043 
00044     // Field : description
00045     const string getDescription() const;
00046     void setDescription(const string v);
00047 
00048     // Field : rules
00049     class rule& getRules(const string v);
00050     list<class rule>& listRules();
00051     void setRules(class rule &v);
00052     void delRules(const string v);
00053     const bool isRules(const string v) const;
00054 
00055     void save(class channel &ch);
00056     void load(class channel &ch);
00057     void xml(ofstream &f, int l=0, int r=0);
00058 };
00059 
00060 // Repository
00061 
00062 #define loopChapters(v) loopSingle(chapter_repo.listChapter(),v,class chapter,list)
00063 
00064 class chapterRepository {
00065     map<string,chapter> chapters;
00066     int max_nr;
00067 public:
00068     chapterRepository();
00069     class chapter& getChapter(const string v);
00070     void setChapter(class chapter& v);
00071     list<class chapter>& listChapter();
00072     void delChapter(const string v);
00073     const bool isChapter(const string v) const;
00074     multimap<string, sigc::signal<void, class chapter& > > relations;
00075     bool load(class channel &ch);
00076     void save(class channel &ch);
00077 };
00078 
00079 extern chapterRepository chapter_repo;
00080 
00081 #endif // __CHAPTER_H


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