6.1.1.2.1.3.1.1. pycropml.transpiler.rules.cppRules module¶
-
class
pycropml.transpiler.rules.cppRules.
CppRules
[source]¶ Bases:
pycropml.transpiler.rules.generalRule.GeneralRule
-
binary_op
= {'!=': '!=', '*': '*', '+': '+', '-': '-', '/': '/', '<': '<', '<=': '<=', '==': '==', '>': '>', '>=': '>=', 'and': '&&', 'not': '!', 'or': '||'}¶
-
constant
= {'math': {'pi': 'M_PI'}}¶
-
constructor
= '\n %s::%s()\n {\n \n }\n '¶
-
copy_constr
= '\n public %s(%s toCopy, bool copyAll) // copy constructor \n {\n if (copyAll)\n {\n '¶
-
copy_constrArray
= '\n for (int i = 0; i < %s; i++)\n {\n _%s[i] = toCopy._%s[i];\n }\n '¶
-
copy_constrList
= '\n for (int i = 0; i < toCopy.%s.Count; i++)\n {\n %s.Add(toCopy.%s[i]);\n }\n '¶
-
copy_constr_compo
= '\nvoid %s(%s& toCopy): this() // copy constructor \n{\n'¶
-
functions
= {'datetime': {'datetime': ' new DateTime'}, 'io': {'print': 'cout<<', 'read': 'Console.ReadLine', 'read_file': 'File.ReadAllText', 'write_file': 'File.WriteAllText'}, 'math': {'acos': 'acos', 'asin': 'asin', 'atan': 'atan', 'ceil': '(int) ceil', 'cos': 'cos', 'exp': 'exp', 'ln': 'log', 'log': 'log10', 'pow': 'pow', 'round': 'round', 'sin': 'asin', 'sqrt': 'sqrt', 'tan': 'tan'}, 'system': {'abs': 'abs', 'max': 'max', 'min': <function translateMIN>, 'pow': 'pow'}}¶
-
methods
= {'array': {'append': '.Add', 'len': <function translateLenArray>}, 'dict': {'get': <function translateget>, 'keys': <function translatekeyDict>, 'len': <function translateLenDict>}, 'float': {'int': 'int'}, 'int': {'float': 'float'}, 'list': {'append': '.push_back', 'contains?': <function translateContains>, 'index': <function translateIndex>, 'insert_at': <function translateInsert>, 'len': <function translateLenList>, 'not contains?': <function translateNotContains>, 'pop': <function translatePop>, 'sum': <function translateSum>}, 'str': {'find': '.find', 'int': 'int', 'len': <function translateLenStr>}}¶
-
public_properties
= '\n {\n get\n {\n return this._%s;\n }\n set\n {\n this._%s= value;\n } \n }'¶
-
public_properties_compo
= '\n {\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': 'array<%s, %s> ', 'bool': 'bool', 'datetime': 'string', 'dict': 'map', 'float': 'float', 'int': 'int', 'list': 'vector', 'str': 'string', 'tuple': 'tuple'}¶
-
unary_op
= {'+': '+', '-': '-', 'not': '!', '~': '~'}¶
-