28 else{baseToUse = baseFileName;}
29 if(baseToUse ==
""){
return false;}
45 fs.open(fileNameInclude.c_str());
47 std::cerr <<
"PClassGenerator::saveFileDef : can't open file '" << fileNameInclude <<
"'" << std::endl;
52 fs <<
"#ifndef " << macroDef << std::endl;
53 fs <<
"#define " << macroDef << std::endl << std::endl << std::endl;
56 fs << std::endl << std::endl <<
"#endif" << std::endl << std::endl;
68 fs.open(fileNameSource.c_str());
70 std::cerr <<
"PClassGenerator::saveFileImpl : can't open file '" << fileNameSource <<
"'" << std::endl;
75 fs << std::endl <<
"#include \"" << fileNameInclude <<
"\"" << std::endl << std::endl;
77 fs << std::endl << std::endl;
79 fs << std::endl << std::endl;
92 fs <<
"\tpublic:" << std::endl;
98 fs <<
"\tprotected:" << std::endl;
100 fs <<
"\tprivate:" << std::endl;
102 fs <<
"};" << std::endl << std::endl;;
137 if(templateDef ==
""){
147 for(PVecString::iterator it(listDef.begin()); it != listDef.end(); ++it){
149 if(partDef.size() == 2lu){
186 fs <<
"#include \"" << fileNameSource <<
"\"" << std::endl;
196 fs <<
"#ifndef " << macroDef << std::endl;
197 fs <<
"#define " << macroDef << std::endl << std::endl << std::endl;
205 fs << std::endl << std::endl <<
"#endif" << std::endl << std::endl;
220 fs <<
"///Default constructor of " <<
p_className << std::endl;
224 fs <<
"}" << std::endl;
232 fs <<
"\t\tvirtual ~" <<
p_className <<
"();" << std::endl;
239 fs <<
"///Destructor of " <<
p_className << std::endl;
242 fs <<
"\t" << std::endl;
243 fs <<
"}" << std::endl;
258 fs <<
"///Initialisation function of the class " <<
p_className << std::endl;
261 fs <<
"\t" << std::endl;
262 fs <<
"}" << std::endl;
279 fs <<
"///Copy constructor of " <<
p_className << std::endl;
280 fs <<
"/**\t@param other : class to copy" << std::endl;
281 fs <<
"*/" << std::endl;
285 fs <<
"}" << std::endl;
302 fs <<
"///Definition of equal operator of " <<
p_className << std::endl;
303 fs <<
"/**\t@param other : class to copy" << std::endl;
304 fs <<
" * \t@return copied class" << std::endl;
305 fs <<
"*/" << std::endl;
310 fs <<
"\treturn *this;" << std::endl;
311 fs <<
"}" << std::endl;
328 fs <<
"///Copy function of " <<
p_className << std::endl;
329 fs <<
"/**\t@param other : class to copy" << std::endl;
330 fs <<
"*/" << std::endl;
333 fs <<
"\t" << std::endl;
334 fs <<
"}" << std::endl;
std::vector< PString > PVecString
virtual ~PClassGenerator()
Destructor of PClassGenerator.
bool saveFileImplDef(const PPath &baseFileName)
Saves both files include and sources of the class.
bool saveClassImpl(std::ofstream &fs)
Saves class implementation.
PString p_className
Name of the class.
bool p_useTemplate
Says if we need to use template.
void setClassName(const PString &className)
Set the class name.
void saveCopyFunctionImpl(std::ofstream &fs)
Saves the implementation of the copy function.
void saveDestructorDef(std::ofstream &fs)
Saves the defition of the destructor.
PString p_classBrief
Brief description of the class.
void saveConstructorImpl(std::ofstream &fs)
Saves the implementation of the constructor.
void saveCopyContructorDef(std::ofstream &fs)
Saves the defition of the copy constructor.
PString p_templateListVar
Template list var.
void saveInitialisationFunctionDef(std::ofstream &fs)
Saves the definition of the initialisation function.
bool saveFileImpl(const PPath &fileNameSource, const PPath &fileNameInclude)
Saves class implementation.
bool p_useCopyFunction
True if we need to use a copy function.
void saveCopyFunctionDef(std::ofstream &fs)
Saves the defition of the copy function.
PString p_classNameSpace
Namespace of the class.
void saveTemplateBeginImpl(std::ofstream &fs, const PPath &fileNameInclude)
Saves class implementation.
bool saveFileDef(const PPath &fileNameInclude, const PPath &fileNameSource)
Saves class definition.
void saveConstructorDef(std::ofstream &fs)
Saves the defition of the constructor.
PClassGenerator()
Constructor of PClassGenerator.
void saveTemplateDefinition(std::ofstream &fs)
Saves the template defition.
void setTemplateDefVar(const PString &templateDef)
Set the template definition.
void saveCopyEqualOperatorImpl(std::ofstream &fs)
Saves the implementation of the equal operator constructor.
void saveCopyEqualOperatorDef(std::ofstream &fs)
Saves the defition of the equal operator constructor.
void saveInitialisationFunctionImpl(std::ofstream &fs)
Saves the implementation of the initialisation function.
void saveTemplateEndImpl(std::ofstream &fs)
Saves class implementation template end.
bool saveClassDef(std::ofstream &fs)
Saves class definition.
void saveTemplateEndDefinition(std::ofstream &fs, const PPath &fileNameSource)
Saves the template defition.
PString p_templateDefVar
Template def var.
void saveDestructorImpl(std::ofstream &fs)
Saves the implementation of the destructor.
void initialisationPClassGenerator()
Initialisation function of PClassGenerator.
PString p_classTypeName
Name of the class type (with template if there is one)
void saveCopyContructorImpl(std::ofstream &fs)
Saves the implementation of the copy constructor.
Path of a directory or a file.
PString replace(const PString &pattern, const PString &replaceStr) const
Replace a PString into an other PString.
std::vector< PString > split(char separator) const
Cut a PString on the given separator char.
PString toUpper() const
Convert std::string in upper case.
PString firstToUpper() const
Convert first letter of the PString in upper case.