/usr/lib/R/site-library/dplyr/include/tools/SymbolString.h is in r-cran-dplyr 0.7.4-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #ifndef dplyr_tools_SymbolString_h
#define dplyr_tools_SymbolString_h
#include <tools/encoding.h>
namespace dplyr {
class SymbolString {
public:
SymbolString() {}
SymbolString(const char* str) : s(str) {}
SymbolString(const String& other) : s(other) {}
SymbolString(const String::StringProxy& other) : s(other) {}
SymbolString(const String::const_StringProxy& other) : s(other) {}
// Symbols are always encoded in the native encoding (#1950)
explicit SymbolString(const Symbol& symbol) : s(CHAR(PRINTNAME(symbol)), CE_NATIVE) {}
public:
const String& get_string() const {
return s;
}
const Symbol get_symbol() const {
return Symbol(Rf_translateChar(s.get_sexp()));
}
const std::string get_utf8_cstring() const {
static Environment rlang = Environment::namespace_env("rlang");
static Function as_string = Function("as_string", rlang);
SEXP utf8_string = as_string(Rf_lang2(R_QuoteSymbol, get_symbol()));
return CHAR(STRING_ELT(utf8_string, 0));
}
bool is_empty() const {
return s == "";
}
SEXP get_sexp() const {
return s.get_sexp();
}
bool operator==(const SymbolString& other) const {
return Rf_NonNullStringMatch(get_sexp(), other.get_sexp());
}
private:
String s;
};
}
#endif
|