Beispiel #1
0
def GetArg(arg):
    ty = arg.attrib['type']
    return {
        'name': arg.attrib['name'],
        'type': ty,
        'nullable': arg.get('allow-null', 'false') == 'true',
        'proto_type': proto_type_conversions[ty],
        'cpp_type': GetCppType(arg),
        'interface': arg.get('interface'),
        'doc': wlu.GetDocumentation(arg),
    }
Beispiel #2
0
def GetInterface(interface, context):
    name = interface.attrib['name']
    return {
        'name': name,
        'idx': context.GetAndIncrementCount('interface_index'),
        'cpp_type': GetCppPtrType(name),
        'is_global': name not in context.non_global_names,
        'events': [GetMessage(m, context) for m in interface.findall('event')],
        'requests':
        [GetMessage(m, context) for m in interface.findall('request')],
        'has_listener': wlu.NeedsListener(interface),
        'doc': wlu.GetDocumentation(interface),
    }
Beispiel #3
0
def GetMessage(message, context):
    name = message.attrib['name']
    constructed = wlu.GetConstructedInterface(message)
    return {
        'name': name,
        'tag': message.tag,
        'idx': context.GetAndIncrementCount('message_index'),
        'args': [GetArg(a) for a in message.findall('arg')],
        'is_constructor': wlu.IsConstructor(message),
        'is_destructor': wlu.IsDestructor(message),
        'constructed': constructed,
        'constructed_has_listener': constructed
        in context.interfaces_with_listeners,
        'doc': wlu.GetDocumentation(message),
    }