Skip to content

Commit

Permalink
Make GetDataMember use an out param
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronj0 committed Sep 19, 2024
1 parent 7541520 commit 7147fe1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Cppyy.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ namespace Cppyy {

// data member reflection information ----------------------------------------
CPPYY_IMPORT
std::vector<TCppScope_t> GetDatamembers(TCppScope_t scope);
void GetDatamembers(TCppScope_t scope, std::vector<TCppScope_t>& datamembers);
CPPYY_IMPORT
std::string GetDatamemberName(TCppScope_t scope, TCppIndex_t idata);
CPPYY_IMPORT
Expand Down
3 changes: 2 additions & 1 deletion src/Dispatcher.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ bool CPyCppyy::InsertDispatcher(CPPScope* klass, PyObject* bases, PyObject* dct,
// pull in data members that are protected
bool setPublic = false;
for (const auto& binfo : base_infos) {
std::vector<Cppyy::TCppScope_t> datamems = Cppyy::GetDatamembers(binfo.btype);
std::vector<Cppyy::TCppScope_t> datamems;
Cppyy::GetDatamembers(binfo.btype, datamems);
for (auto data : datamems) {
if (Cppyy::IsProtectedData(data)) {
const std::string dm_name = Cppyy::GetFinalName(data);
Expand Down
3 changes: 2 additions & 1 deletion src/ProxyWrappers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@ static int BuildScopeProxyDict(Cppyy::TCppScope_t scope, PyObject* pyclass, cons
Py_DECREF(dct);

// collect data members (including enums)
std::vector<Cppyy::TCppScope_t> datamembers = Cppyy::GetDatamembers(scope);
std::vector<Cppyy::TCppScope_t> datamembers;
Cppyy::GetDatamembers(scope, datamembers);
for (auto &datamember : datamembers) {
// allow only public members
if (!Cppyy::IsPublicData(datamember))
Expand Down
3 changes: 2 additions & 1 deletion src/Pythonize.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1688,7 +1688,8 @@ bool CPyCppyy::Pythonize(PyObject* pyclass, Cppyy::TCppScope_t scope)
if (Cppyy::IsAggregate(((CPPClass*)pyclass)->fCppType) && name.compare(0, 5, "std::", 5) != 0) {
// create a pseudo-constructor to allow initializer-style object creation
Cppyy::TCppType_t kls = ((CPPClass*)pyclass)->fCppType;
std::vector<Cppyy::TCppScope_t> datamems = Cppyy::GetDatamembers(kls);
std::vector<Cppyy::TCppScope_t> datamems;
Cppyy::GetDatamembers(kls, datamems);
if (!datamems.empty()) {
std::string rname = name;
TypeManip::cppscope_to_legalname(rname);
Expand Down

0 comments on commit 7147fe1

Please sign in to comment.