Well don't that own? Sorted all the #include's.
[UnsignedByte.git] / src / Generator / Generator.h
blobec45bfcc4a6c749e922bbd3589339c8014533a44
1 /***************************************************************************
2 * Copyright (C) 2008 by Sverre Rabbelier *
3 * sverre@rabbelier.nl *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20 #pragma once
22 /**
23 * @file Generator.h
24 * This file contains the Generator class.
26 * @see Generator
27 */
29 #include "Types.h"
31 #include <fstream>
34 /**
35 * This class will generate TableImpls and FieldImpls.
37 * It will retreive it's data from the Tables singleton.
39 * @see Tables
40 */
41 class Generator
43 public:
44 /** Create a Generator that puts all classes in the specified namespace. */
45 explicit Generator(const std::string& name);
47 /** Destructor, closes all files. */
48 ~Generator();
50 /** Generates the definitions required by the DAL. */
51 void GenerateDAL(TableDefVector::const_iterator begin, TableDefVector::const_iterator end);
53 private:
54 /** Hide the copy constructor. */
55 Generator(const Generator& rhs);
57 /** Hide the assignment operator. */
58 Generator operator=(const Generator& rhs);
60 void AppendLicense(std::ofstream& file);
61 void AppendGeneratorNotice(std::ofstream& file);
63 void AppendHeaderIncludes();
64 void AppendHeaderClass(TableDefPtr table);
65 void AppendHeaderFooter();
66 void CreateHeader();
68 void AppendSourceIncludes();
69 void AppendSourceClass(TableDefPtr table);
70 void AppendSourceFooter();
71 void CreateSource();
73 void AppendHeaderTableImpls();
74 void AppendSourceTableImpls();
75 void CreateTI();
77 std::string m_name; /**< The namespace to put all classes in. */
78 std::string m_fieldname; /**< The name of the file containing the FieldImpls. */
79 std::string m_tablename; /**< The name of the file containing the TableImpls. */
80 std::string m_tabs; /**< The string to use as tabbification sequence. */
81 std::ofstream m_headerfile; /**< An output file stream to the FieldImpls headerfile. */
82 std::ofstream m_sourcefile; /**< An output file stream to the FieldImpls sourcefile. */
83 std::ofstream m_tiheaderfile; /**< An output file stream to the TableImpls headerfile. */
84 std::ofstream m_tisourcefile; /**< An output file stream to the TableImpls sourcefile. */
86 TableDefVector::const_iterator m_begin; /**< The begin iterator to use to get the tables. */
87 TableDefVector::const_iterator m_end; /**< The end iterator ot use to get the tables. */