Ejemplo n.º 1
0
 def _make_cppfunction(self, method_index):
     num_args = capi.c_method_num_args(self, method_index)
     args_required = capi.c_method_req_args(self, method_index)
     arg_defs = []
     for i in range(num_args):
         arg_type = capi.c_method_arg_type(self, method_index, i)
         arg_dflt = capi.c_method_arg_default(self, method_index, i)
         arg_defs.append((arg_type, arg_dflt))
     return CPPFunction(self.space, self, method_index, arg_defs, args_required)
Ejemplo n.º 2
0
 def _make_cppfunction(self, method_index):
     num_args = capi.c_method_num_args(self, method_index)
     args_required = capi.c_method_req_args(self, method_index)
     arg_defs = []
     for i in range(num_args):
         arg_type = capi.c_method_arg_type(self, method_index, i)
         arg_dflt = capi.c_method_arg_default(self, method_index, i)
         arg_defs.append((arg_type, arg_dflt))
     if capi.c_is_constructor(self, method_index):
         cls = CPPConstructor
     elif capi.c_is_staticmethod(self, method_index):
         cls = CPPFunction
     else:
         cls = CPPMethod
     return cls(self.space, self, method_index, arg_defs, args_required)
Ejemplo n.º 3
0
 def _make_cppfunction(self, pyname, index):
     num_args = capi.c_method_num_args(self.space, self, index)
     args_required = capi.c_method_req_args(self.space, self, index)
     arg_defs = []
     for i in range(num_args):
         arg_type = capi.c_method_arg_type(self.space, self, index, i)
         arg_dflt = capi.c_method_arg_default(self.space, self, index, i)
         arg_defs.append((arg_type, arg_dflt))
     if capi.c_is_constructor(self.space, self, index):
         cppfunction = CPPConstructor(self.space, self, index, arg_defs, args_required)
         if args_required == 0:
             self.default_constructor = cppfunction
     elif capi.c_method_is_template(self.space, self, index):
         templ_args = capi.c_template_args(self.space, self, index)
         cppfunction = CPPTemplatedCall(self.space, templ_args, self, index, arg_defs, args_required)
     elif capi.c_is_staticmethod(self.space, self, index):
         cppfunction = CPPFunction(self.space, self, index, arg_defs, args_required)
     elif pyname == "__setitem__":
         cppfunction = CPPSetItem(self.space, self, index, arg_defs, args_required)
     else:
         cppfunction = CPPMethod(self.space, self, index, arg_defs, args_required)
     return cppfunction