def generate_output(self): headers = set([ '<WebInspector/RWIProtocolJSONObject.h>', ]) header_args = { 'includes': '\n'.join(['#import ' + header for header in sorted(headers)]), } domains = self.domains_to_generate() type_domains = filter(ObjCGenerator.should_generate_domain_types_filter(self.model()), domains) command_domains = filter(ObjCGenerator.should_generate_domain_command_handler_filter(self.model()), domains) event_domains = filter(ObjCGenerator.should_generate_domain_event_dispatcher_filter(self.model()), domains) # FIXME: <https://webkit.org/b/138222> Web Inspector: Reduce unnecessary enums/types generated in ObjC Protocol Interfaces # Currently we generate enums/types for all types in the type_domains. For the built-in # JSC domains (Debugger, Runtime) this produces extra unused types. We only need to # generate these types if they are referenced by the command_domains or event_domains. sections = [] sections.append(self.generate_license()) sections.append(Template(ObjCTemplates.HeaderPrelude).substitute(None, **header_args)) sections.append('\n'.join(filter(None, map(self._generate_forward_declarations, type_domains)))) sections.append('\n'.join(filter(None, map(self._generate_enums, type_domains)))) sections.append('\n'.join(filter(None, map(self._generate_types, type_domains)))) sections.append('\n\n'.join(filter(None, map(self._generate_command_protocols, command_domains)))) sections.append('\n\n'.join(filter(None, map(self._generate_event_interfaces, event_domains)))) sections.append(Template(ObjCTemplates.HeaderPostlude).substitute(None)) return '\n\n'.join(sections)
def generate_output(self): headers = set([ '<WebInspector/%sJSONObject.h>' % ObjCGenerator.OBJC_PREFIX, ]) header_args = { 'includes': '\n'.join(['#import ' + header for header in sorted(headers)]), } domains = self.domains_to_generate() type_domains = list(filter(ObjCGenerator.should_generate_domain_types_filter(self.model()), domains)) command_domains = list(filter(ObjCGenerator.should_generate_domain_command_handler_filter(self.model()), domains)) event_domains = list(filter(ObjCGenerator.should_generate_domain_event_dispatcher_filter(self.model()), domains)) # FIXME: <https://webkit.org/b/138222> Web Inspector: Reduce unnecessary enums/types generated in ObjC Protocol Interfaces # Currently we generate enums/types for all types in the type_domains. For the built-in # JSC domains (Debugger, Runtime) this produces extra unused types. We only need to # generate these types if they are referenced by the command_domains or event_domains. sections = [] sections.append(self.generate_license()) sections.append(Template(ObjCTemplates.HeaderPrelude).substitute(None, **header_args)) sections.append('\n'.join([_f for _f in map(self._generate_forward_declarations, type_domains) if _f])) sections.append('\n'.join([_f for _f in map(self._generate_enums, type_domains) if _f])) sections.append('\n'.join([_f for _f in map(self._generate_types, type_domains) if _f])) sections.append('\n\n'.join([_f for _f in map(self._generate_command_protocols, command_domains) if _f])) sections.append('\n\n'.join([_f for _f in map(self._generate_event_interfaces, event_domains) if _f])) sections.append(Template(ObjCTemplates.HeaderPostlude).substitute(None)) return '\n\n'.join(sections)
def domains_to_generate(self): return filter( ObjCGenerator.should_generate_domain_types_filter(self.model()), Generator.domains_to_generate(self))
def domains_to_generate(self): return filter( ObjCGenerator.should_generate_domain_types_filter(self.model()), Generator.domains_to_generate(self) )