6.1.1.2.1.4.1.1. pycropml.transpiler.rules.cpp2Rules module

class pycropml.transpiler.rules.cpp2Rules.CppRules[source]

Bases: GeneralRule

binary_op = {'!=': '!=', '*': '*', '+': '+', '-': '-', '/': '/', '<': '<', '<=': '<=', '==': '==', '>': '>', '>=': '>=', 'and': '&&', 'is_not': '!=', 'not': '!', 'or': '||'}
constant = {'math': {'pi': 'M_PI'}}
constructor = '%s::%s()\n{\n       \n}\n'
copy_constr = 'public %s(%s toCopy, bool copyAll) // copy constructor \n{\nif (copyAll)\n{\n'
copy_constrArray = 'for (int i = 0; i < %s; i++)\n{\n    %s[i] = toCopy.get%s()[i];\n}\n'
copy_constrList = 'for (int i = 0; i < toCopy.get%s().Count; i++)\n{\n    %s.Add(toCopy.get%s()[i]);\n}\n'
copy_constr_compo = 'void %s(%s& toCopy): this() // copy constructor \n{\n'
functions = {'datetime': {'datetime': <function CppRules.<lambda>>}, 'math': {'acos': 'std::acos', 'asin': 'std::asin', 'atan': 'std::atan', 'ceil': '(int) std::ceil', 'cos': 'std::cos', 'exp': 'std::exp', 'floor': 'std::floor', 'isnan': 'std::isnan', 'ln': 'std::log', 'log': <function translate_log>, 'pow': 'std::pow', 'round': 'std::round', 'sin': 'std::sin', 'sqrt': 'std::sqrt', 'tan': 'std::tan'}, 'system': {'abs': 'std::abs', 'max': <function translate_max>, 'min': <function translate_min>, 'pow': 'std::pow', 'round': 'std::round'}}
methods = {'array': {'allocate': <function CppRules.<lambda>>, 'append': '.Add', 'len': <function translate_len_array>, 'sum': <function translate_sum>}, 'dict': {'get': <function translate_get>, 'keys': <function translate_key_dict>, 'len': <function translate_len_dict>}, 'float': {'int': 'int'}, 'int': {'float': 'float'}, 'list': {'allocate': <function CppRules.<lambda>>, 'append': '.push_back', 'contains?': <function translate_contains>, 'index': <function translate_index>, 'insert_at': <function translate_insert>, 'len': <function translate_len_list>, 'not contains?': <function translate_not_contains>, 'pop': <function translate_pop>, 'sum': <function translate_sum>}, 'str': {'find': '.find', 'int': 'int', 'len': <function translate_len_str>}}
public_properties = '{\n    get\n    {\n        return this._%s;\n    }\n    set\n    {\n        this._%s= value;\n    } \n}'
public_properties_compo = '{\n    get\n    {\n        return _%s.%s;\n    }\n    set\n    {\n        %s\n    } \n}\n'
public_properties_wrap = '{ get { return %s.%s;}}\n'
types = {'array': 'std::vector<%s>(%s) ', 'bool': 'bool', 'datetime': 'std::string', 'dict': 'std::map', 'double': 'double', 'float': 'double', 'int': 'int', 'list': 'std::vector', 'str': 'std::string', 'tuple': 'std::tuple'}
typesCrop = {'array': 'std::vector<%s>(%s) ', 'boolean': 'bool', 'datetime': 'std::string', 'dict': 'std::map', 'double': 'double', 'float': 'double', 'integer': 'int', 'list': 'std::vector', 'string': 'std::string', 'tuple': 'std::tuple'}
unary_op = {'+': '+', '-': '-', 'not': '!', '~': '~'}
pycropml.transpiler.rules.cpp2Rules.args_to_str(args)[source]
pycropml.transpiler.rules.cpp2Rules.translate_contains(node)[source]
pycropml.transpiler.rules.cpp2Rules.translate_get(node)[source]
pycropml.transpiler.rules.cpp2Rules.translate_index(node)[source]
pycropml.transpiler.rules.cpp2Rules.translate_insert(node)[source]
pycropml.transpiler.rules.cpp2Rules.translate_key_dict(node)[source]
pycropml.transpiler.rules.cpp2Rules.translate_len_array(node)[source]
pycropml.transpiler.rules.cpp2Rules.translate_len_dict(node)[source]
pycropml.transpiler.rules.cpp2Rules.translate_len_list(node)[source]
pycropml.transpiler.rules.cpp2Rules.translate_len_str(node)[source]
pycropml.transpiler.rules.cpp2Rules.translate_log(node)[source]
pycropml.transpiler.rules.cpp2Rules.translate_max(node)[source]
pycropml.transpiler.rules.cpp2Rules.translate_min(node)[source]
pycropml.transpiler.rules.cpp2Rules.translate_min_max(node, f)[source]
pycropml.transpiler.rules.cpp2Rules.translate_not_contains(node)[source]
pycropml.transpiler.rules.cpp2Rules.translate_pop(node)[source]
pycropml.transpiler.rules.cpp2Rules.translate_sum(node)[source]