~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTProblemOwner.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2011-10-06 21:15:04 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111006211504-8dutmljjih0zikfv
Tags: 8.0.1-1
* New upstream release.
* Split the JNI packages into a separate architecture dependent
  package and made eclipse-cdt architecture independent.
* Install JNI libraries into multiarch aware location
* Bumped Standards-Version to 3.9.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
 * Copyright (c) 2004, 2011 IBM Corporation and others.
 
3
 * All rights reserved. This program and the accompanying materials
 
4
 * are made available under the terms of the Eclipse Public License v1.0
 
5
 * which accompanies this distribution, and is available at
 
6
 * http://www.eclipse.org/legal/epl-v10.html
 
7
 *
 
8
 * Contributors:
 
9
 *    IBM - Initial API and implementation
 
10
 *    Markus Schorn (Wind River Systems)
 
11
 *******************************************************************************/
 
12
package org.eclipse.cdt.internal.core.dom.parser.c;
 
13
 
 
14
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
 
15
import org.eclipse.cdt.core.dom.ast.IASTProblem;
 
16
import org.eclipse.cdt.core.dom.ast.IASTProblemHolder;
 
17
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
 
18
 
 
19
/**
 
20
 * @author jcamelon
 
21
 */
 
22
abstract class CASTProblemOwner extends ASTNode implements IASTProblemHolder {
 
23
    
 
24
    private IASTProblem problem;
 
25
 
 
26
    public CASTProblemOwner() {
 
27
        }
 
28
 
 
29
        public CASTProblemOwner(IASTProblem problem) {
 
30
                setProblem(problem);
 
31
        }
 
32
 
 
33
        protected void copyBaseProblem(CASTProblemOwner copy, CopyStyle style) {
 
34
                copy.setProblem(problem == null ? null : problem.copy(style));
 
35
                copy.setOffsetAndLength(this);
 
36
        }
 
37
        
 
38
        public IASTProblem getProblem() {
 
39
        return problem;
 
40
    }
 
41
    
 
42
    public void setProblem(IASTProblem p) {
 
43
        assertNotFrozen();
 
44
        problem = p;
 
45
        if (p != null) {
 
46
                        p.setParent(this);
 
47
                        p.setPropertyInParent(PROBLEM);
 
48
                }
 
49
    }
 
50
    
 
51
        @Override
 
52
        public boolean accept( ASTVisitor action ){
 
53
        if( action.shouldVisitProblems ){
 
54
                    switch( action.visit( getProblem() ) ){
 
55
                    case ASTVisitor.PROCESS_ABORT : return false;
 
56
                    case ASTVisitor.PROCESS_SKIP  : return true;
 
57
                    default : break;
 
58
                }
 
59
                    switch( action.leave( getProblem() ) ){
 
60
                    case ASTVisitor.PROCESS_ABORT : return false;
 
61
                    case ASTVisitor.PROCESS_SKIP  : return true;
 
62
                    default : break;
 
63
                }
 
64
                }
 
65
        return true;
 
66
    }
 
67
}