PhoenixGenerator  2.6.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 PString fullName(classConfig.getFullName());
76
77 if(classConfig.getIsEnum()){
78 name = name + "::" + name;
79 }
80
81 const PVecString & listTemplate = classConfig.getListTemplate();
82 if(listTemplate.size() != 0lu){
83 fs << "///Get the name of the class " << name << std::endl;
84 fs << "/**\t@return name of the class " << name << std::endl;
85 fs << "*/" << std::endl;
86 fs << mode.templateDeclaration;
87 fs << "std::string phoenix_getTypeName<"<<fullName << mode.defTemplate <<" >(){" << std::endl;
88 fs << "\treturn \""<<name<<"\"";
89 fs << " + \"<\"";
90 for(PVecString::const_iterator it(listTemplate.begin()); it != listTemplate.end(); ++it){
91 fs << " + phoenix_getTypeToStr<"<<it->split(' ').back()<<">()";
92 }
93 fs << " + \">\"";
94 fs << ";" << std::endl;
95 fs << "}" << std::endl << std::endl;
96
97 }else{
98 fs << "template<>" << std::endl;
99 fs << "std::string phoenix_getTypeName<"<<fullName<<">();" << std::endl << std::endl;
100 }
101}
PString getFullName() const
Returns the full name of the class including the namespace.
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::getFullName(), 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 108 of file CppTraitTypeStream.cpp.

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

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 158 of file CppTraitTypeStream.cpp.

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

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 141 of file CppTraitTypeStream.cpp.

141 {
142 if(!mode.enableTypeStream){return;}
143 PString name(classConfig.getName());
144 fs << "///Check TypeStream of class "+name+"\n";
145 fs << "void check"+name+"TypeStream(){\n";
146 if(classConfig.getIsEnum()){
147 name = name + "::" + name;
148 }
149 fs << "\t"<<mode.assertCall<<"(phoenix_getTypeToStr<"<<name<<">() == \""<<name<<"\");\n";
150 fs << "}\n\n";
151}
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: