def function_by_signature(self, name, returns, parameters): method = DocsMethod(0) method.name = name method.parameters = parameters method.syntax = name + "(" for p in self.get_parameter_names(parameters): method.syntax = method.syntax + p + ", " method.syntax = method.syntax.rstrip(', ') method.syntax = method.syntax + ")" method.returns = returns method.new = True for function in self.function_list: if function.name == name: dst_parameters_types = self.get_parameter_types(function.parameters.replace('const ','')) src_parameters_types = self.get_parameter_types(parameters.replace('const ','')) if(len(src_parameters_types)==len(dst_parameters_types)): a = -1 for i in range(len(src_parameters_types)): if src_parameters_types[i] != dst_parameters_types[i]: break else: a = i if a == len(src_parameters_types)-1: function.new = False function.parameters = parameters return function self.function_list.append(method) return method
def function_by_signature(self, name, returns, parameters): method = DocsMethod(0) method.name = name method.parameters = parameters method.syntax = name + "(" for p in self.get_parameter_names(parameters): method.syntax = method.syntax + p + ", " method.syntax = method.syntax.rstrip(', ') method.syntax = method.syntax + ")" method.returns = returns method.new = True found = False for function in self.function_list: if function.name == name: dst_parameters_types = self.get_parameter_types(function.parameters) src_parameters_types = self.get_parameter_types(parameters) if(len(src_parameters_types)==len(dst_parameters_types)): a = -1 for i in range(len(src_parameters_types)): if src_parameters_types[i] != dst_parameters_types[i]: break else: a = i if a == len(src_parameters_types)-1: function.new = False return function found = True #print 'found ' + function.name break if not found: #print 'not found ' + method.name #clazzmethod = method self.function_list.append(method) return method
def function_by_signature(self, name, returns, parameters, alternatives, already_found, fuzzy): method = DocsMethod(0) method.name = name method.parameters = parameters method.syntax = name + "(" for p in self.get_parameter_names(parameters): method.syntax = method.syntax + p + ", " method.syntax = method.syntax.rstrip(', ') method.syntax = method.syntax + ")" method.returns = returns method.new = True for function in self.function_list: if function.name == name: dst_parameters_types = self.get_parameter_types( function.parameters) src_parameters_types = self.get_parameter_types(parameters) if (len(src_parameters_types) == len(dst_parameters_types)): a = -1 for i in range(len(src_parameters_types)): if src_parameters_types[i] != dst_parameters_types[i]: break else: a = i if a == len(src_parameters_types ) - 1 and function.returns == returns: function.new = False function.parameters = parameters function.syntax = method.syntax function.returns = method.returns return function if fuzzy and len(alternatives) > 0: alternative_func = self.fuzzy_function_search( name, returns, parameters, alternatives, already_found) if alternative_func != None: alternative_func.parameters = method.parameters alternative_func.syntax = method.syntax alternative_func.returns = method.returns return alternative_func else: self.function_list.append(method) return method else: return None
def function_by_signature(self, name, returns, parameters, alternatives, already_found, fuzzy): method = DocsMethod(0) method.name = name method.parameters = parameters method.syntax = name + "(" for p in self.get_parameter_names(parameters): method.syntax = method.syntax + p + ", " method.syntax = method.syntax.rstrip(', ') method.syntax = method.syntax + ")" method.returns = returns method.new = True for function in self.function_list: if function.name == name: dst_parameters_types = self.get_parameter_types(function.parameters) src_parameters_types = self.get_parameter_types(parameters) if(len(src_parameters_types)==len(dst_parameters_types)): a = -1 for i in range(len(src_parameters_types)): if src_parameters_types[i] != dst_parameters_types[i]: break else: a = i if a == len(src_parameters_types)-1 and function.returns == returns: function.new = False function.parameters = parameters function.syntax = method.syntax function.returns = method.returns return function if fuzzy and len(alternatives)>0: alternative_func = self.fuzzy_function_search(name, returns, parameters, alternatives, already_found) if alternative_func != None: alternative_func.parameters = method.parameters alternative_func.syntax = method.syntax alternative_func.returns = method.returns return alternative_func else: self.function_list.append(method) return method else: return None