How to use the qface.generator.FileSystem.parse_document 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 / tests / test_validation.py View on Github external
def load_one():
    path = inputPath / 'com.pelagicore.one.qface'
    return FileSystem.parse_document(path)
github Pelagicore / qface / tests / test_generator.py View on Github external
def loadSystem():
    path = inputPath / 'com.pelagicore.ivi.tuner.qface'
    return FileSystem.parse_document(path)
github Pelagicore / qface / tests / test_climate.py View on Github external
def load_system():
    path = inputPath / 'com.pelagicore.ivi.climate.qface'
    return FileSystem.parse_document(path)
github Pelagicore / qface / qtcpp_gen.py View on Github external
#!/usr/bin/env python3
from qface.generator import FileSystem, Generator

system = FileSystem.parse_document('./examples/test.qface')


def paramterType(symbol):
    moduleName = symbol.package.nameParts[-1].capitalize()
    if symbol.type.is_enum:
        return 'Qml{0}Module::{1} {2}'.format(moduleName, symbol.type, symbol)
    if symbol.type.is_void or symbol.type.is_primitive:
        if symbol.type.name == 'string':
            return 'const QString &{0}'.format(symbol)
        if symbol.type.name == 'real':
            return 'float {0}'.format(symbol)
        return '{0} {1}'.format(symbol.type, symbol)
    elif symbol.type.is_list:
        return 'const QList<{0}> &{1}'.format(symbol.type.nested, symbol)
    else:
        return 'const {0} &{1}'.format(symbol.type, symbol)
github Pelagicore / qface / qface / generator.py View on Github external
logger.debug('parse input={0}'.format(inputs))
        identifier = 'system' if not identifier else identifier
        system = System()
        cache = None
        if use_cache:
            cache = shelve.open('qface.cache')
            if identifier in cache and clear_cache:
                del cache[identifier]
            if identifier in cache:
                # use the cached domain model
                system = cache[identifier]
        # if domain model not cached generate it
        for input in inputs:
            path = Path.getcwd() / str(input)
            if path.isfile():
                FileSystem.parse_document(path, system)
            else:
                for document in path.walkfiles(pattern):
                    FileSystem.parse_document(document, system)

        if use_cache:
            cache[identifier] = system
        return system