in src/RRefs.cpp [346:384]
void getR6ClassInfo(const ShieldSEXP &classDef, R6ClassInfo *response) {
if (!isObjectFromR6(classDef)) return;
auto className = getR6ClassName(classDef);
response->set_classname(stringEltUTF8(className, 0));
auto classInheritanceNames = getR6ClassInheritanceTree(classDef);
for (int i = 1; i < classInheritanceNames.length(); ++i) {
response->add_superclasses(stringEltUTF8(classInheritanceNames, i));
}
auto classVariable = getR6ClassVariable(classDef);
// add fields
auto fields = getR6ClassDefFields(classVariable);
for (int i = 0; i < fields.length(); ++i) {
auto next_member = response->add_fields();
next_member->set_name(stringEltUTF8(fields, i));
next_member->set_ispublic(true);
}
// add methods
auto methods = getR6ClassDefMethods(classVariable);
ShieldSEXP names = Rf_getAttrib(methods, R_NamesSymbol);
for (int i = 0; i < methods.length(); ++i) {
auto next_member = response->add_methods();
next_member->set_name(stringEltUTF8(names, i));
grpc::string description = stringEltUTF8(methods, i);
next_member->set_parameterlist(description.substr(strlen("function "), description.size() - 2));
next_member->set_ispublic(true);
}
// add active-bindings
auto actives = getR6ClassDefActive(classVariable);
for (int i = 0; i < actives.length(); ++i) {
auto next_member = response->add_activebindings();
next_member->set_name(stringEltUTF8(actives, i));
}
}