How to use the qface.helper.qtcpp.Filters.classPrefix 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 qt / qtivi / src / tools / ivigenerator / generate.py View on Github external
def enum_value_to_cppliteral(value, module_name):
    value = value.strip().rsplit('.', 1)[-1]
    return '{0}{1}Module::{2}'.format(Filters.classPrefix, upper_first(module_name), value)
github Pelagicore / qface / qface / helper / qtcpp.py View on Github external
def className(symbol):
        classPrefix = Filters.classPrefix
        return '{0}{1}'.format(classPrefix, symbol.name)
github qt / qtivi / src / tools / ivigenerator / generate.py View on Github external
def return_type(symbol):
    """
    Return the type declaration for properties, handle camel case module name
    """
    prefix = Filters.classPrefix
    if symbol.type.is_enum or symbol.type.is_flag:
        return('{0}{1}Module::{2}'.format(prefix, upper_first(symbol.module.module_name), flag_type(symbol)))
    if symbol.type.is_void or symbol.type.is_primitive:
        if symbol.type.name == 'string':
            return 'QString'
        if symbol.type.name == 'var':
            return 'QVariant'
        if symbol.type.name == 'real':
            return 'qreal'
        return symbol.type.name
    elif symbol.type.is_list:
        nested = return_type(symbol.type.nested)
        return 'QVariantList'.format(nested)
    elif symbol.type.is_model:
        nested = symbol.type.nested
        if nested.is_primitive:
github qt / qtivi / src / tools / ivigenerator / generate.py View on Github external
def parameter_type(symbol):
    """
    Return the parameter declaration for properties, handle camel case module name
    """
    prefix = Filters.classPrefix
    if symbol.type.is_enum or symbol.type.is_flag:
        return '{0}{1}Module::{2} {3}'.format(prefix, upper_first(symbol.module.module_name), flag_type(symbol), 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 == 'var':
            return 'const QVariant &{0}'.format(symbol)
        if symbol.type.name == 'real':
            return 'qreal {0}'.format(symbol)
        return '{0} {1}'.format(symbol.type, symbol)
    elif symbol.type.is_list:
        nested = return_type(symbol.type.nested)
        return 'const QVariantList &{1}'.format(nested, symbol)
    elif symbol.type.is_model:
        nested = symbol.type.nested
        if nested.is_primitive:
github qt / qtivi / src / tools / ivigenerator / generate.py View on Github external
from path import Path

from qface.generator import FileSystem, Generator
from qface.helper.qtcpp import Filters
from qface.watch import monitor
from qface.idl.domain import Module, Interface, Property, Parameter, Field, Struct
from qface.helper.generic import upper_first

from jinja2 import TemplateAssertionError
import inspect

here = Path(__file__).dirname()

log = logging.getLogger(__file__)

Filters.classPrefix = ''
currentQFaceSrcFile = ''

builtin_config = {}
IVI_DEFAULT_TEMPLATES = ['frontend', 'qmlplugin', 'backend_simulator', 'backend_qtro', 'server_qtro', 'server_qtro_simulator', 'test']

def jinjaTrace():
    """
    Collects all jinja template files and the line numbers from the current calltrace
    """
    frame = inspect.currentframe()
    infos = []
    while frame:
        template = frame.f_globals.get('__jinja_template__')
        if template is not None:
            infos.append((inspect.getsourcefile(frame), template.get_corresponding_lineno(frame.f_lineno)))
        frame = frame.f_back
github Pelagicore / qface / qface / helper / qtcpp.py View on Github external
def returnType(symbol):
        prefix = Filters.classPrefix
        t = symbol.type
        if t.is_enumeration:
            return '{0}::{0}Enum'.format(symbol.type)
        if symbol.type.is_void or symbol.type.is_primitive:
            if t.is_string:
                return 'QString'
            if t.is_var:
                return 'QVariant'
            if t.is_real:
                return 'qreal'
            if t.is_int:
                return 'int'
            if t.is_bool:
                return 'bool'
            if t.is_void:
                return 'void'