示例#1
0
 def __process_function(self, function):
     with CreateExceptionTraits(function, None, self):
         self.loader_traits.add_impl_header(function.m_implementation_header)
         self.output_header.put_line('inline {return_type} {function_name}({arguments})'.format(
             return_type=self.get_wrapped_return_type(function.m_return),
             function_name=function.m_name,
             arguments=', '.join(self.get_wrapped_argument_pairs(function.m_arguments))))
         c_function_name = self.get_namespace_id().lower() + Helpers.pascal_to_stl(function.m_name)
         with FileGenerator.IndentScope(self.output_header):
             self.put_raw_pointer_structure_if_required(self.output_header, function.m_arguments)
             self.exception_traits.generate_c_call(
                 c_function_name,
                 '{c_function}({arguments})',
                 True
             )
         self.output_header.put_line('')
         c_function_declaration = '{return_type} {c_function}({arguments})'.format(
             return_type=self.get_c_type(function.m_return),
             c_function=c_function_name,
             arguments=', '.join(self.exception_traits.get_c_argument_pairs_for_function())
         )
         self.loader_traits.add_c_function_declaration(c_function_declaration)
         with FileGenerator.IndentScope(self.output_source):
             method_call = '{return_instruction}{function_name}({arguments});'.format(
                 return_instruction=self.get_c_return_instruction(function.m_return),
                 function_name=function.m_name
                 if not function.m_implementation_name else function.m_implementation_name,
                 arguments=', '.join(self.get_c_to_original_arguments(function.m_arguments))
             )
             self.exception_traits.generate_implementation_call(method_call, function.m_return)
         self.output_source.put_line('')