You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// collect includes to avoid duplicatesSet<String> includes= newHashSet<String>();
for (intidx = 0; idx < aClass.getClassAttributes().size(); idx++) {
ClassAttributeanAttribute = (ClassAttribute) aClass.getClassAttributes().get(idx);
// If this attribute is a class, we need to do an import on that classif (anAttribute.getAttributeKind() == ClassAttribute.ClassAttributeType.CLASSREF) {
includes.add("#include <" + anAttribute.getType() + ".h>");
}
// If this attribute is a list with class type, we also need to do an import on that classif ((anAttribute.getAttributeKind() == ClassAttribute.ClassAttributeType.FIXED_LIST
|| anAttribute.getAttributeKind() == ClassAttribute.ClassAttributeType.VARIABLE_LIST)
&& !anAttribute.getUnderlyingTypeIsPrimitive()) {
includes.add("#include <" + anAttribute.getType() + ".h>");
}
// if this attribute is a variable-length list that holds a class, we need to// do an import on the class that is in the list.if (anAttribute.getAttributeKind() == ClassAttribute.ClassAttributeType.VARIABLE_LIST) {
hasVariableLengthList = true;
}
}
// print collected includesfor (Stringinclude : includes) {
pw.println(include);
}
If multiple class attributes are objects of the same class, the corresponding header is included multiple times.
See
xmlpg/src/main/java/edu/nps/moves/xmlpg/CppGenerator.java
Line 192 in 11f88b3
Possible solution: store includes in
Set<String>
.The text was updated successfully, but these errors were encountered: