当前位置: 首页>>代码示例>>Python>>正文


Python IdlType.set_callback_functions方法代码示例

本文整理汇总了Python中idl_types.IdlType.set_callback_functions方法的典型用法代码示例。如果您正苦于以下问题:Python IdlType.set_callback_functions方法的具体用法?Python IdlType.set_callback_functions怎么用?Python IdlType.set_callback_functions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在idl_types.IdlType的用法示例。


在下文中一共展示了IdlType.set_callback_functions方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: generate_code

# 需要导入模块: from idl_types import IdlType [as 别名]
# 或者: from idl_types.IdlType import set_callback_functions [as 别名]
 def generate_code(self, definitions, definition_name):
     """Returns .h/.cpp code as ((path, content)...)."""
     # Set local type info
     IdlType.set_callback_functions(definitions.callback_functions.keys())
     IdlType.set_enums((enum.name, enum.values)
                       for enum in definitions.enumerations.values())
     return self.generate_code_internal(definitions, definition_name)
开发者ID:335969568,项目名称:Blink-1,代码行数:9,代码来源:code_generator_v8.py

示例2: generate_code

# 需要导入模块: from idl_types import IdlType [as 别名]
# 或者: from idl_types.IdlType import set_callback_functions [as 别名]
 def generate_code(self, definitions, definition_name):
     """Returns .h/.cpp code as ((path, content)...)."""
     # Set local type info
     IdlType.set_callback_functions(definitions.callback_functions.keys())
     IdlType.set_enums((enum.name, enum.values)
                       for enum in definitions.enumerations.values())
     # Resolve typedefs
     definitions.resolve_typedefs(self.info_provider.component_info['typedefs'])
     return self.generate_code_internal(definitions, definition_name)
开发者ID:janRucka,项目名称:blink,代码行数:11,代码来源:code_generator_v8.py

示例3: generate_code

# 需要导入模块: from idl_types import IdlType [as 别名]
# 或者: from idl_types.IdlType import set_callback_functions [as 别名]
    def generate_code(self, definitions, definition_name):
        """Returns .h/.cpp code as ((path, content)...)."""
        # Set local type info
        if not should_generate_code(definitions):
            return set()

        IdlType.set_callback_functions(definitions.callback_functions.keys())
        # Resolve typedefs
        self.typedef_resolver.resolve(definitions, definition_name)
        return self.generate_code_internal(definitions, definition_name)
开发者ID:b-cuts,项目名称:blink-crosswalk,代码行数:12,代码来源:code_generator_v8.py

示例4: set_global_type_info

# 需要导入模块: from idl_types import IdlType [as 别名]
# 或者: from idl_types.IdlType import set_callback_functions [as 别名]
 def set_global_type_info(self):
     interfaces_info = self.info_provider.interfaces_info
     set_ancestors(interfaces_info['ancestors'])
     IdlType.set_callback_interfaces(interfaces_info['callback_interfaces'])
     IdlType.set_dictionaries(interfaces_info['dictionaries'])
     IdlType.set_enums(self.info_provider.enumerations)
     IdlType.set_callback_functions(self.info_provider.callback_functions)
     IdlType.set_implemented_as_interfaces(interfaces_info['implemented_as_interfaces'])
     IdlType.set_garbage_collected_types(interfaces_info['garbage_collected_interfaces'])
     set_component_dirs(interfaces_info['component_dirs'])
开发者ID:mirror,项目名称:chromium,代码行数:12,代码来源:code_generator.py

示例5: generate_code

# 需要导入模块: from idl_types import IdlType [as 别名]
# 或者: from idl_types.IdlType import set_callback_functions [as 别名]
    def generate_code(self, definitions, interface_name):
        """Returns .h/.cpp code as (header_text, cpp_text)."""
        try:
            interface = definitions.interfaces[interface_name]
        except KeyError:
            raise Exception('%s not in IDL definitions' % interface_name)

        # Store other interfaces for introspection
        interfaces.update(definitions.interfaces)

        # Set local type info
        IdlType.set_callback_functions(definitions.callback_functions.keys())
        IdlType.set_enums((enum.name, enum.values)
                          for enum in definitions.enumerations.values())

        # Select appropriate Jinja template and contents function
        if interface.is_callback:
            header_template_filename = 'callback_interface.h'
            cpp_template_filename = 'callback_interface.cpp'
            interface_context = v8_callback_interface.callback_interface_context
        elif 'PrivateScriptInterface' in interface.extended_attributes:
            # Currently private scripts don't have dependencies. Once private scripts have dependencies,
            # we should add them to interface_info.
            header_template_filename = 'private_script_interface.h'
            cpp_template_filename = 'private_script_interface.cpp'
            interface_context = v8_private_script_interface.private_script_interface_context
        else:
            header_template_filename = 'interface.h'
            cpp_template_filename = 'interface.cpp'
            interface_context = v8_interface.interface_context
        header_template = self.jinja_env.get_template(header_template_filename)
        cpp_template = self.jinja_env.get_template(cpp_template_filename)

        # Compute context (input values for Jinja)
        template_context = interface_context(interface)
        template_context['code_generator'] = module_pyname

        # Add includes for interface itself and any dependencies
        interface_info = self.interfaces_info[interface_name]
        if 'PrivateScriptInterface' not in interface.extended_attributes:
            template_context['header_includes'].add(interface_info['include_path'])
        template_context['header_includes'] = sorted(template_context['header_includes'])
        includes.update(interface_info.get('dependencies_include_paths', []))
        template_context['cpp_includes'] = sorted(includes)

        # Render Jinja templates
        header_text = header_template.render(template_context)
        cpp_text = cpp_template.render(template_context)
        return header_text, cpp_text
开发者ID:ewilligers,项目名称:blink,代码行数:51,代码来源:code_generator_v8.py

示例6: generate_code

# 需要导入模块: from idl_types import IdlType [as 别名]
# 或者: from idl_types.IdlType import set_callback_functions [as 别名]
    def generate_code(self, definitions, definition_name):
        """Returns .h/.cpp code as (header_text, cpp_text)."""
        # Set local type info
        IdlType.set_callback_functions(definitions.callback_functions.keys())
        IdlType.set_enums((enum.name, enum.values)
                          for enum in definitions.enumerations.values())

        if definition_name in definitions.interfaces:
            return self.generate_interface_code(
                definitions, definition_name,
                definitions.interfaces[definition_name])
        if definition_name in definitions.dictionaries:
            return self.generate_dictionary_code(
                definitions, definition_name,
                definitions.dictionaries[definition_name])
        raise ValueError('%s is not in IDL definitions' % definition_name)
开发者ID:darktears,项目名称:blink-crosswalk,代码行数:18,代码来源:code_generator_v8.py

示例7: generate_code

# 需要导入模块: from idl_types import IdlType [as 别名]
# 或者: from idl_types.IdlType import set_callback_functions [as 别名]
    def generate_code(self, definitions, interface_name):
        """Returns .h/.cpp code as (header_text, cpp_text)."""
        try:
            interface = definitions.interfaces[interface_name]
        except KeyError:
            raise Exception('%s not in IDL definitions' % interface_name)

        # Store other interfaces for introspection
        interfaces.update(definitions.interfaces)

        # Set local type info
        IdlType.set_callback_functions(definitions.callback_functions.keys())
        IdlType.set_enums((enum.name, enum.values)
                          for enum in definitions.enumerations.values())

        # Select appropriate Jinja template and contents function
        if interface.is_callback:
            header_template_filename = 'callback_interface.h'
            cpp_template_filename = 'callback_interface.cpp'
            generate_contents = v8_callback_interface.generate_callback_interface
        else:
            header_template_filename = 'interface.h'
            cpp_template_filename = 'interface.cpp'
            generate_contents = v8_interface.generate_interface
        header_template = self.jinja_env.get_template(header_template_filename)
        cpp_template = self.jinja_env.get_template(cpp_template_filename)

        # Generate contents (input parameters for Jinja)
        template_contents = generate_contents(interface)
        template_contents['code_generator'] = module_pyname

        # Add includes for interface itself and any dependencies
        interface_info = self.interfaces_info[interface_name]
        template_contents['header_includes'].add(interface_info['include_path'])
        template_contents['header_includes'] = sorted(template_contents['header_includes'])
        includes.update(interface_info.get('dependencies_include_paths', []))
        template_contents['cpp_includes'] = sorted(includes)

        # Render Jinja templates
        header_text = header_template.render(template_contents)
        cpp_text = cpp_template.render(template_contents)
        return header_text, cpp_text
开发者ID:ericwilligers,项目名称:blink,代码行数:44,代码来源:code_generator_v8.py

示例8: generate_code

# 需要导入模块: from idl_types import IdlType [as 别名]
# 或者: from idl_types.IdlType import set_callback_functions [as 别名]
    def generate_code(self, definitions, interface_name,
                      idl_filename, idl_pickle_filename, only_if_changed):
        """Returns .h/.cpp/.dart code as (header_text, cpp_text, dart_text)."""
        try:
            interface = definitions.interfaces[interface_name]
        except KeyError:
            raise Exception('%s not in IDL definitions' % interface_name)

        # Store other interfaces for introspection
        interfaces.update(definitions.interfaces)

        # Set local type info
        IdlType.set_callback_functions(definitions.callback_functions.keys())
        IdlType.set_enums((enum.name, enum.values)
                          for enum in definitions.enumerations.values())

        # Select appropriate Jinja template and contents function
        if interface.is_callback:
            header_template_filename = 'callback_interface_h.template'
            cpp_template_filename = 'callback_interface_cpp.template'
            dart_template_filename = 'callback_interface_dart.template'
            generate_contents = dart_callback_interface.generate_callback_interface
        else:
            header_template_filename = 'interface_h.template'
            cpp_template_filename = 'interface_cpp.template'
            dart_template_filename = 'interface_dart.template'
            generate_contents = dart_interface.interface_context
        header_template = self.jinja_env.get_template(header_template_filename)
        cpp_template = self.jinja_env.get_template(cpp_template_filename)
        dart_template = self.jinja_env.get_template(dart_template_filename)

        # Generate contents (input parameters for Jinja)
        template_contents = generate_contents(interface)
        template_contents['code_generator'] = module_pyname

        # Add includes for interface itself and any dependencies
        interface_info = self.interfaces_info[interface_name]
        template_contents['header_includes'].add(interface_info['include_path'])
        template_contents['header_includes'] = sorted(template_contents['header_includes'])
        includes.update(interface_info.get('dependencies_include_paths', []))

        template_contents['cpp_includes'] = sorted(includes)

        # If PrivateDart is set, read the custom dart file and add it to our
        # template parameters.
        if 'PrivateDart' in interface.extended_attributes:
          template_contents['private_dart'] = True

        idl_world = {'interface': None, 'callback': None}

        # Load the pickle file for this IDL.
        if os.path.isfile(idl_pickle_filename):
            with open(idl_pickle_filename) as idl_pickle_file:
                idl_global_data = pickle.load(idl_pickle_file)
                idl_pickle_file.close()
            idl_world['interface'] = idl_global_data['interface']
            idl_world['callback'] = idl_global_data['callback']

        if 'interface_name' in template_contents:
            interface_global = {'component_dir': interface_info['component_dir'],
                                'name': template_contents['interface_name'],
                                'parent_interface': template_contents['parent_interface'],
                                'is_active_dom_object': template_contents['is_active_dom_object'],
                                'has_resolver': template_contents['interface_name'],
                                'native_entries': sorted(template_contents['native_entries'], key=lambda(x): x['blink_entry']),
                               }
            idl_world['interface'] = interface_global
        else:
            callback_global = {'name': template_contents['cpp_class']}
            idl_world['callback'] = callback_global

        write_pickle_file(idl_pickle_filename,  idl_world, only_if_changed)

        # Render Jinja templates
        header_text = header_template.render(template_contents)
        cpp_text = cpp_template.render(template_contents)
        dart_text = dart_template.render(template_contents)

        return header_text, cpp_text, dart_text
开发者ID:Miaque,项目名称:mojo,代码行数:81,代码来源:code_generator_dart.py

示例9: generate_code

# 需要导入模块: from idl_types import IdlType [as 别名]
# 或者: from idl_types.IdlType import set_callback_functions [as 别名]
    def generate_code(self, definitions, interface_name, idl_pickle_filename,
                      only_if_changed):
        """Returns .h/.cpp code as (header_text, cpp_text)."""
        try:
            interface = definitions.interfaces[interface_name]
        except KeyError:
            raise Exception('%s not in IDL definitions' % interface_name)

        # Store other interfaces for introspection
        interfaces.update(definitions.interfaces)

        # Set local type info
        IdlType.set_callback_functions(definitions.callback_functions.keys())
        IdlType.set_enums((enum.name, enum.values)
                          for enum in definitions.enumerations.values())

        # Select appropriate Jinja template and contents function
        if interface.is_callback:
            header_template_filename = 'callback_interface_h.template'
            cpp_template_filename = 'callback_interface_cpp.template'
            generate_contents = dart_callback_interface.generate_callback_interface
        else:
            header_template_filename = 'interface_h.template'
            cpp_template_filename = 'interface_cpp.template'
            generate_contents = dart_interface.generate_interface
        header_template = self.jinja_env.get_template(header_template_filename)
        cpp_template = self.jinja_env.get_template(cpp_template_filename)

        # Generate contents (input parameters for Jinja)
        template_contents = generate_contents(interface)
        template_contents['code_generator'] = module_pyname

        # Add includes for interface itself and any dependencies
        interface_info = self.interfaces_info[interface_name]
        template_contents['header_includes'].add(interface_info['include_path'])
        template_contents['header_includes'] = sorted(template_contents['header_includes'])
        includes.update(interface_info.get('dependencies_include_paths', []))

        # Remove includes that are not needed for Dart and trigger fatal
        # compile warnings if included. These IDL files need to be
        # imported by Dart to generate the list of events but the
        # associated header files do not contain any code used by Dart.
        includes.discard('core/dom/GlobalEventHandlers.h')
        includes.discard('core/frame/DOMWindowEventHandlers.h')

        template_contents['cpp_includes'] = sorted(includes)

        idl_world = {'interface': None, 'callback': None}

        # Load the pickle file for this IDL.
        if os.path.isfile(idl_pickle_filename):
            with open(idl_pickle_filename) as idl_pickle_file:
                idl_global_data = pickle.load(idl_pickle_file)
                idl_pickle_file.close()
            idl_world['interface'] = idl_global_data['interface']
            idl_world['callback'] = idl_global_data['callback']

        if 'interface_name' in template_contents:
            interface_global = {'name': template_contents['interface_name'],
                                'parent_interface': template_contents['parent_interface'],
                                'is_active_dom_object': template_contents['is_active_dom_object'],
                                'is_event_target': template_contents['is_event_target'],
                                'has_resolver': template_contents['interface_name'] not in INTERFACES_WITHOUT_RESOLVERS,
                                'is_node': template_contents['is_node'],
                                'conditional_string': template_contents['conditional_string'],
                               }
            idl_world['interface'] = interface_global
        else:
            callback_global = {'name': template_contents['cpp_class']}
            idl_world['callback'] = callback_global

        write_pickle_file(idl_pickle_filename,  idl_world, only_if_changed)

        # Render Jinja templates
        header_text = header_template.render(template_contents)
        cpp_text = cpp_template.render(template_contents)
        return header_text, cpp_text
开发者ID:CyberSys,项目名称:sdk,代码行数:79,代码来源:code_generator_dart.py


注:本文中的idl_types.IdlType.set_callback_functions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。