MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / generateRArgList

Function generateRArgList

src/attributes.cpp:2775–2798  ·  view source on GitHub ↗

Generate an R argument list for a function

Source from the content-addressed store, hash-verified

2773
2774 // Generate an R argument list for a function
2775 std::string generateRArgList(const Function& function) {
2776 std::ostringstream argsOstr;
2777 const std::vector<Argument>& arguments = function.arguments();
2778 for (size_t i = 0; i<arguments.size(); i++) {
2779 const Argument& argument = arguments[i];
2780 argsOstr << argument.name();
2781 if (!argument.defaultValue().empty()) {
2782 std::string rArg = cppArgToRArg(argument.type().name(),
2783 argument.defaultValue());
2784 if (!rArg.empty()) {
2785 argsOstr << " = " << rArg;
2786 } else {
2787 showWarning("Unable to parse C++ default value '" + // #nocov start
2788 argument.defaultValue() + "' for argument "+
2789 argument.name() + " of function " +
2790 function.name()); // #nocov end
2791 }
2792 }
2793
2794 if (i != (arguments.size()-1))
2795 argsOstr << ", ";
2796 }
2797 return argsOstr.str();
2798 }
2799
2800 bool checkRSignature(const Function& function,
2801 std::string args) {

Callers 2

doWriteFunctionsMethod · 0.85
generateRMethod · 0.85

Calls 4

cppArgToRArgFunction · 0.85
showWarningFunction · 0.85
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected