1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

LP-183 introduce an underscore between property name and element name when concatenating digits if not

This commit is contained in:
Philippe Renon 2015-12-21 21:50:55 +01:00
parent cefcacbbcf
commit 6e1224dd38

View File

@ -496,12 +496,18 @@ void generateIndexedProperty(Context &ctxt, FieldContext &fieldCtxt)
for (int elementIndex = 0; elementIndex < fieldCtxt.field->numElements; elementIndex++) {
QString elementName = fieldCtxt.field->elementNames[elementIndex];
QString sep;
if (fieldCtxt.propName.right(1)[0].isDigit() && elementName[0].isDigit()) {
info(ctxt.object, "Property \"" + fieldCtxt.propName + "\" and element \"" + elementName + "\" have digit conflict, consider fixing it.");
sep = "_";
}
FieldContext elementCtxt;
elementCtxt.field = fieldCtxt.field;
elementCtxt.fieldName = fieldCtxt.fieldName + "_" + elementName;
elementCtxt.fieldType = fieldCtxt.fieldType;
elementCtxt.propName = fieldCtxt.propName + elementName;
elementCtxt.ucPropName = fieldCtxt.ucPropName + elementName;
elementCtxt.propName = fieldCtxt.propName + sep + elementName;
elementCtxt.ucPropName = fieldCtxt.ucPropName + sep + elementName;
elementCtxt.propType = fieldCtxt.propType;
elementCtxt.propRefType = fieldCtxt.propRefType;
// deprecation