How could one determine the number and type of the class constructor's parameters? To do that for a member function is just a piece of cake:
template <class T, typename P0, typename P1, typename P2, typename P3>
void BindNativeMethod( void (T::*MethodPtr)(P0, P1, P2, P3) )
{
// we've got 4 params
// use them this way:
std::vector<int> Params;
Params.push_back( TypeToInt<P0>() );
Params.push_back( TypeToInt<P1>() );
Params.push_back( TypeToInt<P2>() );
Params.push_back( TypeToInt<P3>() );
}
template <class T, typename P0, typename P1, typename P2, typename P3, typename P4>
void BindNativeMethod( void (T::*MethodPtr)(P0, P1, P2, P3, P4) )
{
// we've got 5 params
// use them this way:
std::vector<int> Params;
Params.push_back( TypeToInt<P0>() );
Params.push_back( TypeToInt<P1>() );
Params.push_back( TypeToInt<P2>() );
Params.push_back( TypeToInt<P3>() );
Params.push_back( TypeToInt<P4>() );
}
and so on for other members.
But what to do with the class constructors? Is there any way to find out the type of their arguments? Maybe there's a fundamentally different approach to solve this because it's even impossible to take the address of the constructor?
Edit: I have a C++ preprocessor that scans all source files and has the database of all classes, methods, ctors and their exact prototypes. I need to generate some stubs based on this.