convert a C++ literal to an R argument (returns empty string if no conversion possible)
| 2686 | // convert a C++ literal to an R argument (returns empty string |
| 2687 | // if no conversion possible) |
| 2688 | std::string cppLiteralArgToRArg(const std::string& cppArg) { |
| 2689 | if (cppArg == "true") |
| 2690 | return "TRUE"; |
| 2691 | else if (cppArg == "false") |
| 2692 | return "FALSE"; |
| 2693 | else if (cppArg == "R_NilValue") |
| 2694 | return "NULL"; |
| 2695 | else if (cppArg == "NA_STRING") // #nocov start |
| 2696 | return "NA_character_"; |
| 2697 | else if (cppArg == "NA_INTEGER") |
| 2698 | return "NA_integer_"; |
| 2699 | else if (cppArg == "NA_LOGICAL") |
| 2700 | return "NA_integer_"; |
| 2701 | else if (cppArg == "NA_REAL") |
| 2702 | return "NA_real_"; |
| 2703 | else |
| 2704 | return std::string(); |
| 2705 | } |
| 2706 | |
| 2707 | // convert an Rcpp container constructor to an R argument |
| 2708 | // (returns empty string if no conversion possible) |