blob: 0a9bd3f57f7e122dfa8694fec87fa5c343cb87df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/* ***** BEGIN LICENSE BLOCK *****
* Copyright (C) 2012, Peter Hatina <phatina@redhat.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ***** END LICENSE BLOCK ***** */
#ifndef GENERATOR_H
#define GENERATOR_H
#include <list>
#include <map>
#include <set>
#include "attribute.h"
#include "method.h"
#include "token.h"
class Generator
{
public:
Generator(const std::list<Attribute> &attributes,
const std::list<Method> &methods);
~Generator();
void generate();
private:
void init();
void generateHeader();
void generateFooter();
void generateConnectVars();
void generateContent();
static std::string lowerString(const std::string &str);
static std::string splitIdentifier(const std::string &str);
static std::string attributeDefaultValue(const Attribute &attr);
static std::string attributeToHtmlElement(const Attribute &attr);
static bool attributeEnabled(const Attribute &attr);
static bool methodEnabled(const Method &method, const Method::MethodParam ¶m);
private:
std::list<Attribute> m_attributes;
std::list<Method> m_methods;
static std::set<std::string> s_default_attributes;
static std::set<std::string> s_default_methods;
static std::map<std::string, std::string> s_default_attribute_values;
};
#endif // GENERATOR_H
|