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

Function cppArgToRArg

src/attributes.cpp:2736–2770  ·  view source on GitHub ↗

convert a C++ argument value to an R argument value (returns empty string if no conversion is possible)

Source from the content-addressed store, hash-verified

2734 // convert a C++ argument value to an R argument value (returns empty
2735 // string if no conversion is possible)
2736 std::string cppArgToRArg(const std::string& type,
2737 const std::string& cppArg) {
2738
2739 // try for quoted string
2740 if (isQuoted(cppArg))
2741 return cppArg;
2742
2743 // try for literal
2744 std::string rArg = cppLiteralArgToRArg(cppArg);
2745 if (!rArg.empty())
2746 return rArg;
2747
2748 // try for a create arg
2749 rArg = cppCreateArgToRArg(cppArg); // #nocov start
2750 if (!rArg.empty())
2751 return rArg;
2752
2753 // try for a matrix arg
2754 rArg = cppMatrixArgToRArg(cppArg);
2755 if (!rArg.empty())
2756 return rArg;
2757
2758 // try for a numeric arg
2759 rArg = cppNumericArgToRArg(type, cppArg);
2760 if (!rArg.empty())
2761 return rArg;
2762
2763 // try for a constructor arg
2764 rArg = cppConstructorArgToRArg(cppArg);
2765 if (!rArg.empty())
2766 return rArg;
2767
2768 // couldn't parse the arg
2769 return std::string(); // #nocov end
2770 }
2771
2772 } // anonymous namespace
2773

Callers 1

generateRArgListFunction · 0.85

Calls 7

isQuotedFunction · 0.85
cppLiteralArgToRArgFunction · 0.85
cppCreateArgToRArgFunction · 0.85
cppMatrixArgToRArgFunction · 0.85
cppNumericArgToRArgFunction · 0.85
cppConstructorArgToRArgFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected