PhoenixGenerator  2.0.4
Set of tools to generate code
Loading...
Searching...
No Matches
CppTraitTypeStream Class Reference

Class generator for setter trait. More...

#include <CppTraitTypeStream.h>

+ Inheritance diagram for CppTraitTypeStream:
+ Collaboration diagram for CppTraitTypeStream:

Public Member Functions

virtual void classExtraFunctionDeclaration (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 Declaration of extra functions.
 
virtual void classExtraFunctionImplementation (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 Implementation of extra functions.
 
 CppTraitTypeStream ()
 Consctructor of CppTraitTypeStream.
 
virtual void headerExtraInclude (std::ofstream &fs, const GeneratorMode &mode) const
 Add extra include on the header.
 
virtual void privateMethodDeclaration (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 Declaration of private methods.
 
virtual void privateMethodImplementation (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 Implementation of private methods.
 
virtual void protectedMethodDeclaration (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 Declaration of protected methods.
 
virtual void protectedMethodImplementation (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 Implementation of protected methods.
 
virtual void publicMethodDeclaration (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 
virtual void publicMethodImplementation (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 
virtual void testCallFunction (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 Call of the test function.
 
virtual void testFunction (std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
 Implementation of test function.
 
virtual ~CppTraitTypeStream ()
 Desctructor of CppTraitTypeStream.
 

Detailed Description

Class generator for setter trait.

Definition at line 16 of file CppTraitTypeStream.h.

Constructor & Destructor Documentation

◆ CppTraitTypeStream()

CppTraitTypeStream::CppTraitTypeStream ( )

Consctructor of CppTraitTypeStream.

Definition at line 11 of file CppTraitTypeStream.cpp.

References PAbstractTraitBackend::PAbstractTraitBackend().

+ Here is the call graph for this function:

◆ ~CppTraitTypeStream()

CppTraitTypeStream::~CppTraitTypeStream ( )
virtual

Desctructor of CppTraitTypeStream.

Definition at line 16 of file CppTraitTypeStream.cpp.

16{}

Member Function Documentation

◆ classExtraFunctionDeclaration()

void CppTraitTypeStream::classExtraFunctionDeclaration ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
virtual

Declaration of extra functions.

Parameters
[out]fs: file to be completed
classConfig: PClassConfig to be used
mode: mode of the generator

Reimplemented from PAbstractTraitBackend.

Definition at line 72 of file CppTraitTypeStream.cpp.

72 {
73 if(!mode.enableTypeStream){return;}
74 PString name(classConfig.getName());
75
76 if(classConfig.getIsEnum()){
77 name = name + "::" + name;
78 }
79
80 const PVecString & listTemplate = classConfig.getListTemplate();
81 if(listTemplate.size() != 0lu){
82 fs << "///Get the name of the class " << name << std::endl;
83 fs << "/**\t@return name of the class " << name << std::endl;
84 fs << "*/" << std::endl;
85 fs << mode.templateDeclaration;
86 fs << "std::string phoenix_getTypeName<"<<name << mode.defTemplate <<" >(){" << std::endl;
87 fs << "\treturn \""<<name<<"\"";
88 fs << " + \"<\"";
89 for(PVecString::const_iterator it(listTemplate.begin()); it != listTemplate.end(); ++it){
90 fs << " + phoenix_getTypeToStr<"<<it->split(' ').back()<<">()";
91 }
92 fs << " + \">\"";
93 fs << ";" << std::endl;
94 fs << "}" << std::endl << std::endl;
95
96 }else{
97 fs << "template<>" << std::endl;
98 fs << "std::string phoenix_getTypeName<"<<name<<">();" << std::endl << std::endl;
99 }
100}
const PVecString & getListTemplate() const
Returns the list of the template of the class.
const PString & getName() const
Returns the class name.
bool getIsEnum() const
Say if the current PClassConfig is an enum.
PString defTemplate
Template definition for the class header.
PString templateDeclaration
Template declaration of the method implementation.
bool enableTypeStream
True to enable type stream interface generator.

References GeneratorMode::defTemplate, GeneratorMode::enableTypeStream, PClassConfig::getIsEnum(), PClassConfig::getListTemplate(), PClassConfig::getName(), and GeneratorMode::templateDeclaration.

+ Here is the call graph for this function:

◆ classExtraFunctionImplementation()

void CppTraitTypeStream::classExtraFunctionImplementation ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
virtual

Implementation of extra functions.

Parameters
[out]fs: file to be completed
classConfig: PClassConfig to be used
mode: mode of the generator

Reimplemented from PAbstractTraitBackend.

Definition at line 107 of file CppTraitTypeStream.cpp.

107 {
108 if(!mode.enableTypeStream){return;}
109 PString name(classConfig.getName());
110 fs << "///Get the name of the class " << name << " for PhoenixTypeStream" << std::endl;
111 fs << "/**\t@return name of the class " << name << " for PhoenixTypeStream" << std::endl;
112 fs << "*/" << std::endl;
113 if(classConfig.getIsEnum()){
114 name = name + "::" + name;
115 }
116 const PVecString & listTemplate = classConfig.getListTemplate();
117 if(listTemplate.size() == 0lu){
118 fs << "template<>" << std::endl;
119 }else{
120 fs << mode.templateDeclaration;
121 }
122 fs << "std::string phoenix_getTypeName<"<<name << mode.defTemplate <<" >(){" << std::endl;
123 fs << "\treturn \""<<name<<"\"";
124 if(listTemplate.size() != 0lu){
125 fs << " + \"<\"";
126 for(PVecString::const_iterator it(listTemplate.begin()); it != listTemplate.end(); ++it){
127 fs << " + phoenix_getTypeToStr<"<<it->split(' ').back()<<">()";
128 }
129 fs << " + \">\"";
130 }
131 fs << ";" << std::endl;
132 fs << "}" << std::endl << std::endl;
133}

References GeneratorMode::defTemplate, GeneratorMode::enableTypeStream, PClassConfig::getIsEnum(), PClassConfig::getListTemplate(), PClassConfig::getName(), and GeneratorMode::templateDeclaration.

+ Here is the call graph for this function:

◆ headerExtraInclude()

void CppTraitTypeStream::headerExtraInclude ( std::ofstream & fs,
const GeneratorMode & mode ) const
virtual

Add extra include on the header.

Parameters
[out]fs: file to be completed
mode: mode of the generator

Reimplemented from PAbstractTraitBackend.

Definition at line 22 of file CppTraitTypeStream.cpp.

22 {
23 if(!mode.enableTypeStream){return;}
24 fs << "#include \"phoenix_type_stream.h\"" << std::endl;
25}

References GeneratorMode::enableTypeStream.

◆ privateMethodDeclaration()

void CppTraitTypeStream::privateMethodDeclaration ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
virtual

Declaration of private methods.

Parameters
[out]fs: file to be completed
classConfig: PClassConfig to be used
mode: mode of the generator

Reimplemented from PAbstractTraitBackend.

Definition at line 52 of file CppTraitTypeStream.cpp.

52 {
53 if(!mode.enableTypeStream){return;}
54
55}

References GeneratorMode::enableTypeStream.

◆ privateMethodImplementation()

void CppTraitTypeStream::privateMethodImplementation ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
virtual

Implementation of private methods.

Parameters
[out]fs: file to be completed
classConfig: PClassConfig to be used
mode: mode of the generator

Reimplemented from PAbstractTraitBackend.

Definition at line 62 of file CppTraitTypeStream.cpp.

62 {
63 if(!mode.enableTypeStream){return;}
64
65}

References GeneratorMode::enableTypeStream.

◆ protectedMethodDeclaration()

void CppTraitTypeStream::protectedMethodDeclaration ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
virtual

Declaration of protected methods.

Parameters
[out]fs: file to be completed
classConfig: PClassConfig to be used
mode: mode of the generator

Reimplemented from PAbstractTraitBackend.

Definition at line 32 of file CppTraitTypeStream.cpp.

32 {
33 if(!mode.enableTypeStream){return;}
34
35}

References GeneratorMode::enableTypeStream.

◆ protectedMethodImplementation()

void CppTraitTypeStream::protectedMethodImplementation ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
virtual

Implementation of protected methods.

Parameters
[out]fs: file to be completed
classConfig: PClassConfig to be used
mode: mode of the generator

Reimplemented from PAbstractTraitBackend.

Definition at line 42 of file CppTraitTypeStream.cpp.

42 {
43 if(!mode.enableTypeStream){return;}
44
45}

References GeneratorMode::enableTypeStream.

◆ publicMethodDeclaration()

virtual void PAbstractTraitBackend::publicMethodDeclaration ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
inlinevirtualinherited

◆ publicMethodImplementation()

virtual void PAbstractTraitBackend::publicMethodImplementation ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
inlinevirtualinherited

◆ testCallFunction()

void CppTraitTypeStream::testCallFunction ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
virtual

Call of the test function.

Parameters
[out]fs: file to be completed
classConfig: PClassConfig to be used
mode: mode of the generator

Reimplemented from PAbstractTraitBackend.

Definition at line 157 of file CppTraitTypeStream.cpp.

157 {
158 if(!mode.enableTypeStream){return;}
159 PString name(classConfig.getName());
160 fs << "\tcheck"+name+"TypeStream();\n";
161}

References GeneratorMode::enableTypeStream, and PClassConfig::getName().

+ Here is the call graph for this function:

◆ testFunction()

void CppTraitTypeStream::testFunction ( std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode ) const
virtual

Implementation of test function.

Parameters
[out]fs: file to be completed
classConfig: PClassConfig to be used
mode: mode of the generator

Reimplemented from PAbstractTraitBackend.

Definition at line 140 of file CppTraitTypeStream.cpp.

140 {
141 if(!mode.enableTypeStream){return;}
142 PString name(classConfig.getName());
143 fs << "///Check TypeStream of class "+name+"\n";
144 fs << "void check"+name+"TypeStream(){\n";
145 if(classConfig.getIsEnum()){
146 name = name + "::" + name;
147 }
148 fs << "\t"<<mode.assertCall<<"(phoenix_getTypeToStr<"<<name<<">() == \""<<name<<"\");\n";
149 fs << "}\n\n";
150}
PString assertCall
Assert to be used.

References GeneratorMode::assertCall, GeneratorMode::enableTypeStream, PClassConfig::getIsEnum(), and PClassConfig::getName().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: