generator_new/record.h

Go to the documentation of this file.
00001 /* $Id:record.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 __RECORD_H
00015 #define __RECORD_H
00016 
00017 #include <string>
00018 #include <map>
00019 #include <list>
00020 using namespace std;
00021 
00022 #include "field.h"
00023 
00024 #define loopRecordFields(r,v) loopSingle((r)->listFields(),v,class field,list)
00025 
00026 class record {
00027     string name;
00028     map<string,class field> fields;
00029     int maxFields;
00030     bool relations; // true when this records has relations from other records pointed to it
00031     bool main; // true when this record has it's own repository to directly retrieve it, it isn't a normal child
00032     bool named; // true when this record contains a name field
00033     bool ordered; // true when this record contains a nr field, loops through these records are ordered on this nr
00034     string idField; // when filled this record uses named or nr fields from the related records that the field with this name points to
00035 public:
00036     record();
00037 
00038     // Field : name
00039     const string getName() const;
00040     void setName(const string v);
00041 
00042     // Field : fields
00043     class field& getFields(const string v);
00044     list<class field>& listFields();
00045     void setFields(class field &v);
00046     void delFields(const string v);
00047     const bool isFields(const string v) const;
00048 
00049     // Field : relations
00050     const bool getRelations() const;
00051     void setRelations(const bool v);
00052 
00053     // Field : main
00054     const bool getMain() const;
00055     void setMain(const bool v);
00056 
00057     // Field : named
00058     const bool getNamed() const;
00059     void setNamed(const bool v);
00060 
00061     // Field : ordered
00062     const bool getOrdered() const;
00063     void setOrdered(const bool v);
00064 
00065     // Field : idField
00066     const string getIdField() const;
00067     void setIdField(const string v);
00068 
00069     void xml(ofstream &f, int l=0, int r=0);
00070 };
00071 
00072 // Repository
00073 
00074 #define loopRecords(v) loopMap(record_repo.listRecord(),v,class record)
00075 
00076 class recordRepository {
00077     map<string,record> records;
00078 public:
00079     class record& getRecord(const string v);
00080     void setRecord(class record& v);
00081     map<string,class record>& listRecord();
00082     void delRecord(const string v);
00083     const bool isRecord(const string v) const;
00084 };
00085 
00086 extern recordRepository record_repo;
00087 
00088 #endif // __RECORD_H


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