(CppExpression expression, string removePrefix)
| 69 | /////////////////////////////////////////// |
| 70 | |
| 71 | static string BuildExpression(CppExpression expression, string removePrefix) |
| 72 | { |
| 73 | string result = ""; |
| 74 | CppExpression exp = expression; |
| 75 | while (exp != null) |
| 76 | { |
| 77 | CppExpression curr = exp; |
| 78 | if (exp is CppBinaryExpression) curr = ((CppBinaryExpression)exp).Arguments[1]; |
| 79 | |
| 80 | switch(curr.Kind) |
| 81 | { |
| 82 | case CppExpressionKind.DeclRef: { |
| 83 | string name = ((CppRawExpression)curr).Text; |
| 84 | int prefix = 0; |
| 85 | if (name.StartsWith(removePrefix)) prefix = removePrefix.Length; |
| 86 | result = CSTypes.SnakeToCamel(name, true, prefix) + result; |
| 87 | } break; |
| 88 | case CppExpressionKind.UnaryOperator: { |
| 89 | CppExpression arg = ((CppUnaryExpression)curr).Arguments[0]; |
| 90 | string name = arg.ToString(); |
| 91 | int prefix = 0; |
| 92 | if (name.StartsWith(removePrefix)) prefix = removePrefix.Length; |
| 93 | result = ((CppUnaryExpression)curr).Operator + CSTypes.SnakeToCamel(name, true, prefix) + result; |
| 94 | } break; |
| 95 | default: result = curr + result; break; |
| 96 | } |
| 97 | |
| 98 | if (exp is CppBinaryExpression) { |
| 99 | result = ((CppBinaryExpression)exp).Operator + " " + result; |
| 100 | exp = ((CppBinaryExpression)exp).Arguments[0]; |
| 101 | result = " " + result; |
| 102 | } else { |
| 103 | exp = null; |
| 104 | } |
| 105 | } |
| 106 | return result; |
| 107 | } |
| 108 | |
| 109 | /////////////////////////////////////////// |
| 110 |
nothing calls this directly
no test coverage detected