25 fs <<
"#include \"phoenix_config_stream.h\"" << std::endl;
91 PString name(classConfig.
getName());
93 name = name +
"::" + name;
95 fs <<
"template<>" << std::endl;
96 fs <<
"bool phoenix_config_stream<"<<name<<
">(ConfigNodeIter & iter, "<<name<<
" & data, const GenericConfigCheck * checker);" << std::endl << std::endl;
107 PString name(classConfig.
getName());
109 fs <<
"///Load and save the given " << name <<
" depending on the ConfigNodeIter mode (interface with PhoenixConfigStream)" << std::endl;
110 fs <<
"/**\t@param[out] iter : ConfigNodeIter to be used to load and save the configuration" << std::endl;
111 fs <<
" * \t@param[out] data : " << name <<
" to load or save" << std::endl;
112 fs <<
" * \t@param checker : check caracteristics of the given " << name <<
" (eg: boundaries or size)" << std::endl;
113 fs <<
" * \t@return true on success, false otherwise" << std::endl;
114 fs <<
"*/" << std::endl;
116 if(listTemplate.size() == 0LU){
117 fs <<
"template<>" << std::endl;
122 name = name +
"::" + name;
125 fs <<
"bool phoenix_config_stream<"<<name << mode.
defTemplate<<
">(ConfigNodeIter & iter, "<<name << mode.
defTemplate<<
" & data, const GenericConfigCheck * checker){" << std::endl;
126 fs <<
"\tbool b(true);" << std::endl;
128 fs <<
"\tPString value = iter->getString();" << std::endl;
129 fs <<
"\tif(!fromString(data, value)){" << std::endl;
130 fs <<
"\t\t*iter.getOut() << \"phoenix_config_stream<"<<name << mode.
defTemplate<<
"> : cannot load enum '"<<name<<
"' with value '\"<<value<<\"'\" << std::endl;" << std::endl;
131 fs <<
"\t\tb = false;" << std::endl;
132 fs <<
"\t}" << std::endl;
135 for(PVecClassAttribute::const_iterator it(vecAttr.begin()); it != vecAttr.end(); ++it){
137 PString attrName(it->getName().firstToUpper()), attrKey(it->getName().toSnakeCase());
140 PString pointeeType(it->getType().eraseFirstLastChar(
" \n\t*")), localVar(it->getName().toSnakeCase());
141 fs <<
"\t" << pointeeType <<
" * " << localVar <<
"(data.get" << attrName <<
"());" << std::endl;
142 fs <<
"\tb &= phoenix_config_stream(iter, " << localVar <<
", \"" << attrKey <<
"\", checker);" << std::endl;
143 fs <<
"\tdata.set" << attrName <<
"(" << localVar <<
");" << std::endl;
145 fs <<
"\tb &= phoenix_config_stream<"<<it->getType()<<
">(iter, data.get"<<attrName<<
"(), \""<<attrKey<<
"\", checker);" << std::endl;
149 fs <<
"\treturn b;" << std::endl;
150 fs <<
"}" << std::endl << std::endl;
std::vector< PClassAttribute > PVecClassAttribute
virtual ~CppTraitConfigStream()
Desctructor of CppTraitConfigStream.
virtual void protectedMethodDeclaration(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Declaration of protected methods.
virtual void publicMethodDeclaration(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Declaration of public methods.
virtual void protectedMethodImplementation(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Implementation of protected methods.
CppTraitConfigStream()
Consctructor of CppTraitConfigStream.
virtual void headerExtraInclude(std::ofstream &fs, const GeneratorMode &mode) const
Add extra include on the header.
virtual void classExtraFunctionImplementation(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Implementation of extra functions.
virtual void publicMethodImplementation(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Implementation of public methods.
virtual void privateMethodImplementation(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Implementation of private methods.
virtual void privateMethodDeclaration(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Declaration of private methods.
virtual void classExtraFunctionDeclaration(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Declaration of extra functions.
Class to describe a basic class.
const std::vector< PClassAttribute > & getListAttribute() const
Returns the list of attributes of the class.
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 enableConfigStream
True to enable config stream interface generator.
bool getIsPointerType(const PString &varType)
Say if a given type is a pointer type (i.e. it ends with a '*').