def _find_datamembers(self): num_datamembers = capi.c_num_datamembers(self) for i in range(num_datamembers): if not capi.c_is_publicdata(self, i): continue datamember_name = capi.c_datamember_name(self, i) if not datamember_name in self.datamembers: self._make_datamember(datamember_name, i)
def _find_datamembers(self): num_datamembers = capi.c_num_datamembers(self) for i in range(num_datamembers): if not capi.c_is_publicdata(self, i): continue datamember_name = capi.c_datamember_name(self, i) type_name = capi.c_datamember_type(self, i) offset = capi.c_datamember_offset(self, i) is_static = bool(capi.c_is_staticdata(self, i)) datamember = W_CPPDataMember(self.space, self, type_name, offset, is_static) self.datamembers[datamember_name] = datamember
def ns__dir__(self): # Collect a list of everything (currently) available in the namespace. # The backend can filter by returning empty strings. Special care is # taken for functions, which need not be unique (overloading). alldir = [] for i in range(capi.c_num_scopes(self.space, self)): sname = capi.c_scope_name(self.space, self, i) if sname: alldir.append(self.space.wrap(sname)) allmeth = {} for i in range(capi.c_num_methods(self.space, self)): idx = capi.c_method_index_at(self.space, self, i) mname = capi.c_method_name(self.space, self, idx) if mname: allmeth.setdefault(mname, 0) for m in allmeth.keys(): alldir.append(self.space.wrap(m)) for i in range(capi.c_num_datamembers(self.space, self)): dname = capi.c_datamember_name(self.space, self, i) if dname: alldir.append(self.space.wrap(dname)) return self.space.newlist(alldir)