Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 266a5fa5c6fe13fa4c422b72250ad30ec29550ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*******************************************************************************
 * Copyright (c) 2007, 2009 Symbian Software Systems and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Andrew Ferguson (Symbian) - Initial implementation
 *******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.c;

import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IFunction;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
import org.eclipse.cdt.internal.core.index.IIndexScope;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;

class CompositeCFunction extends CompositeCBinding implements IFunction {

	public CompositeCFunction(ICompositesFactory cf, IIndexFragmentBinding rbinding) {
		super(cf, rbinding);
	}

	public IScope getFunctionScope() throws DOMException {
		IScope scope= ((IFunction)rbinding).getFunctionScope();
		return cf.getCompositeScope((IIndexScope)scope);
	}
	
	public IParameter[] getParameters() throws DOMException {
		IParameter[] preResult = ((IFunction)rbinding).getParameters();
		IParameter[] result = new IParameter[preResult.length];
		for(int i=0; i<preResult.length; i++) {
			result[i] = (IParameter) cf.getCompositeBinding((IIndexFragmentBinding) preResult[i]);
		}
		return result;
	}
	
	public IFunctionType getType() throws DOMException {
		IType rtype = ((IFunction)rbinding).getType();
		return (IFunctionType) cf.getCompositeType(rtype);
	}

	public boolean isAuto() throws DOMException {
		return ((IFunction)rbinding).isAuto();
	}

	public boolean isExtern() throws DOMException {
		return ((IFunction)rbinding).isExtern();
	}

	public boolean isInline() throws DOMException {
		return ((IFunction)rbinding).isInline();
	}

	public boolean isRegister() throws DOMException {
		return ((IFunction)rbinding).isRegister();
	}

	public boolean isStatic() throws DOMException {
		return ((IFunction)rbinding).isStatic();
	}

	public boolean takesVarArgs() throws DOMException {
		return ((IFunction)rbinding).takesVarArgs();
	}
}

Back to the top