Ran the fixer on Generator.
[UnsignedByte.git] / src / Generator / Generator.h
blobc1f89286ae15b3c3aa23c5d52eea1ff75611885c
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 <fstream>
31 #include "Types.h"
33 /**
34 * This class will generate TableImpls and FieldImpls.
36 * It will retreive it's data from the Tables singleton.
38 * @see Tables
39 */
40 class Generator
42 public:
43 /** Create a Generator that puts all classes in the specified namespace. */
44 explicit Generator(const std::string& name);
46 /** Destructor, closes all files. */
47 ~Generator();
49 /** Generates the definitions required by the DAL. */
50 void GenerateDAL(TableDefVector::const_iterator begin, TableDefVector::const_iterator end);
52 private:
53 /** Hide the copy constructor. */
54 Generator(const Generator& rhs);
56 /** Hide the assignment operator. */
57 Generator operator=(const Generator& rhs);
59 void AppendLicense(std::ofstream& file);
60 void AppendGeneratorNotice(std::ofstream& file);
62 void AppendHeaderIncludes();
63 void AppendHeaderClass(TableDefPtr table);
64 void AppendHeaderFooter();
65 void CreateHeader();
67 void AppendSourceIncludes();
68 void AppendSourceClass(TableDefPtr table);
69 void AppendSourceFooter();
70 void CreateSource();
72 void AppendHeaderTableImpls();
73 void AppendSourceTableImpls();
74 void CreateTI();
76 std::string m_name; /**< The namespace to put all classes in. */
77 std::string m_fieldname; /**< The name of the file containing the FieldImpls. */
78 std::string m_tablename; /**< The name of the file containing the TableImpls. */
79 std::string m_tabs; /**< The string to use as tabbification sequence. */
80 std::ofstream m_headerfile; /**< An output file stream to the FieldImpls headerfile. */
81 std::ofstream m_sourcefile; /**< An output file stream to the FieldImpls sourcefile. */
82 std::ofstream m_tiheaderfile; /**< An output file stream to the TableImpls headerfile. */
83 std::ofstream m_tisourcefile; /**< An output file stream to the TableImpls sourcefile. */
85 TableDefVector::const_iterator m_begin; /**< The begin iterator to use to get the tables. */
86 TableDefVector::const_iterator m_end; /**< The end iterator ot use to get the tables. */