Ejemplo n.º 1
0
 def _generate_container_code(self, union_type):
     union_type = union_type.resolve_typedefs(self.typedefs)
     header_template = self.jinja_env.get_template('union_container.h.tmpl')
     cpp_template = self.jinja_env.get_template('union_container.cpp.tmpl')
     template_context = v8_union.container_context(union_type,
                                                   self.info_provider)
     template_context['header_includes'].append(
         self.info_provider.include_path_for_export)
     template_context['header_includes'] = normalize_and_sort_includes(
         template_context['header_includes'],
         self.snake_case_generated_files)
     template_context['cpp_includes'] = normalize_and_sort_includes(
         template_context['cpp_includes'], self.snake_case_generated_files)
     template_context['code_generator'] = self.generator_name
     template_context['exported'] = self.info_provider.specifier_for_export
     snake_base_name = to_snake_case(shorten_union_name(union_type))
     template_context['this_include_header_name'] = snake_base_name
     header_text = render_template(header_template, template_context)
     cpp_text = render_template(cpp_template, template_context)
     header_path = posixpath.join(self.output_dir, '%s.h' % snake_base_name)
     cpp_path = posixpath.join(self.output_dir, '%s.cc' % snake_base_name)
     return (
         (header_path, header_text),
         (cpp_path, cpp_text),
     )
Ejemplo n.º 2
0
 def _generate_container_code(self, union_type):
     header_template = self.jinja_env.get_template("union_container.h.tmpl")
     cpp_template = self.jinja_env.get_template("union_container.cpp.tmpl")
     template_context = v8_union.container_context(union_type, self.info_provider.interfaces_info)
     template_context["header_includes"].append(self.info_provider.include_path_for_export)
     template_context["header_includes"] = normalize_and_sort_includes(template_context["header_includes"])
     template_context["code_generator"] = self.generator_name
     template_context["exported"] = self.info_provider.specifier_for_export
     name = shorten_union_name(union_type)
     template_context["this_include_header_name"] = name
     header_text = header_template.render(template_context)
     cpp_text = cpp_template.render(template_context)
     header_path = posixpath.join(self.output_dir, "%s.h" % name)
     cpp_path = posixpath.join(self.output_dir, "%s.cpp" % name)
     return ((header_path, header_text), (cpp_path, cpp_text))
Ejemplo n.º 3
0
 def _generate_container_code(self, union_type):
     header_template = self.jinja_env.get_template('union_container.h')
     cpp_template = self.jinja_env.get_template('union_container.cpp')
     template_context = v8_union.container_context(
         union_type, self.info_provider.interfaces_info)
     template_context['header_includes'].append(
         self.info_provider.include_path_for_export)
     template_context['header_includes'] = normalize_and_sort_includes(
         template_context['header_includes'])
     template_context['code_generator'] = module_pyname
     template_context['exported'] = self.info_provider.specifier_for_export
     name = shorten_union_name(union_type)
     template_context['this_include_header_name'] = name
     header_text = header_template.render(template_context)
     cpp_text = cpp_template.render(template_context)
     header_path = posixpath.join(self.output_dir, '%s.h' % name)
     cpp_path = posixpath.join(self.output_dir, '%s.cpp' % name)
     return (
         (header_path, header_text),
         (cpp_path, cpp_text),
     )
Ejemplo n.º 4
0
 def _generate_container_code(self, union_type):
     header_template = self.jinja_env.get_template('union_container.h')
     cpp_template = self.jinja_env.get_template('union_container.cpp')
     template_context = v8_union.container_context(
         union_type, self.info_provider.interfaces_info)
     template_context['header_includes'].append(
         self.info_provider.include_path_for_export)
     template_context['header_includes'] = normalize_and_sort_includes(
         template_context['header_includes'])
     template_context['code_generator'] = module_pyname
     template_context['exported'] = self.info_provider.specifier_for_export
     name = shorten_union_name(union_type)
     template_context['this_include_header_name'] = name
     header_text = header_template.render(template_context)
     cpp_text = cpp_template.render(template_context)
     header_path = posixpath.join(self.output_dir, '%s.h' % name)
     cpp_path = posixpath.join(self.output_dir, '%s.cpp' % name)
     return (
         (header_path, header_text),
         (cpp_path, cpp_text),
     )
Ejemplo n.º 5
0
 def _generate_container_code(self, union_type):
     includes.clear()
     union_type = union_type.resolve_typedefs(self.typedefs)
     header_template = self.jinja_env.get_template('union_container.h.tmpl')
     cpp_template = self.jinja_env.get_template('union_container.cc.tmpl')
     template_context = v8_union.container_context(union_type, self.info_provider)
     template_context['header_includes'].append(
         self.info_provider.include_path_for_export)
     template_context['exported'] = self.info_provider.specifier_for_export
     snake_base_name = to_snake_case(shorten_union_name(union_type))
     header_path = posixpath.join(self.output_dir, '%s.h' % snake_base_name)
     cpp_path = posixpath.join(self.output_dir, '%s.cc' % snake_base_name)
     this_include_header_path = self.normalize_this_header_path(header_path)
     template_context['this_include_header_path'] = this_include_header_path
     template_context['header_guard'] = to_header_guard(this_include_header_path)
     header_text, cpp_text = self.render_templates(
         [], header_template, cpp_template, template_context)
     return (
         (header_path, header_text),
         (cpp_path, cpp_text),
     )