Graphite  Version 3
An experimental 3D geometry processing program
module_maker.h
Go to the documentation of this file.
1 /*
2  * OGF/Graphite: Geometry and Graphics Programming Library + Utilities
3  * Copyright (C) 2000 Bruno Levy
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 2 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 Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  * If you modify this software, you should include a notice giving the
20  * name of the person performing the modification, the date of modification,
21  * and the reason for such modification.
22  *
23  * Contact: Bruno Levy
24  *
25  * levy@loria.fr
26  *
27  * ISA Project
28  * LORIA, INRIA Lorraine,
29  * Campus Scientifique, BP 239
30  * 54506 VANDOEUVRE LES NANCY CEDEX
31  * FRANCE
32  *
33  * Note that the GNU General Public License does not permit incorporating
34  * the Software into proprietary programs.
35  */
36 
37 #ifndef H_OGF_DEVEL_TYPES_MODULE_MAKER_H
38 #define H_OGF_DEVEL_TYPES_MODULE_MAKER_H
39 
42 
48 namespace OGF {
49 
55  class DEVEL_API ModuleMaker {
56  public:
61 
71  const std::string& module_name,
72  const std::string& author_name
73  );
74 
91  const std::string& module_name,
92  const std::string& subdirectory,
93  const std::string& file_name,
94  const std::string& header_skel = "devel/file.h.skel",
95  const std::string& source_skel = "devel/file.cpp.skel"
96  );
97 
116  const std::string& module_name,
117  const std::string& subdirectory,
118  const std::string& class_name,
119  const std::string& header_skel = "devel/class.h.skel",
120  const std::string& source_skel = "devel/class.cpp.skel"
121  );
122 
123 
145  const std::string& module_name,
146  const std::string& subdirectory,
147  const std::string& base_class_name,
148  const std::string& class_name,
149  const std::string& header_skel = "devel/gom_class.h.skel",
150  const std::string& source_skel = "devel/gom_class.cpp.skel"
151  );
152 
177  const std::string& module_name,
178  const std::string& subdirectory,
179  const std::string& base_class_name,
180  const std::string& class_name,
181  const std::string& header_skel,
182  const std::string& source_skel,
184  );
185 
199  const std::string& module_name,
200  const std::string& grob_class_name,
201  const std::string& commands_name
202  );
203 
219  const std::string& module_name,
220  const std::string& grob_class_name,
221  const std::string& shader_name,
222  const std::string& base_class_name = ""
223  );
224 
240  const std::string& module_name,
241  const std::string& grob_class_name,
242  const std::string& tool_name,
243  const std::string& base_class_name = ""
244  );
245 
259  const std::string& module_name,
260  const std::string& grob_name,
261  const std::string& file_extension = "",
262  const std::string& base_class_name = "OGF::Grob"
263  );
264 
265  protected:
266 
275  bool set_module(const std::string& module_name, bool check = true);
276 
286 
304  const std::string& file_name,
305  const std::string& skel_name,
306  const TextUtils::Environment& env,
307  bool insert_header = false
308  );
309 
320  const std::string& dir_name
321  );
322 
330  std::string class_name_to_file_name(const std::string& class_name);
331 
338  std::string file_name_to_include_guard(const std::string& file_name);
339 
351  bool insert(
352  const std::string& file_name,
353  const std::string& insertion_point,
354  const std::string& line
355  );
356 
363  void add_directory_to_cmake(const std::string& directory);
364 
365 
371 
372  private:
373  std::string project_root_;
374  std::string package_;
375  std::string package_path_;
376  std::string author_;
377  };
378 
379 }
380 
381 #endif
Generates plugins using skeletons in lib/devel/.
Definition: module_maker.h:55
bool insert(const std::string &file_name, const std::string &insertion_point, const std::string &line)
Inserts a new line in a file.
void add_directory_to_cmake(const std::string &directory)
Adds a directory to the list of directories where source files should be gathered in the CMake file.
bool create_gom_class(const std::string &module_name, const std::string &subdirectory, const std::string &base_class_name, const std::string &class_name, const std::string &header_skel="devel/gom_class.h.skel", const std::string &source_skel="devel/gom_class.cpp.skel")
Creates sources for a new C++ GOM class in a module.
void set_module_name(TextUtils::Environment &env)
Sets the substitution rules deduced from the name of the current module.
void create_file(const std::string &module_name, const std::string &subdirectory, const std::string &file_name, const std::string &header_skel="devel/file.h.skel", const std::string &source_skel="devel/file.cpp.skel")
Creates a new C++ source in a module.
bool create_gom_class(const std::string &module_name, const std::string &subdirectory, const std::string &base_class_name, const std::string &class_name, const std::string &header_skel, const std::string &source_skel, TextUtils::Environment &env)
Creates sources for a new C++ GOM class in a module.
bool create_file_from_skel(const std::string &file_name, const std::string &skel_name, const TextUtils::Environment &env, bool insert_header=false)
Creates a file from an skeleton file and a set of substitution rules.
void create_grob(const std::string &module_name, const std::string &grob_name, const std::string &file_extension="", const std::string &base_class_name="OGF::Grob")
Creates source files for a new Grob class.
void create_class(const std::string &module_name, const std::string &subdirectory, const std::string &class_name, const std::string &header_skel="devel/class.h.skel", const std::string &source_skel="devel/class.cpp.skel")
Creates sources for a new C++ class in a module.
void create_shader(const std::string &module_name, const std::string &grob_class_name, const std::string &shader_name, const std::string &base_class_name="")
Creates source files for a new Shader class.
void create_tool(const std::string &module_name, const std::string &grob_class_name, const std::string &tool_name, const std::string &base_class_name="")
Creates source files for a new Tool class.
std::string file_name_to_include_guard(const std::string &file_name)
Converts a file name to an include guard.
void touch_root_cmake()
Changes the modification time of the root CMakeLists.txt in order to trigger recompilation.
void create_commands(const std::string &module_name, const std::string &grob_class_name, const std::string &commands_name)
Creates source files for a new Commands class.
std::string class_name_to_file_name(const std::string &class_name)
Converts a class name to a file name.
bool create_module(const std::string &module_name, const std::string &author_name)
Creates a new module (a plugin).
ModuleMaker()
ModuleMaker constructor.
bool create_directory(const std::string &dir_name)
Creates a new directory.
bool set_module(const std::string &module_name, bool check=true)
Sets the name of the current module where files should be generated.
Manages a set of name-value or name-values pairs, used to manipulate text files.
Definition: text_utils.h:61
std::string dir_name(const std::string &path)
Gets a path directory.
Global Graphite namespace.
Definition: common.h:76
Definitions common to all include files in the devel library.
Utilities to manipulate text files.