Example #1
0
    def __init__(self):
        Qt5Ruleset.RuleSet.__init__(self)
        self._fn_db = rules_engine.FunctionRuleDb(
            lambda: local_function_rules() + Qt5Ruleset.function_rules())
        self._typedef_db = rules_engine.TypedefRuleDb(
            lambda: local_typedef_rules())
        self._methodcode = rules_engine.MethodCodeDb({
            "klocalizedstring.h": {
                "i18n": {
                    "code":
                    """
                    %MethodCode
                        QString result = klocalizedstring_i18n_template(ki18n(a0),a1,&sipIsErr);
                        if (!sipIsErr) {
                            sipRes = new QString(result);
                        }
                    %End
                    """
                },
                "i18nc": {
                    "code":
                    """
                    %MethodCode
                        QString result = klocalizedstring_i18n_template(ki18nc(a0,a1),a2,&sipIsErr);
                        if (!sipIsErr) {
                            sipRes = new QString(result);
                        }
                    %End
                    """
                },
                "i18np": {
                    "code":
                    """
                    %MethodCode
                        QString result = klocalizedstring_i18n_template(ki18np(a0,a1),a2,&sipIsErr);
                        if (!sipIsErr) {
                            sipRes = new QString(result);
                        }
                    %End
                    """
                },
                "i18ncp": {
                    "code":
                    """
                    %MethodCode
                        QString result = klocalizedstring_i18n_template(ki18ncp(a0,a1,a2),a3,&sipIsErr);
                        if (!sipIsErr) {
                            sipRes = new QString(result);
                        }
                    %End
                    """
                },
            }
        })

        self._modulecode = rules_engine.ModuleCodeDb({
            "klocalizedstring.h": {
                "code": _klocalizedstring_add_template_code,
            },
        })
Example #2
0
 def __init__(self):
     self._container_db = rules_engine.ContainerRuleDb(container_rules)
     self._forward_declaration_db = rules_engine.ForwardDeclarationRuleDb(forward_declaration_rules)
     self._fn_db = rules_engine.FunctionRuleDb(function_rules)
     self._param_db = rules_engine.ParameterRuleDb(parameter_rules)
     self._typedef_db = rules_engine.TypedefRuleDb(typedef_rules)
     self._var_db = rules_engine.VariableRuleDb(variable_rules)
     self._methodcode = rules_engine.MethodCodeDb({})
     self._modulecode = rules_engine.ModuleCodeDb({})
    def __init__(self):
        Qt5Ruleset.RuleSet.__init__(self)
        self._container_db = rules_engine.ContainerRuleDb(
            lambda: local_container_rules() + Qt5Ruleset.container_rules())
        self._forward_declaration_db = rules_engine.ForwardDeclarationRuleDb(
            lambda: local_forward_declaration_rules(
            ) + Qt5Ruleset.forward_declaration_rules())
        self._fn_db = rules_engine.FunctionRuleDb(
            lambda: local_function_rules() + Qt5Ruleset.function_rules())
        self._typedef_db = rules_engine.TypedefRuleDb(
            lambda: local_typedef_rules() + Qt5Ruleset.typedef_rules())
        self._modulecode = rules_engine.ModuleCodeDb({
            "cpplib.h": {
                "code":
                """
%ModuleCode
int myAcumulate(const QList<int> *list) {
    return std::accumulate(list->begin(), list->end(), 0);
}
%End\n
            """
            }
        })

        self._methodcode = rules_engine.MethodCodeDb({
            "SomeNS": {
                "customMethod": {
                    "code":
                    """
                    %MethodCode
                        sipRes = myAcumulate(a0);
                    %End
                    """
                }
            },
            "cpplib.h": {
                "anotherCustomMethod": {
                    "code": methodGenerator,
                    "param": 42
                }
            }
        })
Example #4
0
    def __init__(self):
        Qt5Ruleset.RuleSet.__init__(self)
        self._fn_db = rules_engine.FunctionRuleDb(
            lambda: local_function_rules() + Qt5Ruleset.function_rules())
        self._container_db = rules_engine.ContainerRuleDb(
            lambda: local_container_rules() + Qt5Ruleset.container_rules())
        self._typedef_db = rules_engine.TypedefRuleDb(
            lambda: local_typedef_rules() + Qt5Ruleset.typedef_rules())
        self._methodcode = rules_engine.MethodCodeDb({
            "KCoreConfigSkeleton::ItemBool": {
                "ItemBool": {
                    "code": _kcoreconfigskeleton_item_xxx,
                    "ctx": "Bool",
                },
            },
            "KCoreConfigSkeleton::ItemInt": {
                "ItemInt": {
                    "code": _kcoreconfigskeleton_item_xxx,
                    "ctx": "Int",
                },
            },
            "KCoreConfigSkeleton::ItemLongLong": {
                "ItemLongLong": {
                    "code": _kcoreconfigskeleton_item_xxx,
                    "ctx": "LongLong",
                },
            },
            "KCoreConfigSkeleton::ItemEnum": {
                "ItemEnum": {
                    "code": _kcoreconfigskeleton_item_enum,
                    "ctx": "Enum",
                },
            },
            "KCoreConfigSkeleton::ItemUInt": {
                "ItemUInt": {
                    "code": _kcoreconfigskeleton_item_xxx,
                    "ctx": "UInt",
                },
            },
            "KCoreConfigSkeleton::ItemULongLong": {
                "ItemULongLong": {
                    "code": _kcoreconfigskeleton_item_xxx,
                    "ctx": "ULongLong",
                },
            },
            "KCoreConfigSkeleton::ItemDouble": {
                "ItemDouble": {
                    "code": _kcoreconfigskeleton_item_xxx,
                    "ctx": "Double",
                },
            },
            "KCoreConfigSkeleton": {
                "addItemBool": {
                    "code": _kcoreconfigskeleton_add_item_xxx,
                    "ctx": "Bool",
                },
                "addItemInt": {
                    "code": _kcoreconfigskeleton_add_item_xxx,
                    "ctx": "Int",
                },
                "addItemUInt": {
                    "code": _kcoreconfigskeleton_add_item_xxx,
                    "ctx": "UInt",
                },
                "addItemLongLong": {
                    "code": _kcoreconfigskeleton_add_item_xxx,
                    "ctx": "LongLong",
                },
                "addItemInt64": {
                    "code": _kcoreconfigskeleton_add_item_xxx,
                    "ctx": "LongLong",
                },
                "addItemULongLong": {
                    "code": _kcoreconfigskeleton_add_item_xxx,
                    "ctx": "ULongLong",
                },
                "addItemUInt64": {
                    "code": _kcoreconfigskeleton_add_item_xxx,
                    "ctx": "ULongLong",
                },
                "addItemDouble": {
                    "code": _kcoreconfigskeleton_add_item_xxx,
                    "ctx": "Double",
                },
            },
        })

        self._modulecode = rules_engine.ModuleCodeDb({
            "kcoreconfigskeleton.h": {
                "code": _kcoreconfigskeleton_item_add_py_subclass,
            },
        })
Example #5
0
 def __init__(self):
     Qt5Ruleset.RuleSet.__init__(self)
     self._forward_declaration_db = rules_engine.ForwardDeclarationRuleDb(lambda: local_forward_declaration_rules() + Qt5Ruleset.forward_declaration_rules())
     self._fn_db = rules_engine.FunctionRuleDb(lambda: local_function_rules() + Qt5Ruleset.function_rules())
     self._container_db = rules_engine.ContainerRuleDb(lambda: local_container_rules() + Qt5Ruleset.container_rules())
     self._typedef_db = rules_engine.TypedefRuleDb(lambda: local_typedef_rules() + Qt5Ruleset.typedef_rules())