Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Cppyy::GetMethodSignature to return list of argument type #111

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions clingwrapper/src/clingwrapper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1412,26 +1412,22 @@ std::string Cppyy::GetMethodArgDefault(TCppMethod_t method, TCppIndex_t iarg)

std::string Cppyy::GetMethodSignature(TCppMethod_t method, bool show_formal_args, TCppIndex_t max_args)
{
if (Cppyy::IsTemplatedMethod(method)) {
std::ostringstream sig;
sig << "(";
int nArgs = GetMethodNumArgs(method);
if (max_args != (TCppIndex_t)-1) nArgs = std::min(nArgs, (int)max_args);
for (int iarg = 0; iarg < nArgs; ++iarg) {
sig << Cppyy::GetMethodArgTypeAsString(method, iarg);
if (show_formal_args) {
const char* argname = Cppyy::GetMethodArgName(method, iarg).c_str();
if (argname && argname[0] != '\0') sig << " " << argname;
const char* defvalue = Cppyy::GetMethodArgDefault(method, iarg).c_str();
if (defvalue && defvalue[0] != '\0') sig << " = " << defvalue;
}
if (iarg != nArgs-1) sig << (show_formal_args ? ", " : ",");
std::ostringstream sig;
sig << "(";
int nArgs = GetMethodNumArgs(method);
if (max_args != (TCppIndex_t)-1) nArgs = std::min(nArgs, (int)max_args);
for (int iarg = 0; iarg < nArgs; ++iarg) {
sig << Cppyy::GetMethodArgTypeAsString(method, iarg);
if (show_formal_args && Cppyy::IsTemplatedMethod(method)) {
std::string argname = Cppyy::GetMethodArgName(method, iarg);
if (!argname.empty()) sig << " " << argname;
std::string defvalue = Cppyy::GetMethodArgDefault(method, iarg);
if (!defvalue.empty()) sig << " = " << defvalue;
}
sig << ")";
return sig.str();
if (iarg != nArgs-1) sig << (show_formal_args ? ", " : ",");
}

else return Cpp::GetFunctionSignature(method);
sig << ")";
return sig.str();
}

std::string Cppyy::GetMethodPrototype(TCppMethod_t method, bool show_formal_args)
Expand Down
Loading