Package org.eclipse.cdt.core.dom.ast.cpp

Examples of org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleDeclSpecifier


  }

  private IASTStatement convertEnhancedForStatement(final EnhancedForStatement enhancedForStatement) {
    final ICPPASTRangeBasedForStatement rangeBased = f.newRangeBasedForStatement();

    final ICPPASTSimpleDeclSpecifier declSpecifier = f.newSimpleDeclSpecifier();
    declSpecifier.setStorageClass(IASTDeclSpecifier.sc_auto);
    final IASTSimpleDeclaration declaration = f.newSimpleDeclaration(declSpecifier);

    final SingleVariableDeclarationInfo parameter = new SingleVariableDeclarationInfo(enhancedForStatement.getParameter(), compilationUnitInfo);
    final ICPPASTDeclarator declarator = parameter.getDeclarator();
    for (int i = 0; i < declarator.getPointerOperators().length; i++) {
View Full Code Here


    final ICPPASTTemplateId templateId = f.newTemplateId(name);
    return f.newTypedefNameSpecifier(templateId);
  }

  private ICPPASTDeclSpecifier convertPrimitiveType(final PrimitiveType primitiveType) {
    final ICPPASTSimpleDeclSpecifier simpleDeclSpecifier = f.newSimpleDeclSpecifier();
    if (primitiveType.getPrimitiveTypeCode().equals(PrimitiveType.VOID)) {
      simpleDeclSpecifier.setType(IBasicType.Kind.eVoid);
      return simpleDeclSpecifier;
    }
    if (primitiveType.getPrimitiveTypeCode().equals(PrimitiveType.BOOLEAN)) {
      javaDefaultValue = f.newLiteralExpression(IASTLiteralExpression.lk_false, "false");
      simpleDeclSpecifier.setType(IBasicType.Kind.eBoolean);
      return simpleDeclSpecifier;
    }
    if (primitiveType.getPrimitiveTypeCode().equals(PrimitiveType.CHAR)) {
      javaDefaultValue = f.newLiteralExpression(IASTLiteralExpression.lk_char_constant, "\0");
      simpleDeclSpecifier.setType(IBasicType.Kind.eChar);
      return simpleDeclSpecifier;
    }
    if (primitiveType.getPrimitiveTypeCode().equals(PrimitiveType.FLOAT)) {
      javaDefaultValue = f.newLiteralExpression(IASTLiteralExpression.lk_float_constant, "0");
      simpleDeclSpecifier.setType(IBasicType.Kind.eFloat);
      return simpleDeclSpecifier;
    }
    if (primitiveType.getPrimitiveTypeCode().equals(PrimitiveType.DOUBLE)) {
      javaDefaultValue = f.newLiteralExpression(IASTLiteralExpression.lk_float_constant, "0");
      simpleDeclSpecifier.setType(IBasicType.Kind.eDouble);
      return simpleDeclSpecifier;
    }
    javaDefaultValue = f.newLiteralExpression(IASTLiteralExpression.lk_integer_constant, "0");
    compilationUnitInfo.hppStdIncludes.add("cstdint");
    compilationUnitInfo.cppStdIncludes.add("cstdint");
View Full Code Here

    }
    throw new IllegalStateException("Unsupported primitive type: " + primitiveType);
  }

  private ICPPASTDeclSpecifier convertSimpleType(final SimpleType simpleType) {
    final ICPPASTSimpleDeclSpecifier simpleDeclSpecifier = f.newSimpleDeclSpecifier();
    if (simpleType.getName().isSimpleName()) {
      final SimpleName simpleName = (SimpleName) simpleType.getName();

      if (simpleName.getIdentifier().equals(Void.class.getName())) {
        simpleDeclSpecifier.setType(IBasicType.Kind.eVoid);
        return simpleDeclSpecifier;
      }
      if (simpleName.getIdentifier().equals(Boolean.class.getSimpleName())) {
        javaDefaultValue = f.newLiteralExpression(IASTLiteralExpression.lk_false, "false");
        simpleDeclSpecifier.setType(IBasicType.Kind.eBoolean);
        return simpleDeclSpecifier;
      }
      if (simpleName.getIdentifier().equals(Character.class.getSimpleName())) {
        javaDefaultValue = f.newLiteralExpression(IASTLiteralExpression.lk_char_constant, "\0");
        simpleDeclSpecifier.setType(IBasicType.Kind.eChar);
        return simpleDeclSpecifier;
      }
      if (simpleName.getIdentifier().equals(Float.class.getSimpleName())) {
        javaDefaultValue = f.newLiteralExpression(IASTLiteralExpression.lk_float_constant, "0");
        simpleDeclSpecifier.setType(IBasicType.Kind.eFloat);
        return simpleDeclSpecifier;
      }
      if (simpleName.getIdentifier().equals(Double.class.getSimpleName())) {
        javaDefaultValue = f.newLiteralExpression(IASTLiteralExpression.lk_float_constant, "0");
        simpleDeclSpecifier.setType(IBasicType.Kind.eDouble);
        return simpleDeclSpecifier;
      }
      if (simpleName.getIdentifier().equals(Byte.class.getSimpleName())) {
        javaDefaultValue = f.newLiteralExpression(IASTLiteralExpression.lk_integer_constant, "0");
        compilationUnitInfo.hppStdIncludes.add("cstdint");
View Full Code Here

TOP

Related Classes of org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleDeclSpecifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.