#include <bash/Config.h>
+#define MAX_NUMBER_OF_INPUTS 9
+
// -------------------------------------------------------------------------
int main( int argc, char* argv[] )
{
// Expand data
std::stringstream data;
data
- << "#ifndef __cpPlugins__Demangler__" << object_name << "__h__" << std::endl
- << "#define __cpPlugins__Demangler__" << object_name << "__h__" << std::endl
+ << "#ifndef __cpPlugins__Demanglers__" << object_name << "__h__" << std::endl
+ << "#define __cpPlugins__Demanglers__" << object_name << "__h__" << std::endl
<< std::endl;
for( auto cIt = commands.begin( ); cIt != commands.end( ); ++cIt )
cpPlugins_bash::Expand( instances, definitions, commands, cIt->first );
TStrings toks;
cpPlugins_bash::Tokenize( toks, cIt->first, "|" );
- if( toks.size( ) > 1 )
- {
- data
- << "#define cpPlugins_Demangle_" << object_name << "_"
- << toks[ 0 ] << "( o, f, ";
- for( unsigned int i = 1; i < toks.size( ); ++i )
- data << toks[ i ] << ", ";
- data << "a ) \\";
- }
- else
- data
- << "#define cpPlugins_Demangle_" << object_name << "_"
- << toks[ 0 ] << "( o, f, a ) \\";
- data << std::endl;
- std::string prefix = "";
- for( auto iIt = instances.begin( ); iIt != instances.end( ); ++iIt )
+ for( unsigned int nIns = 1; nIns <= MAX_NUMBER_OF_INPUTS; ++nIns )
{
- data
- << " " << prefix
- << "if( dynamic_cast< " << *iIt << "* >( o ) != NULL ) \\"
- << std::endl
- << " this->f( a dynamic_cast< " << *iIt << "* >( o ) ); \\"
- << std::endl;
- prefix = "else ";
+ if( toks.size( ) > 1 )
+ {
+ data
+ << "#define cpPlugins_Demangle_" << object_name << "_"
+ << toks[ 0 ] << "_" << nIns << "( o, f";
+ for( unsigned int i = 1; i < toks.size( ); ++i )
+ data << ", " << toks[ i ];
+ }
+ else
+ data
+ << "#define cpPlugins_Demangle_" << object_name << "_"
+ << toks[ 0 ] << "_" << nIns << "( o, f";
+
+ for( unsigned int i = 1; i < nIns; ++i )
+ data << ", X" << i;
+ data << " ) \\";
+
+ data << std::endl;
+ std::string prefix = "";
+ for( auto iIt = instances.begin( ); iIt != instances.end( ); ++iIt )
+ {
+ data
+ << " " << prefix
+ << "if( dynamic_cast< " << *iIt << "* >( o ) != NULL ) \\"
+ << std::endl
+ << " this->f( dynamic_cast< " << *iIt << "* >( o )";
+
+ for( unsigned int i = 1; i < nIns; ++i )
+ data << ", X" << i;
+ data
+ << " ); \\"
+ << std::endl;
+ prefix = "else ";
+
+ } // rof
+ data << " " << prefix << std::endl << std::endl;
} // rof
- data << " " << prefix << std::endl << std::endl;
} // rof
data
- << "#endif // __cpPlugins__Demangler__" << object_name << "__h__"
+ << "#endif // __cpPlugins__Demanglers__" << object_name << "__h__"
<< std::endl;
if( !( cpPlugins_bash::Write( data.str( ), output_filename ) ) )
{
} // fi
-
-
- /* TODO
- TStrings instances;
- cpPlugins_bash::Expand( instances, definitions, commands, "instances" );
-
- // Build all instances
- for( auto iIt = instances.begin( ); iIt != instances.end( ); ++iIt )
- {
- std::cout << *iIt << std::endl;
-
- } // rof
- */
-
return( 0 );
}