コード例 #1
0
 @Override
 public Object visit(ASTidentifier node, Object data) {
   builder
       .append(2, "k_")
       .append(GenerationUtils.asCPPToken(node.jjtGetFirstToken().toString()));
   return data;
 }
コード例 #2
0
 @Override
 public Object visit(ASTNamedNumber node, Object data) {
   wasSignedNumber = false;
   node.childrenAccept(this, data);
   if (!wasSignedNumber) {
     builder.append(",").newLine();
   }
   return data;
 }
コード例 #3
0
  @Override
  public Object visit(ASTEnumeratedType node, Object data) {
    // write value type
    builder.newLine();
    builder.append(1, "enum EnumeratedValue_Type").newLine();
    builder.append(1, "{").newLine();

    // write constants
    VisitorUtils.visitChildsAndAccept(builder, node, new EnumConstantsDeclaration());

    builder.append(1, "};").newLine();

    // write sequence value typedef
    builder.newLine();
    builder.append(1, "typedef EnumeratedValue_Type ValueType;").newLine();

    builder.newLine();
    builder
        .append(1, "void read(ASN1ValueReader& reader, ")
        .append("ValueType")
        .append("& value) const")
        .newLine();
    builder.append(1, "{").newLine();
    builder.append(2, context.getBaseTypeName()).append("::ValueType v;").newLine();
    builder.append(2, context.getBaseTypeName()).append("::read(reader, v);").newLine();
    builder.append(2, "value = static_cast<ValueType>(v);").newLine();
    builder.append(1, "}").newLine();
    builder.newLine();

    builder
        .append(1, "void write(ASN1ValueWriter& writer, const ")
        .append("ValueType")
        .append("& value) const")
        .newLine();
    builder.append(1, "{").newLine();
    builder.append(2, context.getBaseTypeName()).append("::write(writer, value);").newLine();
    builder.append(1, "}").newLine();

    return data;
  }
コード例 #4
0
 @Override
 public String getContent() {
   return builder.toString();
 }
コード例 #5
0
 @Override
 public Object visit(ASTSignedNumber node, Object data) {
   builder.append(" = ").append(node.getNumber()).append(",").newLine();
   wasSignedNumber = true;
   return data;
 }
コード例 #6
0
 @Override
 public boolean hasValuableContent() {
   return !builder.toString().isEmpty();
 }