Fawkes API  Fawkes Development Version
plugin_generator.h
1 
2 /***************************************************************************
3  * cpp_generator.h - C++ Interface generator
4  *
5  * Created: Thu Oct 12 01:59:02 2006
6  * Copyright 2006-2008 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef _PLUGINS_GENERATOR_H_
24 #define _PLUGINS_GENERATOR_H_
25 
26 #include <sstream>
27 #include <stdio.h>
28 #include <string>
29 #include <vector>
30 
31 class PluginGenerator
32 {
33 public:
34  PluginGenerator(const std::string &directory,
35  const std::string &author,
36  const std::string &year,
37  const std::string &creation_date,
38  const std::string &plugin_name,
39  const std::string &description);
41 
42  void write_thread_h(FILE *f);
43  void write_thread_cpp(FILE *f);
44  void write_plugin_cpp(FILE *f);
45  void write_makefile(FILE *f);
46  void write_makefile_header(FILE *f);
47  void write_header(FILE *f, std::string filename);
48  void write_deflector(FILE *f);
49  std::string format_class_name(std::string plugin_name, std::string append);
50  std::string replace_dash_w_undescore(std::string source);
51  void generate();
52 
53 private:
54  std::string _dir;
55  std::string _author;
56  std::string _year;
57  std::string _creation_date;
58  std::string _plugin_name;
59  std::string _plugin_name_underscore;
60  std::string _class_name_thread;
61  std::string _class_name_plugin;
62  std::string _description;
63  std::string _filename_thread_cpp;
64  std::string _filename_thread_h;
65  std::string _filename_plugin_cpp;
66  std::string _filename_makefile;
67  std::string _deflector;
68 };
69 
70 #endif
PluginGenerator::write_plugin_cpp
void write_plugin_cpp(FILE *f)
Write plugin cpp file.
Definition: plugin_generator.cpp:237
PluginGenerator::write_thread_h
void write_thread_h(FILE *f)
Write h file.
Definition: plugin_generator.cpp:196
PluginGenerator::write_makefile
void write_makefile(FILE *f)
Write Makefile.
Definition: plugin_generator.cpp:281
PluginGenerator::replace_dash_w_undescore
std::string replace_dash_w_undescore(std::string source)
Replace dash with underscore.
Definition: plugin_generator.cpp:310
PluginGenerator::~PluginGenerator
~PluginGenerator()
Destructor.
Definition: plugin_generator.cpp:80
PluginGenerator::write_deflector
void write_deflector(FILE *f)
Write header deflector.
Definition: plugin_generator.cpp:149
PluginGenerator::write_header
void write_header(FILE *f, std::string filename)
Write header to file.
Definition: plugin_generator.cpp:89
PluginGenerator::generate
void generate()
Generator cpp and h files.
Definition: plugin_generator.cpp:357
PluginGenerator::format_class_name
std::string format_class_name(std::string plugin_name, std::string append)
Format a lowercase plugin name to CamelCase class.
Definition: plugin_generator.cpp:326
PluginGenerator::write_thread_cpp
void write_thread_cpp(FILE *f)
Write cpp file.
Definition: plugin_generator.cpp:159
PluginGenerator::PluginGenerator
PluginGenerator(const std::string &directory, const std::string &author, const std::string &year, const std::string &creation_date, const std::string &plugin_name, const std::string &description)
Constructor.
Definition: plugin_generator.cpp:48
PluginGenerator
Definition: plugin_generator.h:30
PluginGenerator::write_makefile_header
void write_makefile_header(FILE *f)
Write makefile header.
Definition: plugin_generator.cpp:122