Generates plugins using skeletons in lib/devel/.
More...
#include <OGF/devel/types/module_maker.h>
|
| ModuleMaker () |
| ModuleMaker constructor.
|
|
bool | create_module (const std::string &module_name, const std::string &author_name) |
| Creates a new module (a plugin). More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
Generates plugins using skeletons in lib/devel/.
Automates the generation of all the tedious to write code for creating new object types, commands, shaders and tools.
Definition at line 55 of file module_maker.h.
◆ add_directory_to_cmake()
void OGF::ModuleMaker::add_directory_to_cmake |
( |
const std::string & |
directory | ) |
|
|
protected |
Adds a directory to the list of directories where source files should be gathered in the CMake file.
- Parameters
-
[in] | directory | the directory to be added, relative to the path of the current module |
◆ class_name_to_file_name()
std::string OGF::ModuleMaker::class_name_to_file_name |
( |
const std::string & |
class_name | ) |
|
|
protected |
Converts a class name to a file name.
- Parameters
-
[in] | class_name | the class name, possibly with the "OGF::" prefix, and in CamelCase |
- Returns
- the file name, all lower case, with one underscore between each word
◆ create_class()
void OGF::ModuleMaker::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.
The generated files are named like the class, with underscore-separated words (instead of camel-case). In the skeleton files, the variables "class_name", "file", "FILE", "package", "Package", "PACKAGE", "PACKAGE_API" and "author" are substituted.
- Parameters
-
[in] | module_name | name of the module |
[in] | subdirectory | subdirectory where the file will be created. If the subdirectory does not exist, it will be created as well |
[in] | class_name | name of the class |
[in] | header_skel | name of the skeleton to be used for the header, relative to the lib/ subdirectory of Graphite |
[in] | source_skel | name of the skeleton to be used for the source, relative to the lib/ subdirectory of Graphite |
◆ create_commands()
void OGF::ModuleMaker::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.
It also inserts the code to register the created Commands class in the initializer of the library.
- Parameters
-
[in] | module_name | name of the module |
[in] | grob_class_name | name of the Grob class these Commands should be attached to, with the "OGF::" prefix |
[in] | commands_name | name of the commands without any prefix/suffix (e.g., use "Remesh" for "OGF::MeshGrobRemeshCommands"). |
◆ create_directory()
bool OGF::ModuleMaker::create_directory |
( |
const std::string & |
dir_name | ) |
|
|
protected |
Creates a new directory.
The created directory is added to the list of directories where source files should be gathered in the CMake file.
- Parameters
-
[in] | dir_name | directory to be created, relative to the path of the current module |
- Return values
-
true | if the directory could be created or already exists |
false | otherwise |
◆ create_file()
void OGF::ModuleMaker::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.
In the skeleton files, the variables "file", "FILE", "package", "Package", "PACKAGE", "PACKAGE_API" and "author" are substituted.
- Parameters
-
[in] | module_name | name of the module |
[in] | subdirectory | subdirectory where the file will be created. If the subdirectory does not exist, it will be created as well |
[in] | file_name | name of the file, without the extension |
[in] | header_skel | name of the skeleton to be used for the header, relative to the lib/ subdirectory of Graphite |
[in] | source_skel | name of the skeleton to be used for the source, relative to the lib/ subdirectory of Graphite |
◆ create_file_from_skel()
bool OGF::ModuleMaker::create_file_from_skel |
( |
const std::string & |
file_name, |
|
|
const std::string & |
skel_name, |
|
|
const TextUtils::Environment & |
env, |
|
|
bool |
insert_header = false |
|
) |
| |
|
protected |
Creates a file from an skeleton file and a set of substitution rules.
- Parameters
-
[in] | file_name | name of the file to be created, relative to the path of the current module |
[in] | skel_name | name of the skeleton file, relative to lib/devel |
[in] | env | a const reference to a TextUtils::Environment, with the substitution rules |
[in] | insert_header | if true, the C++ header (with the copyright, author information etc...) is inserted at the beginning of the generated file |
- Return values
-
true | if the file could be created and the skeleton file exists |
false | otherwise |
◆ create_gom_class() [1/2]
bool OGF::ModuleMaker::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.
The generated files are named like the class, with underscore-separated words (instead of camel-case). In the skeleton files, the variables "class_name", "base_class_name", "base_class_header_file", "file", "FILE", "package", "Package", "PACKAGE", "PACKAGE_API", "author" as well as the ones specified in env
are substituted.
- Parameters
-
[in] | module_name | name of the module |
[in] | subdirectory | subdirectory where the file will be created. If the subdirectory does not exist, it will be created as well |
[in] | base_class_name | name of the base class (inherited by the class) |
[in] | class_name | name of the class |
[in] | header_skel | name of the skeleton to be used for the header, relative to the lib/ subdirectory of Graphite |
[in] | source_skel | name of the skeleton to be used for the source, relative to the lib/ subdirectory of Graphite |
[in] | env | a reference to a TextUtils::Environment used to specified additional substitutions |
◆ create_gom_class() [2/2]
bool OGF::ModuleMaker::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.
The generated files are named like the class, with underscore-separated words (instead of camel-case). In the skeleton files, the variables "class_name", "base_class_name", "base_class_header_file", "file", "FILE", "package", "Package", "PACKAGE", "PACKAGE_API" and "author" are substituted.
- Parameters
-
[in] | module_name | name of the module |
[in] | subdirectory | subdirectory where the file will be created. If the subdirectory does not exist, it will be created as well |
[in] | base_class_name | name of the base class (inherited by the class), with the "OGF::" prefix |
[in] | class_name | name of the class |
[in] | header_skel | name of the skeleton to be used for the header, relative to the lib/ subdirectory of Graphite |
[in] | source_skel | name of the skeleton to be used for the source, relative to the lib/ subdirectory of Graphite |
◆ create_grob()
void OGF::ModuleMaker::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.
It also inserts the code to register the created Grob class in the initializer of the library.
- Parameters
-
[in] | module_name | name of the module |
[in] | grob_name | name of the Grob class without the "OGF::" prefix |
[in] | file_extension | extension of the files used to save/load objects with this Grob class |
[in] | base_class_name | optional name of the base class (inherited by the class), with the "OGF::" prefix |
◆ create_module()
bool OGF::ModuleMaker::create_module |
( |
const std::string & |
module_name, |
|
|
const std::string & |
author_name |
|
) |
| |
Creates a new module (a plugin).
Generates C++ sources and configuration files for a new module.
- Parameters
-
[in] | module_name | name of the module |
[in] | author_name | name of the author, to be copied in header files and in generated module information |
◆ create_shader()
void OGF::ModuleMaker::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.
It also inserts the code to register the created Commands class in the initializer of the library.
- Parameters
-
[in] | module_name | name of the module |
[in] | grob_class_name | name of the Grob class these Commands should be attached to, with the "OGF::" prefix |
[in] | shader_name | name of the shader without any prefix/suffix (e.g., use "Param" for "OGF::ParamSurfaceShader"). |
[in] | base_class_name | name of the base class (inherited by the class), with the "OGF::" prefix |
◆ create_tool()
void OGF::ModuleMaker::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.
It also inserts the code to register the created Tool class in the initializer of the library.
- Parameters
-
[in] | module_name | name of the module |
[in] | grob_class_name | name of the Grob class this Tool should be attached to, with the "OGF::" prefix |
[in] | tool_name | name of the commands without any prefix/suffix (e.g., use "Edit" for "OGF::MeshGrobEditTool"). |
[in] | base_class_name | name of the base class (inherited by the class), with the "OGF::" prefix |
◆ file_name_to_include_guard()
std::string OGF::ModuleMaker::file_name_to_include_guard |
( |
const std::string & |
file_name | ) |
|
|
protected |
Converts a file name to an include guard.
- Parameters
-
[in] | file_name | the file name |
- Returns
- the include guard, all upper case, with slashes converted into underscores, a "__OGF_" prefix and a "__" suffix
◆ insert()
bool OGF::ModuleMaker::insert |
( |
const std::string & |
file_name, |
|
|
const std::string & |
insertion_point, |
|
|
const std::string & |
line |
|
) |
| |
|
protected |
Inserts a new line in a file.
- Parameters
-
[in] | file_name | the name of the file, relative to the path of the current module. |
[in] | insertion_point | a string to be recognized in the file, that indicates where the line should be inserted. It will be inserted before the insertion point. |
[in] | line | the line to be inserted |
- Return values
-
true | if the line could be inserted |
false | otherwise |
◆ set_module()
bool OGF::ModuleMaker::set_module |
( |
const std::string & |
module_name, |
|
|
bool |
check = true |
|
) |
| |
|
protected |
Sets the name of the current module where files should be generated.
- Parameters
-
[in] | module_name | the name of the module |
[in] | check | if true, test whether the module already exists |
- Return values
-
true | if the module already exists or if check is false |
false | if the module does not exist and check is true |
◆ set_module_name()
Sets the substitution rules deduced from the name of the current module.
This sets "package", "Package", "PACKAGE", "PACKAGE_API" and "author".
- Parameters
-
[out] | env | where to store the substitution rules |
- See also
- set_module()
The documentation for this class was generated from the following file: