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

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


  private IASTName convertSimpleName(final SimpleName simpleName) {
    return f.newName(simpleName.getIdentifier().toCharArray());
  }

  private IASTName convertQualifiedName(final QualifiedName qualifiedName) {
    final ICPPASTQualifiedName iastQualifiedName = f.newQualifiedName();
    iastQualifiedName.addName(new NameInfo(qualifiedName.getQualifier()).name);
    iastQualifiedName.addName(new NameInfo(qualifiedName.getName()).name);
    return iastQualifiedName;
  }
View Full Code Here


  private static final CPPNodeFactory f = CPPNodeFactory.getDefault();
  private final ICPPASTFunctionDefinition definition;

  public FunctionDefinitionInfo(final MethodDeclaration methodDeclaration, final TypeDeclaration typeDeclaration, final TypeDeclarationInfo enclosingType, final CompilationUnitInfo compilationUnitInfo) {
    super(methodDeclaration, enclosingType, compilationUnitInfo);
    final ICPPASTQualifiedName qualifiedName = f.newQualifiedName();
    // for (String name : namespace) {
    // qualifiedName.addName(f.newName(name.toCharArray()));
    // }
    if (enclosingType != null) {
      qualifiedName.addName(new NameInfo(enclosingType.getName()).getName());
    }
    qualifiedName.addName(new NameInfo(typeDeclaration.getName()).getName());
    qualifiedName.addName(new NameInfo(methodDeclaration.getName()).getName());

    // Declarator use for function definition (cpp)
    functionDeclarator.setName(qualifiedName);

    // Method body
View Full Code Here

    }
  }

  private boolean needsTemplateQualifier(final ICPPASTTemplateId templId) {
    if (templId.getParent() instanceof ICPPASTQualifiedName) {
      final ICPPASTQualifiedName qName = (ICPPASTQualifiedName) templId.getParent();
      return isDependentName(qName, templId);
    }
    return false;
  }
View Full Code Here

    }
  }

  private IASTExpression convertSuperMethodInvocation(final SuperMethodInvocation superMethodInvocation) {
    final IMethodBinding methodBinding = superMethodInvocation.resolveMethodBinding();
    final ICPPASTQualifiedName qualifiedName = f.newQualifiedName();
    qualifiedName.addName(f.newName(methodBinding.getDeclaringClass().getName().toCharArray()));
    qualifiedName.addName(new NameInfo(superMethodInvocation.getName()).getName());
    final IASTExpression call = f.newIdExpression(qualifiedName);
    final List<IASTInitializerClause> initializerClauses = new ArrayList<IASTInitializerClause>();
    for (final Object argumentObject : superMethodInvocation.arguments()) {
      final ExpressionInfo argument = new ExpressionInfo((Expression) argumentObject, typeDeclaration, compilationUnitInfo);
      initializerClauses.add(argument.getExpression());
View Full Code Here

    final IBinding binding = simpleName.resolveBinding();
    final ITypeBinding typeBinding = simpleName.resolveTypeBinding();
    if (binding.getKind() == IBinding.VARIABLE) {
      final IVariableBinding variableBinding = (IVariableBinding) binding;
      if (variableBinding.isEnumConstant()) {
        final ICPPASTQualifiedName qualifiedName = f.newQualifiedName();
        qualifiedName.addName(f.newName(typeBinding.getName().toCharArray()));
        qualifiedName.addName(new NameInfo(simpleName).getName());
        return f.newIdExpression(qualifiedName);
      } else if (((variableBinding.getModifiers() & Modifier.STATIC) != 0) && ((variableBinding.getModifiers() & Modifier.FINAL) != 0)) {
        final ICPPASTQualifiedName qualifiedName = f.newQualifiedName();
        qualifiedName.addName(f.newName(variableBinding.getDeclaringClass().getName().toCharArray()));
        qualifiedName.addName(new NameInfo(simpleName).getName());
        return f.newIdExpression(qualifiedName);
      } else if (typeDeclaration != null) {
        final List<String> tokens = new NameInfo(typeDeclaration.getName()).tokenize();
        if ((variableBinding.getDeclaringClass() != null) && !variableBinding.getDeclaringClass().getName().equals(tokens.get(tokens.size() - 1))) {
          if (!typeDeclaration.resolveBinding().isSubTypeCompatible(variableBinding.getDeclaringClass())) {
View Full Code Here

    final IBinding binding = qualifiedName.resolveBinding();
    final ITypeBinding typeBinding = qualifiedName.resolveTypeBinding();
    if (binding.getKind() == IBinding.VARIABLE) {
      final IVariableBinding variableBinding = (IVariableBinding) binding;
      if (variableBinding.isEnumConstant()) {
        final ICPPASTQualifiedName qName = f.newQualifiedName();
        qName.addName(f.newName(typeBinding.getName().toCharArray()));
        qName.addName(new NameInfo(qualifiedName.getName()).getName());
        return f.newIdExpression(qName);
      } else if (((variableBinding.getModifiers() & Modifier.STATIC) != 0) && ((variableBinding.getModifiers() & Modifier.FINAL) != 0)) {
        final ICPPASTQualifiedName qName = f.newQualifiedName();
        qName.addName(f.newName(variableBinding.getDeclaringClass().getName().toCharArray()));
        qName.addName(new NameInfo(qualifiedName.getName()).getName());
        return f.newIdExpression(qName);
        // } else if (typeBinding.isEnum()) {
        // IASTIdExpression idExpression = f.newIdExpression(new NameInfo(simpleName).getName());
        // return f.newUnaryExpression(IASTUnaryExpression.op_star, idExpression);
      }
View Full Code Here

  private IASTExpression convertMethodInvocation(final MethodInvocation methodInvocation) {
    IASTExpression call;
    if (methodInvocation.getExpression() != null) {
      final IMethodBinding methodBinding = methodInvocation.resolveMethodBinding();
      if ((methodBinding != null) && ((methodBinding.getModifiers() & Modifier.STATIC) != 0)) {
        final ICPPASTQualifiedName qualifiedName = f.newQualifiedName();
        qualifiedName.addName(f.newName(methodBinding.getDeclaringClass().getName().toCharArray()));
        qualifiedName.addName(new NameInfo(methodInvocation.getName()).getName());
        call = f.newIdExpression(qualifiedName);
      } else {
        final Expression qualifier = methodInvocation.getExpression();
        final ICPPASTFieldReference fieldReference = f.newFieldReference(new NameInfo(methodInvocation.getName()).getName(), new ExpressionInfo(qualifier, typeDeclaration, compilationUnitInfo).getExpression());
        final ITypeBinding typeBinding = qualifier.resolveTypeBinding();
View Full Code Here

    }
    simple = true;

    final ITypeBinding typeBinding = type.resolveBinding();
    if (typeBinding.isNested()) {
      final ICPPASTQualifiedName qualifiedName = f.newQualifiedName();
      qualifiedName.addName(f.newName(typeBinding.getDeclaringClass().getName().toCharArray()));
      qualifiedName.addName(f.newName(typeBinding.getName().toCharArray()));
      compilationUnitInfo.hppIncludes.add(typeBinding.getDeclaringClass().getName());
      compilationUnitInfo.cppIncludes.add(typeBinding.getDeclaringClass().getName());
      name = qualifiedName;
    } else {
      final NameInfo nameInfo = new NameInfo(simpleType.getName());
View Full Code Here

TOP

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

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.