How to use the qface.generator.FileSystem.parse_dir function in qface

To help you get started, we’ve selected a few qface examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Pelagicore / qface / cpp_gen.py View on Github external
#!/usr/bin/env python3
from qface.generator import FileSystem, Generator

system = FileSystem.parse_dir('./examples')


def paramterType(symbol):
    if symbol.type.is_void or symbol.type.is_primitive:
        return '{0} {1}'.format(symbol.type, symbol)
    else:
        return 'const {0} &{1}'.format(symbol.type, symbol)


def returnType(symbol):
    if symbol.type.is_void or symbol.type.is_primitive:
        return symbol.type
    else:
        return symbol.type

generator = Generator()
github Pelagicore / qface / csv_gen.py View on Github external
#!/usr/bin/env python3
from qface.generator import FileSystem, Generator

system = FileSystem.parse_dir('./examples')


generator = Generator()

ctx = {'system': system}
generator.write('out/packages.csv', 'packages.csv', ctx)
github Pelagicore / qface / ivi_gen.py View on Github external
#!/usr/bin/env python3
from qface.generator import FileSystem, Generator

system = FileSystem.parse_dir('./examples')


def hex(value):
    return '0x{:X}'.format(value)


def paramterType(symbol):
    if symbol.type.is_void or symbol.type.is_primitive:
        return '{0} {1}'.format(symbol.type, symbol)
    else:
        return 'const {0} &{1}'.format(symbol.type, symbol)


def returnType(symbol):
    if symbol.type.is_void or symbol.type.is_primitive:
        return symbol.type
github Pelagicore / qface / generator / qtivi / qtivi.py View on Github external
def generate(input, output):
    system = FileSystem.parse_dir(input)
    generator = Generator(searchpath='./templates')
    generator.register_filter('className', className)
    generator.register_filter('returnType', returnType)
    generator.register_filter('parameterType', paramterType)
    ctx = {'output': output}
    for module in system.modules:
        logger.debug('process %s' % module)
        moduleName = module.nameParts[-1].capitalize()
        ctx.update({'module': module, 'moduleName': moduleName})
        moduleOutput = generator.apply('{{output}}/ivi{{moduleName|lower}}', ctx)
        ctx.update({'path': moduleOutput})
        generator.write('{{path}}/ivi{{moduleName|lower}}.pro', 'project.pro', ctx)
        for interface in module.interfaces:
            ctx.update({'interface': interface})
            generator.write('{{path}}/{{interface|className|lower}}.h', 'interface.h', ctx)
            generator.write('{{path}}/{{interface|className|lower}}_p.h', 'interface_p.h', ctx)
github Pelagicore / qface / generator / csv / csv.py View on Github external
def generate(input, output):
    system = FileSystem.parse_dir(input)
    generator = Generator(searchpath='templates')
    ctx = {'output': output, 'system': system}
    generator.write('{{output}}/modules.csv', 'modules.csv', ctx)
github Pelagicore / qface / generator / qfacegen / qfacegen.py View on Github external
def generate(input, output):
    system = FileSystem.parse_dir(input)
    generator = Generator(searchpath='./templates')
    ctx = {'output': output}
    for counter in range(200):
        for module in system.modules:
            ctx.update({'module': module, 'counter': counter})
            generator.write('{{output}}/x{{module}}{{counter}}.qdl', 'document.qdl', ctx)