def class_template_headers(template_string): template_string = template_string.strip() class_template_types = { 'WebCore::RectEdges': {'headers': ['<WebCore/RectEdges.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, 'HashMap': {'headers': ['<wtf/HashMap.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, 'HashSet': {'headers': ['<wtf/HashSet.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, 'Optional': {'headers': ['<wtf/Optional.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, 'OptionSet': {'headers': ['<wtf/OptionSet.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, 'Vector': {'headers': ['<wtf/Vector.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, 'std::pair': {'headers': ['<utility>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, } match = re.match('(?P<template_name>.+?)<(?P<parameter_string>.+)>', template_string) if not match: return {'header_infos': [], 'types': [template_string]} template_name = match.groupdict()['template_name'] if template_name not in class_template_types: sys.stderr.write("Error: no class template type is defined for '%s'\n" % (template_string)) sys.exit(1) header_infos = [class_template_types[template_name]] types = [] for parameter in parser.split_parameters_string(match.groupdict()['parameter_string']): parameter_header_infos_and_types = class_template_headers(parameter) header_infos += parameter_header_infos_and_types['header_infos'] types += parameter_header_infos_and_types['types'] return {'header_infos': header_infos, 'types': types}
def class_template_headers(template_string): template_string = template_string.strip() class_template_types = { 'HashMap': {'headers': ['<wtf/HashMap.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, 'Optional': {'headers': ['<wtf/Optional.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, 'OptionSet': {'headers': ['<wtf/OptionSet.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, 'Vector': {'headers': ['<wtf/Vector.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, 'std::pair': {'headers': ['<utility>'], 'argument_coder_headers': ['"ArgumentCoders.h"']}, } match = re.match('(?P<template_name>.+?)<(?P<parameter_string>.+)>', template_string) if not match: return {'header_infos':[], 'types':[template_string]} template_name = match.groupdict()['template_name'] if template_name not in class_template_types: sys.stderr.write("Error: no class template type is defined for '%s'\n" % (template_string)) sys.exit(1) header_infos = [class_template_types[template_name]] types = [] for parameter in parser.split_parameters_string(match.groupdict()['parameter_string']): parameter_header_infos_and_types = class_template_headers(parameter) header_infos += parameter_header_infos_and_types['header_infos']; types += parameter_header_infos_and_types['types'] return {'header_infos':header_infos, 'types':types}