![]() |
PhoenixGenerator
2.0.0
Set of tools to generate code
|
#include "header_generator.h"
#include "saveClassConfig.h"
#include "type_utils.h"
#include "wrapper_convertType.h"
#include "wrapper_module_generator.h"
Go to the source code of this file.
Functions | |
PString | getObjectParseTuple (const PString &varName) |
Get the proper code for PyArg_ParseTuple with one object. More... | |
PString | project_wrapper_allClassImpl (const std::vector< PClassConfig > &vecClassConfig, const PString &moduleName) |
Do the implementation of all classes. More... | |
PString | project_wrapper_attributeDef (const PClassAttribute &attr) |
Get the C++ definition of an attribute. More... | |
PString | project_wrapper_callAttributeCheck (const PString &className, const PClassAttribute &attr, const PString &moduleName, const PString &expectedType) |
Do the check call of an attribute of a given class. More... | |
PString | project_wrapper_classAttributeFromMessage (const PString &className, const PClassAttribute &attr) |
Do the implementation of from message of one attribute. More... | |
PString | project_wrapper_classAttributeGetSize (const PString &className, const PClassAttribute &attr) |
Do the implementation of get size of one attribute. More... | |
PString | project_wrapper_classAttributeToMessage (const PString &className, const PClassAttribute &attr) |
Do the implementation of to message of one attribute. More... | |
PString | project_wrapper_classGetterSetterDef (const PString &className, const PClassAttribute &attr) |
Definition of the getter and setter for complex types. More... | |
PString | project_wrapper_classImpl (const PClassConfig &classConfig, const PString &moduleName) |
Do the implementation of one classe. More... | |
PString | project_wrapper_classImplCheck (const PClassConfig &classConfig, const PString &moduleName) |
Do the check implementation of class. More... | |
PString | project_wrapper_classImplDealloc (const PClassConfig &classConfig) |
Implement new and dealloc. More... | |
PString | project_wrapper_classImplGetterSetter (const PClassConfig &classConfig) |
Implement new and dealloc. More... | |
PString | project_wrapper_classImplNewc (const PClassConfig &classConfig) |
Implement new and dealloc. More... | |
PString | project_wrapper_classImplPythonType (const PClassConfig &classConfig, const PString &moduleName, const PString &fromOtherType) |
Create the Python type of the given class. More... | |
PString | project_wrapper_classPythonFromBytes (const PClassConfig &classConfig, const PString &className) |
Do the implementation of data stream method _fromBytes for one class. More... | |
PString | project_wrapper_classPythonGetSizeInBytes (const PClassConfig &classConfig, const PString &className) |
Do the implementation of data stream method _getSizeInByte for one class. More... | |
PString | project_wrapper_classPythonToBytes (const PClassConfig &classConfig, const PString &className) |
Do the implementation of data stream method _toBytes for one class. More... | |
PString | project_wrapper_dataStreamMethod (const PClassConfig &classConfig, const PString &className) |
Do the implementation of data stream method for one class. More... | |
PString | project_wrapper_enumImpl (const PClassConfig &classConfig, const PString &moduleName) |
Do the implementation of one enum. More... | |
PString | project_wrapper_enumImplNewc (const PClassConfig &classConfig) |
Implement new and dealloc. More... | |
PString | project_wrapper_enumImplPythonType (const PClassConfig &classConfig, const PString &moduleName, const PString &fromOtherType) |
Create the Python type of the given class. More... | |
PString | project_wrapper_moduleAddObject (const std::vector< PClassConfig > &vecClassConfig) |
Create the Py_INCREF for all classes of the module. More... | |
bool | project_wrapper_moduleGenerator (const PPath &modulePath, const ProjectConfig &projectConfig, const PString &baseImplInclude, const std::vector< PClassConfig > &vecClassConfig, const PVecPath &vecInclude) |
Create the wrapper module. More... | |
bool | project_wrapper_moduleGeneratorMain (const PPath &fileName, const ProjectConfig &projectConfig, const PString &baseImplInclude, const std::vector< PClassConfig > &vecClassConfig, const PVecPath &vecInclude) |
Create the main wrapper module. More... | |
bool | project_wrapper_moduleGeneratorWrapperHeader (const PPath &wrapperHeader, const ProjectConfig &projectConfig, const PString &baseImplInclude, const std::vector< PClassConfig > &vecClassConfig, const PVecPath &vecInclude) |
Create the wrapper module header. More... | |
PString | project_wrapper_moduleGeneratorWrapperHeaderAllStructDef (const std::vector< PClassConfig > &vecClassConfig) |
Predefine struct of the wrapper. More... | |
PString | project_wrapper_moduleGeneratorWrapperHeaderEnumDef (const PClassConfig &classConfig) |
Enum of the wrapper. More... | |
PString | project_wrapper_moduleGeneratorWrapperHeaderStructDef (const PClassConfig &classConfig) |
Struct of the wrapper. More... | |
PString | project_wrapper_moduleGeneratorWrapperHeaderStructPreDef (const std::vector< PClassConfig > &vecClassConfig) |
Predefine struct of the wrapper. More... | |
bool | project_wrapper_moduleGeneratorWrapperImpl (const PPath &wrapperSource, const ProjectConfig &projectConfig, const PString &baseImplInclude, const std::vector< PClassConfig > &vecClassConfig, const PVecPath &vecInclude) |
Create the wrapper module source. More... | |
PString | project_wrapper_modulePyIncref (const std::vector< PClassConfig > &vecClassConfig) |
Create the Py_INCREF for all classes of the module. More... | |
PString | project_wrapper_modulePyTypeReady (const std::vector< PClassConfig > &vecClassConfig) |
Create the PyType_Ready for all classes of the module. More... | |
PString | projecy_wrapper_classCheckCall (const PString &className, const PString &functionName) |
Call the check of a class. More... | |
PString | wrapper_getBuildValueStr (const PString &type) |
Get the string description of the Py_BuildValue call for the given type. More... | |
PString | wrapper_getExpectedType (const PString &type) |
Get the expected type of a given python type. More... | |
PString | wrapper_getObjectToValue (const PString &type) |
Get the function to convert the given object to a value. More... | |
PString | wrapper_getValueToObject (const PString &type) |
Get the function to convert the given value to a PyObject. More... | |
Get the proper code for PyArg_ParseTuple with one object.
varName | : name of the variable to be checked |
Definition at line 546 of file wrapper_module_generator.cpp.
Referenced by project_wrapper_classPythonFromBytes().
PString project_wrapper_allClassImpl | ( | const std::vector< PClassConfig > & | vecClassConfig, |
const PString & | moduleName | ||
) |
Do the implementation of all classes.
vecClassConfig | : vector of class configuration |
moduleName | : name of the module where the class should be defined |
Definition at line 1247 of file wrapper_module_generator.cpp.
References project_wrapper_classImpl(), and project_wrapper_enumImpl().
Referenced by project_wrapper_moduleGeneratorWrapperImpl().
PString project_wrapper_attributeDef | ( | const PClassAttribute & | attr | ) |
Get the C++ definition of an attribute.
attr | : attribute of a class |
Definition at line 217 of file wrapper_module_generator.cpp.
References PClassAttribute::getDocumentation(), getIsSimpleType(), PClassAttribute::getName(), and PClassAttribute::getType().
Referenced by project_wrapper_moduleGeneratorWrapperHeaderStructDef().
PString project_wrapper_callAttributeCheck | ( | const PString & | className, |
const PClassAttribute & | attr, | ||
const PString & | moduleName, | ||
const PString & | expectedType | ||
) |
Do the check call of an attribute of a given class.
className | : name of the class the attribute belongs to |
attr | : class attribute to be checked |
moduleName | : name of the module where the class should be defined |
expectedType | : expected type by respected to the configuration .pdata |
Definition at line 928 of file wrapper_module_generator.cpp.
References PClassAttribute::getName(), and PClassAttribute::getType().
Referenced by project_wrapper_classImplCheck().
PString project_wrapper_classAttributeFromMessage | ( | const PString & | className, |
const PClassAttribute & | attr | ||
) |
Do the implementation of from message of one attribute.
className | : name of the current class |
attr | : current attribute |
Definition at line 711 of file wrapper_module_generator.cpp.
References generator_getListNestedType(), generator_typeIsList(), PClassAttribute::getIsEnum(), getIsSimpleType(), PClassAttribute::getName(), PClassAttribute::getType(), and wrapper_getValueToObject().
Referenced by project_wrapper_dataStreamMethod().
PString project_wrapper_classAttributeGetSize | ( | const PString & | className, |
const PClassAttribute & | attr | ||
) |
Do the implementation of get size of one attribute.
classConfig | : class configuration |
className | : name of the current class |
Definition at line 862 of file wrapper_module_generator.cpp.
References generator_getListNestedType(), generator_typeIsList(), PClassAttribute::getIsEnum(), getIsSimpleType(), PClassAttribute::getName(), and PClassAttribute::getType().
Referenced by project_wrapper_dataStreamMethod().
PString project_wrapper_classAttributeToMessage | ( | const PString & | className, |
const PClassAttribute & | attr | ||
) |
Do the implementation of to message of one attribute.
className | : name of the current class |
attr | : current attribute |
Definition at line 796 of file wrapper_module_generator.cpp.
References generator_getListNestedType(), generator_typeIsList(), PClassAttribute::getIsEnum(), getIsSimpleType(), PClassAttribute::getName(), PClassAttribute::getType(), and wrapper_getObjectToValue().
Referenced by project_wrapper_dataStreamMethod().
PString project_wrapper_classGetterSetterDef | ( | const PString & | className, |
const PClassAttribute & | attr | ||
) |
Definition of the getter and setter for complex types.
className | : name of the current class |
attr | : attribute of a class |
Definition at line 234 of file wrapper_module_generator.cpp.
References getIsSimpleType(), PClassAttribute::getName(), and PClassAttribute::getType().
Referenced by project_wrapper_moduleGeneratorWrapperHeaderStructDef().
PString project_wrapper_classImpl | ( | const PClassConfig & | classConfig, |
const PString & | moduleName | ||
) |
Do the implementation of one classe.
classConfig | : class configuration |
moduleName | : name of the module where the class should be defined |
Definition at line 1184 of file wrapper_module_generator.cpp.
References getIsSimpleType(), PClassConfig::getListAttribute(), PClassConfig::getName(), getPythonStrForPythonApiType(), project_wrapper_classImplCheck(), project_wrapper_classImplDealloc(), project_wrapper_classImplGetterSetter(), project_wrapper_classImplNewc(), project_wrapper_classImplPythonType(), project_wrapper_dataStreamMethod(), and PString::replace().
Referenced by project_wrapper_allClassImpl().
PString project_wrapper_classImplCheck | ( | const PClassConfig & | classConfig, |
const PString & | moduleName | ||
) |
Do the check implementation of class.
classConfig | : class configuration |
moduleName | : name of the module where the class should be defined |
Definition at line 944 of file wrapper_module_generator.cpp.
References generator_getListNestedType(), generator_typeIsList(), getIsSimpleType(), PClassConfig::getListAttribute(), PClassConfig::getName(), project_wrapper_callAttributeCheck(), and wrapper_getExpectedType().
Referenced by project_wrapper_classImpl().
PString project_wrapper_classImplDealloc | ( | const PClassConfig & | classConfig | ) |
Implement new and dealloc.
classConfig | : class configuration |
moduleName | : name of the module where the class should be defined |
Definition at line 480 of file wrapper_module_generator.cpp.
References getIsSimpleType(), PClassConfig::getListAttribute(), and PClassConfig::getName().
Referenced by project_wrapper_classImpl().
PString project_wrapper_classImplGetterSetter | ( | const PClassConfig & | classConfig | ) |
Implement new and dealloc.
classConfig | : class configuration |
Definition at line 505 of file wrapper_module_generator.cpp.
References getIsSimpleType(), PClassConfig::getListAttribute(), and PClassConfig::getName().
Referenced by project_wrapper_classImpl().
PString project_wrapper_classImplNewc | ( | const PClassConfig & | classConfig | ) |
Implement new and dealloc.
classConfig | : class configuration |
moduleName | : name of the module where the class should be defined |
Definition at line 435 of file wrapper_module_generator.cpp.
References generator_typeIsList(), getIsSimpleType(), PClassConfig::getListAttribute(), and PClassConfig::getName().
Referenced by project_wrapper_classImpl().
PString project_wrapper_classImplPythonType | ( | const PClassConfig & | classConfig, |
const PString & | moduleName, | ||
const PString & | fromOtherType | ||
) |
Create the Python type of the given class.
classConfig | : class to be used |
moduleName | : name of the module where the class should be defined |
fromOtherType | : name of an other PyTypeObject to inheritate |
Definition at line 382 of file wrapper_module_generator.cpp.
References PClassConfig::getClassDocumentation(), PClassConfig::getName(), and PString::replace().
Referenced by project_wrapper_classImpl().
PString project_wrapper_classPythonFromBytes | ( | const PClassConfig & | classConfig, |
const PString & | className | ||
) |
Do the implementation of data stream method _fromBytes for one class.
classConfig | : class configuration |
className | : name of the current class |
Definition at line 560 of file wrapper_module_generator.cpp.
References PClassConfig::getListAttribute(), and getObjectParseTuple().
Referenced by project_wrapper_dataStreamMethod().
PString project_wrapper_classPythonGetSizeInBytes | ( | const PClassConfig & | classConfig, |
const PString & | className | ||
) |
Do the implementation of data stream method _getSizeInByte for one class.
classConfig | : class configuration |
className | : name of the current class |
Definition at line 676 of file wrapper_module_generator.cpp.
References PClassConfig::getListAttribute(), and projecy_wrapper_classCheckCall().
Referenced by project_wrapper_dataStreamMethod().
PString project_wrapper_classPythonToBytes | ( | const PClassConfig & | classConfig, |
const PString & | className | ||
) |
Do the implementation of data stream method _toBytes for one class.
classConfig | : class configuration |
className | : name of the current class |
Definition at line 629 of file wrapper_module_generator.cpp.
References PClassConfig::getListAttribute(), and projecy_wrapper_classCheckCall().
Referenced by project_wrapper_dataStreamMethod().
PString project_wrapper_dataStreamMethod | ( | const PClassConfig & | classConfig, |
const PString & | className | ||
) |
Do the implementation of data stream method for one class.
classConfig | : class configuration |
className | : name of the current class |
Definition at line 907 of file wrapper_module_generator.cpp.
References PClassConfig::getListAttribute(), project_wrapper_classAttributeFromMessage(), project_wrapper_classAttributeGetSize(), project_wrapper_classAttributeToMessage(), project_wrapper_classPythonFromBytes(), project_wrapper_classPythonGetSizeInBytes(), and project_wrapper_classPythonToBytes().
Referenced by project_wrapper_classImpl().
PString project_wrapper_enumImpl | ( | const PClassConfig & | classConfig, |
const PString & | moduleName | ||
) |
Do the implementation of one enum.
classConfig | : class configuration |
moduleName | : name of the module where the class should be defined |
Definition at line 1127 of file wrapper_module_generator.cpp.
References PClassConfig::getListAttribute(), PClassConfig::getName(), and project_wrapper_enumImplNewc().
Referenced by project_wrapper_allClassImpl().
PString project_wrapper_enumImplNewc | ( | const PClassConfig & | classConfig | ) |
Implement new and dealloc.
classConfig | : class configuration |
moduleName | : name of the module where the class should be defined |
Definition at line 1054 of file wrapper_module_generator.cpp.
References PClassConfig::getListAttribute(), and PClassConfig::getName().
Referenced by project_wrapper_enumImpl().
PString project_wrapper_enumImplPythonType | ( | const PClassConfig & | classConfig, |
const PString & | moduleName, | ||
const PString & | fromOtherType | ||
) |
Create the Python type of the given class.
classConfig | : class to be used |
moduleName | : name of the module where the class should be defined |
fromOtherType | : name of an other PyTypeObject to inheritate |
Definition at line 1001 of file wrapper_module_generator.cpp.
References PClassConfig::getClassDocumentation(), PClassConfig::getName(), and PString::replace().
PString project_wrapper_moduleAddObject | ( | const std::vector< PClassConfig > & | vecClassConfig | ) |
Create the Py_INCREF for all classes of the module.
vecClassConfig | : vector of class configuration |
Definition at line 113 of file wrapper_module_generator.cpp.
Referenced by project_wrapper_moduleGeneratorMain().
bool project_wrapper_moduleGenerator | ( | const PPath & | modulePath, |
const ProjectConfig & | projectConfig, | ||
const PString & | baseImplInclude, | ||
const std::vector< PClassConfig > & | vecClassConfig, | ||
const PVecPath & | vecInclude | ||
) |
Create the wrapper module.
modulePath | : path of the module |
projectConfig | : config of the project |
baseImplInclude | : basic include of the module implementation |
vecClassConfig | : vector of class configuration |
vecInclude | : vector of includes |
Definition at line 1296 of file wrapper_module_generator.cpp.
References ProjectConfig::name, project_wrapper_moduleGeneratorMain(), project_wrapper_moduleGeneratorWrapperHeader(), project_wrapper_moduleGeneratorWrapperImpl(), and PString::toLower().
Referenced by project_wrapper_generator().
bool project_wrapper_moduleGeneratorMain | ( | const PPath & | fileName, |
const ProjectConfig & | projectConfig, | ||
const PString & | baseImplInclude, | ||
const std::vector< PClassConfig > & | vecClassConfig, | ||
const PVecPath & | vecInclude | ||
) |
Create the main wrapper module.
fileName | : path of the module |
projectConfig | : config of the project |
baseImplInclude | : basic include of the module implementation |
vecClassConfig | : vector of class configuration |
vecInclude | : vector of includes |
Definition at line 138 of file wrapper_module_generator.cpp.
References licenceSaveStr(), ProjectConfig::name, project_wrapper_moduleAddObject(), project_wrapper_modulePyIncref(), project_wrapper_modulePyTypeReady(), PPath::saveFileContent(), and PString::toLower().
Referenced by project_wrapper_moduleGenerator().
bool project_wrapper_moduleGeneratorWrapperHeader | ( | const PPath & | wrapperHeader, |
const ProjectConfig & | projectConfig, | ||
const PString & | baseImplInclude, | ||
const std::vector< PClassConfig > & | vecClassConfig, | ||
const PVecPath & | vecInclude | ||
) |
Create the wrapper module header.
wrapperHeader | : path of the wrapper header |
projectConfig | : config of the project |
baseImplInclude | : basic include of the module implementation |
vecClassConfig | : vector of class configuration |
vecInclude | : vector of includes |
Definition at line 356 of file wrapper_module_generator.cpp.
References licenceSaveStr(), project_wrapper_moduleGeneratorWrapperHeaderAllStructDef(), project_wrapper_moduleGeneratorWrapperHeaderStructPreDef(), PPath::saveFileContent(), and PString::toUpper().
Referenced by project_wrapper_moduleGenerator().
PString project_wrapper_moduleGeneratorWrapperHeaderAllStructDef | ( | const std::vector< PClassConfig > & | vecClassConfig | ) |
Predefine struct of the wrapper.
vecClassConfig | : vector of class configuration |
Definition at line 335 of file wrapper_module_generator.cpp.
References project_wrapper_moduleGeneratorWrapperHeaderEnumDef(), and project_wrapper_moduleGeneratorWrapperHeaderStructDef().
Referenced by project_wrapper_moduleGeneratorWrapperHeader().
PString project_wrapper_moduleGeneratorWrapperHeaderEnumDef | ( | const PClassConfig & | classConfig | ) |
Enum of the wrapper.
classConfig | : class configuration |
Definition at line 247 of file wrapper_module_generator.cpp.
References PClassConfig::getName().
Referenced by project_wrapper_moduleGeneratorWrapperHeaderAllStructDef().
PString project_wrapper_moduleGeneratorWrapperHeaderStructDef | ( | const PClassConfig & | classConfig | ) |
Struct of the wrapper.
classConfig | : class configuration |
Definition at line 282 of file wrapper_module_generator.cpp.
References PClassConfig::getClassDocumentation(), PClassConfig::getListAttribute(), PClassConfig::getName(), project_wrapper_attributeDef(), and project_wrapper_classGetterSetterDef().
Referenced by project_wrapper_moduleGeneratorWrapperHeaderAllStructDef().
PString project_wrapper_moduleGeneratorWrapperHeaderStructPreDef | ( | const std::vector< PClassConfig > & | vecClassConfig | ) |
Predefine struct of the wrapper.
vecClassConfig | : vector of class configuration |
Definition at line 204 of file wrapper_module_generator.cpp.
Referenced by project_wrapper_moduleGeneratorWrapperHeader().
bool project_wrapper_moduleGeneratorWrapperImpl | ( | const PPath & | wrapperSource, |
const ProjectConfig & | projectConfig, | ||
const PString & | baseImplInclude, | ||
const std::vector< PClassConfig > & | vecClassConfig, | ||
const PVecPath & | vecInclude | ||
) |
Create the wrapper module source.
wrapperSource | : path of the wrapper source |
projectConfig | : config of the project |
baseImplInclude | : basic include of the module implementation |
vecClassConfig | : vector of class configuration |
vecInclude | : vector of includes |
Definition at line 1267 of file wrapper_module_generator.cpp.
References licenceSaveStr(), ProjectConfig::name, project_wrapper_allClassImpl(), PPath::saveFileContent(), and PString::toLower().
Referenced by project_wrapper_moduleGenerator().
PString project_wrapper_modulePyIncref | ( | const std::vector< PClassConfig > & | vecClassConfig | ) |
Create the Py_INCREF for all classes of the module.
vecClassConfig | : vector of class configuration |
Definition at line 91 of file wrapper_module_generator.cpp.
Referenced by project_wrapper_moduleGeneratorMain().
PString project_wrapper_modulePyTypeReady | ( | const std::vector< PClassConfig > & | vecClassConfig | ) |
Create the PyType_Ready for all classes of the module.
vecClassConfig | : vector of class configuration |
Definition at line 73 of file wrapper_module_generator.cpp.
Referenced by project_wrapper_moduleGeneratorMain().
Call the check of a class.
className | : name of the class to be checked |
functionName | : name of the function where it is called |
Definition at line 612 of file wrapper_module_generator.cpp.
Referenced by project_wrapper_classPythonGetSizeInBytes(), and project_wrapper_classPythonToBytes().
Get the string description of the Py_BuildValue call for the given type.
type | : type of the used |
Definition at line 17 of file wrapper_module_generator.cpp.
Get the expected type of a given python type.
type | : type ot be used |
Definition at line 60 of file wrapper_module_generator.cpp.
Referenced by project_wrapper_classImplCheck().
Get the function to convert the given object to a value.
type | : tpye to be used |
Definition at line 32 of file wrapper_module_generator.cpp.
Referenced by project_wrapper_classAttributeToMessage().
Get the function to convert the given value to a PyObject.
type | : tpye to be used |
Definition at line 46 of file wrapper_module_generator.cpp.
Referenced by project_wrapper_classAttributeFromMessage().