Skip to content

Commit bfea6ba

Browse files
implement Cppyy::GetAllCppNames (#115)
* implement `Cppyy::GetAllCppNames` * fix OSX-X86 dependency
1 parent c49f469 commit bfea6ba

File tree

3 files changed

+14
-91
lines changed

3 files changed

+14
-91
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,10 @@ jobs:
279279
run: |
280280
brew update
281281
brew remove [email protected]
282-
brew remove unxip
282+
export ARCHITECHURE=$(uname -m)
283+
if [[ "$ARCHITECHURE" != "x86_64" ]]; then
284+
brew remove unxip
285+
fi
283286
# workaround for https://github.com/actions/setup-python/issues/577
284287
for pkg in $(brew list | grep '^python@'); do
285288
brew unlink "$pkg"

clingwrapper/src/clingwrapper.cxx

Lines changed: 9 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,95 +1068,15 @@ bool Cppyy::IsVariable(TCppScope_t scope)
10681068
// cppnames.insert(outer_with_template(name + ns_scope.size()));
10691069
// }
10701070
// }
1071-
//
1072-
// void Cppyy::GetAllCppNames(TCppScope_t scope, std::set<std::string>& cppnames)
1073-
// {
1074-
// // Collect all known names of C++ entities under scope. This is useful for IDEs
1075-
// // employing tab-completion, for example. Note that functions names need not be
1076-
// // unique as they can be overloaded.
1077-
// TClassRef& cr = type_from_handle(scope);
1078-
// if (scope != GLOBAL_HANDLE && !(cr.GetClass() && cr->Property()))
1079-
// return;
1080-
//
1081-
// std::string ns_scope = GetFinalName(scope);
1082-
// if (scope != GLOBAL_HANDLE) ns_scope += "::";
1083-
//
1084-
// // add existing values from read rootmap files if within this scope
1085-
// TCollection* coll = gInterpreter->GetMapfile()->GetTable();
1086-
// {
1087-
// TIter itr{coll};
1088-
// TEnvRec* ev = nullptr;
1089-
// while ((ev = (TEnvRec*)itr.Next())) {
1090-
// // TEnv contains rootmap entries and user-side rootmap files may be already
1091-
// // loaded on startup. Thus, filter on file name rather than load time.
1092-
// if (gRootSOs.find(ev->GetValue()) == gRootSOs.end())
1093-
// cond_add(scope, ns_scope, cppnames, ev->GetName(), true);
1094-
// }
1095-
// }
1096-
//
1097-
// // do we care about the class table or are the rootmap and list of types enough?
1098-
// [>
1099-
// gClassTable->Init();
1100-
// const int N = gClassTable->Classes();
1101-
// for (int i = 0; i < N; ++i)
1102-
// cond_add(scope, ns_scope, cppnames, gClassTable->Next());
1103-
// */
1104-
//
1105-
// // any other types (e.g. that may have come from parsing headers)
1106-
// coll = gROOT->GetListOfTypes();
1107-
// {
1108-
// TIter itr{coll};
1109-
// TDataType* dt = nullptr;
1110-
// while ((dt = (TDataType*)itr.Next())) {
1111-
// if (!(dt->Property() & kIsFundamental)) {
1112-
// cond_add(scope, ns_scope, cppnames, dt->GetName());
1113-
// }
1114-
// }
1115-
// }
1116-
//
1117-
// // add functions
1118-
// coll = (scope == GLOBAL_HANDLE) ?
1119-
// gROOT->GetListOfGlobalFunctions() : cr->GetListOfMethods();
1120-
// {
1121-
// TIter itr{coll};
1122-
// TFunction* obj = nullptr;
1123-
// while ((obj = (TFunction*)itr.Next())) {
1124-
// const char* nm = obj->GetName();
1125-
// // skip templated functions, adding only the un-instantiated ones
1126-
// if (nm && nm[0] != '_' && strstr(nm, "<") == 0 && strncmp(nm, "operator", 8) != 0) {
1127-
// if (gInitialNames.find(nm) == gInitialNames.end())
1128-
// cppnames.insert(nm);
1129-
// }
1130-
// }
1131-
// }
1132-
//
1133-
// // add uninstantiated templates
1134-
// coll = (scope == GLOBAL_HANDLE) ?
1135-
// gROOT->GetListOfFunctionTemplates() : cr->GetListOfFunctionTemplates();
1136-
// FILL_COLL(TFunctionTemplate, kIsPrivate | kIsProtected)
1137-
//
1138-
// // add (global) data members
1139-
// if (scope == GLOBAL_HANDLE) {
1140-
// coll = gROOT->GetListOfGlobals();
1141-
// FILL_COLL(TGlobal, kIsPrivate | kIsProtected)
1142-
// } else {
1143-
// coll = cr->GetListOfDataMembers();
1144-
// FILL_COLL(TDataMember, kIsPrivate | kIsProtected)
1145-
// }
1146-
//
1147-
// // add enums values only for user classes/namespaces
1148-
// if (scope != GLOBAL_HANDLE && scope != STD_HANDLE) {
1149-
// coll = cr->GetListOfEnums();
1150-
// FILL_COLL(TEnum, kIsPrivate | kIsProtected)
1151-
// }
1152-
//
1153-
// #ifdef __APPLE__
1154-
// // special case for Apple, add version namespace '__1' entries to std
1155-
// if (scope == STD_HANDLE)
1156-
// GetAllCppNames(GetScope("std::__1"), cppnames);
1157-
// #endif
1158-
// }
1159-
//
1071+
1072+
void Cppyy::GetAllCppNames(TCppScope_t scope, std::set<std::string>& cppnames)
1073+
{
1074+
// Collect all known names of C++ entities under scope. This is useful for IDEs
1075+
// employing tab-completion, for example. Note that functions names need not be
1076+
// unique as they can be overloaded.
1077+
Cpp::GetAllCppNames(scope, cppnames);
1078+
}
1079+
11601080
//
11611081
// // class reflection information ----------------------------------------------
11621082
std::vector<Cppyy::TCppScope_t> Cppyy::GetUsingNamespaces(TCppScope_t scope)

clingwrapper/src/cpp_cppyy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ namespace Cppyy {
214214
bool IsVariable(TCppScope_t scope);
215215

216216
RPY_EXPORTED
217-
void GetAllCppNames(TCppScope_t scope, std::set<std::string>& cppnames) { return; }
217+
void GetAllCppNames(TCppScope_t scope, std::set<std::string>& cppnames);
218218

219219
// // namespace reflection information ------------------------------------------
220220
RPY_EXPORTED

0 commit comments

Comments
 (0)