/**
   * Creates a plain text representation of a typedef structure.
   *
   * @param field The 'typedeffed' structure.
   * @param indent The indentation to draw.
   * @param type The complete type.
   */
  private void drawTypedefStruct(MetaStruct field, String indent, MetaType type) {
    writer.write(indent + "struct " + field.getTypeName() + " {" + newLine);
    MetaField[] fields = field.getFields();

    for (int i = 0; i < fields.length; i++) {
      this.drawMetaField(fields[i], indent + tab, type);
    }
    writer.write(indent + "}");
  }
  /**
   * Creates a plain text representation of a structure.
   *
   * @param field The structure to create the plain text representation of.
   * @param indent The indentation to draw.
   * @param type The complete type.
   */
  private void drawStruct(MetaStruct field, String indent, MetaType type) {
    String typedefName = type.getFieldTypedefName(field);
    if (typedefName != null) {
      writer.write(indent + typedefName + " " + field.getName() + ";" + newLine + separator);
    } else {
      writer.write(indent + "struct " + field.getTypeName() + " {" + newLine);
      MetaField[] fields = field.getFields();

      for (int i = 0; i < fields.length; i++) {
        this.drawMetaField(fields[i], indent + tab, type);
      }
      writer.write(indent + "} " + field.getName() + ";" + newLine + separator);
    }
  }
Ejemplo n.º 3
0
  private void serializeStruct(
      StringWriter writer, String nestedFieldName, MetaStruct field, UserData data) {
    MetaField[] fields = field.getFields();

    for (int i = 0; i < fields.length; i++) {
      this.serializeType(
          writer, nestedFieldName + "." + fields[i].getName(), fields[i], data, true);
    }
  }