mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
GCS\ObjectGenerator (more) Minor changes on the way named arrays are implemented
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@537 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
56f88a6a79
commit
22251f195d
@ -362,13 +362,14 @@ QString UAVObjectParser::processObjectFields(QDomNode& childNode, ObjectInfo* in
|
||||
}
|
||||
field->elementNames = names;
|
||||
field->numElements = names.length();
|
||||
field->defaultElementNames = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
elemAttr = elemAttributes.namedItem("elements");
|
||||
if ( elemAttr.isNull() )
|
||||
{
|
||||
return QString("Object:field:elements attribute is missing");
|
||||
return QString("Object:field:elements and Object:field:elementnames attribute is missing");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -377,6 +378,7 @@ QString UAVObjectParser::processObjectFields(QDomNode& childNode, ObjectInfo* in
|
||||
{
|
||||
field->elementNames.append(QString("%1").arg(n));
|
||||
}
|
||||
field->defaultElementNames = true;
|
||||
}
|
||||
}
|
||||
// Get options attribute (only if an enum type)
|
||||
@ -596,7 +598,7 @@ bool UAVObjectParser::generateFlightObject(int objIndex, const QString& template
|
||||
.arg( info->fields[n]->name ) );
|
||||
}
|
||||
// Generate element names (only if field has more than one element)
|
||||
if (info->fields[n]->numElements > 1)
|
||||
if (info->fields[n]->numElements > 1 && !info->fields[n]->defaultElementNames)
|
||||
{
|
||||
enums.append(QString("/* Array element names for field %1 */\n").arg(info->fields[n]->name));
|
||||
enums.append("typedef enum { ");
|
||||
@ -728,7 +730,7 @@ bool UAVObjectParser::generateGCSObject(int objIndex, const QString& templateInc
|
||||
.arg( info->fields[n]->name ) );
|
||||
}
|
||||
// Generate element names (only if field has more than one element)
|
||||
if (info->fields[n]->numElements > 1)
|
||||
if (info->fields[n]->numElements > 1 && !info->fields[n]->defaultElementNames)
|
||||
{
|
||||
enums.append(QString(" /* Array element names for field %1 */\n").arg(info->fields[n]->name));
|
||||
enums.append(" typedef enum { ");
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
int numElements;
|
||||
QStringList elementNames;
|
||||
QStringList options; // for enums only
|
||||
bool defaultElementNames;
|
||||
} FieldInfo;
|
||||
|
||||
typedef struct {
|
||||
|
@ -52,8 +52,6 @@ public:
|
||||
} __attribute__((packed)) DataFields;
|
||||
|
||||
// Enumeration types
|
||||
/* Array element names for field Field4 */
|
||||
typedef enum { FIELD4_0=0, FIELD4_1=1, FIELD4_2=2, FIELD4_3=3, } Field4Elem;
|
||||
/* Enumeration options for field Field8 */
|
||||
typedef enum { FIELD8_OPTION1=0, FIELD8_OPTION2=1, } Field8Options;
|
||||
|
||||
|
@ -48,8 +48,6 @@ public:
|
||||
} __attribute__((packed)) DataFields;
|
||||
|
||||
// Enumeration types
|
||||
/* Array element names for field Field4 */
|
||||
typedef enum { FIELD4_0=0, FIELD4_1=1, FIELD4_2=2, FIELD4_3=3, } Field4Elem;
|
||||
|
||||
|
||||
// Constants
|
||||
|
Loading…
x
Reference in New Issue
Block a user