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

Function Symbol_Impl

inst/include/Rcpp/Symbol.h:39–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37 * is silently used
38 */
39 Symbol_Impl(SEXP x){
40 int type = TYPEOF(x) ;
41 switch( type ){
42 case SYMSXP:
43 Storage::set__( x ) ;
44 break; /* nothing to do */
45 case CHARSXP: {
46 SEXP charSym = Rf_installChar(x); // R 3.2.0 or later have Rf_installChar
47 Storage::set__( charSym ) ;
48 break ;
49 }
50 case STRSXP: {
51 /* FIXME: check that there is at least one element */
52 SEXP charSym = Rf_installChar(STRING_ELT(x, 0 )); // R 3.2.0 or later have Rf_installChar
53 Storage::set__( charSym );
54 break ;
55 }
56 default:
57 const char* fmt = "Cannot convert object to a symbol: "
58 "[type=%s; target=SYMSXP].";
59 throw not_compatible(fmt, Rf_type2char(TYPEOF(x)));
60 }
61 }
62
63 Symbol_Impl(const std::string& symbol){
64 Storage::set__( Rf_install(symbol.c_str()) );

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected