Exemple #1
0
def class_template_headers(template_string):
    template_string = template_string.strip()

    class_template_types = {
        'Vector': {'headers': ['<wtf/Vector.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']},
        'HashMap': {'headers': ['<wtf/HashMap.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}
Exemple #2
0
def class_template_headers(template_string):
    template_string = template_string.strip()

    class_template_types = {
        # FIXME: Remove the unprefixed versions.
        'Vector': {'headers': ['<wtf/Vector.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']},
        'HashMap': {'headers': ['<wtf/HashMap.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']},

        'WTF::Vector': {'headers': ['<wtf/Vector.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']},
        'WTF::HashMap': {'headers': ['<wtf/HashMap.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]}
    header_infos = [class_template_types[match.groupdict()['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}
Exemple #3
0
def class_template_headers(template_string):
    template_string = template_string.strip()

    class_template_types = {
        'Vector': {'headers': ['<wtf/Vector.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']},
        'HashMap': {'headers': ['<wtf/HashMap.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}
Exemple #4
0
def class_template_headers(template_string):
    template_string = template_string.strip()

    class_template_types = {
        "Vector": {"headers": ["<wtf/Vector.h>"], "argument_coder_headers": ['"ArgumentCoders.h"']},
        "HashMap": {"headers": ["<wtf/HashMap.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}
Exemple #5
0
def class_template_headers(template_string):
    template_string = template_string.strip()

    class_template_types = {
        # FIXME: Remove the unprefixed versions.
        'Vector': {'headers': ['<wtf/Vector.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']},
        'HashMap': {'headers': ['<wtf/HashMap.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']},

        'WTF::Vector': {'headers': ['<wtf/Vector.h>'], 'argument_coder_headers': ['"ArgumentCoders.h"']},
        'WTF::HashMap': {'headers': ['<wtf/HashMap.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]}
    header_infos = [class_template_types[match.groupdict()['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}