mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 21:05:37 +02:00
Cosmetics.
This commit is contained in:
parent
a61ff51c62
commit
cc20398075
1 changed files with 18 additions and 5 deletions
|
@ -25,13 +25,13 @@ import org.eclipse.cdt.core.index.IndexFilter;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For implementation sharing between PDOMCPPClassType and PDOMCPPClassSpecialization
|
* For implementation sharing between PDOMCPPClassType and PDOMCPPClassSpecialization
|
||||||
*/
|
*/
|
||||||
class PDOMClassUtil {
|
class PDOMClassUtil {
|
||||||
static class FieldCollector implements IPDOMVisitor {
|
static class FieldCollector implements IPDOMVisitor {
|
||||||
private final List<ICPPField> fields = new ArrayList<ICPPField>();
|
private final List<ICPPField> fields = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean visit(IPDOMNode node) throws CoreException {
|
public boolean visit(IPDOMNode node) throws CoreException {
|
||||||
if (node instanceof ICPPField) {
|
if (node instanceof ICPPField) {
|
||||||
|
@ -42,16 +42,19 @@ class PDOMClassUtil {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void leave(IPDOMNode node) throws CoreException {
|
public void leave(IPDOMNode node) throws CoreException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPField[] getFields() {
|
public ICPPField[] getFields() {
|
||||||
return fields.toArray(new ICPPField[fields.size()]);
|
return fields.toArray(new ICPPField[fields.size()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ConstructorCollector implements IPDOMVisitor {
|
static class ConstructorCollector implements IPDOMVisitor {
|
||||||
private final List<ICPPConstructor> fConstructors = new ArrayList<ICPPConstructor>();
|
private final List<ICPPConstructor> fConstructors = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean visit(IPDOMNode node) throws CoreException {
|
public boolean visit(IPDOMNode node) throws CoreException {
|
||||||
if (node instanceof ICPPConstructor) {
|
if (node instanceof ICPPConstructor) {
|
||||||
|
@ -68,9 +71,11 @@ class PDOMClassUtil {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void leave(IPDOMNode node) throws CoreException {
|
public void leave(IPDOMNode node) throws CoreException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPConstructor[] getConstructors() {
|
public ICPPConstructor[] getConstructors() {
|
||||||
return fConstructors.toArray(new ICPPConstructor[fConstructors.size()]);
|
return fConstructors.toArray(new ICPPConstructor[fConstructors.size()]);
|
||||||
}
|
}
|
||||||
|
@ -80,14 +85,17 @@ class PDOMClassUtil {
|
||||||
private final List<ICPPMethod> methods;
|
private final List<ICPPMethod> methods;
|
||||||
private final boolean acceptNonImplicit;
|
private final boolean acceptNonImplicit;
|
||||||
private final IndexFilter filter;
|
private final IndexFilter filter;
|
||||||
|
|
||||||
public MethodCollector(boolean acceptImplicit) {
|
public MethodCollector(boolean acceptImplicit) {
|
||||||
this(acceptImplicit, true);
|
this(acceptImplicit, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodCollector(boolean acceptImplicit, boolean acceptNonImplicit) {
|
public MethodCollector(boolean acceptImplicit, boolean acceptNonImplicit) {
|
||||||
this.methods = new ArrayList<ICPPMethod>();
|
this.methods = new ArrayList<>();
|
||||||
this.acceptNonImplicit= acceptNonImplicit;
|
this.acceptNonImplicit= acceptNonImplicit;
|
||||||
this.filter= acceptImplicit ? IndexFilter.ALL_DECLARED_OR_IMPLICIT : IndexFilter.ALL_DECLARED;
|
this.filter= acceptImplicit ? IndexFilter.ALL_DECLARED_OR_IMPLICIT : IndexFilter.ALL_DECLARED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean visit(IPDOMNode node) throws CoreException {
|
public boolean visit(IPDOMNode node) throws CoreException {
|
||||||
if (node instanceof ICPPMethod) {
|
if (node instanceof ICPPMethod) {
|
||||||
|
@ -100,25 +108,30 @@ class PDOMClassUtil {
|
||||||
}
|
}
|
||||||
return false; // don't visit the method
|
return false; // don't visit the method
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void leave(IPDOMNode node) throws CoreException {
|
public void leave(IPDOMNode node) throws CoreException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPMethod[] getMethods() {
|
public ICPPMethod[] getMethods() {
|
||||||
return methods.toArray(new ICPPMethod[methods.size()]);
|
return methods.toArray(new ICPPMethod[methods.size()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class NestedClassCollector implements IPDOMVisitor {
|
static class NestedClassCollector implements IPDOMVisitor {
|
||||||
private final List<IPDOMNode> nestedClasses = new ArrayList<IPDOMNode>();
|
private final List<IPDOMNode> nestedClasses = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean visit(IPDOMNode node) throws CoreException {
|
public boolean visit(IPDOMNode node) throws CoreException {
|
||||||
if (node instanceof ICPPClassType && !(node instanceof ICPPDeferredClassInstance))
|
if (node instanceof ICPPClassType && !(node instanceof ICPPDeferredClassInstance))
|
||||||
nestedClasses.add(node);
|
nestedClasses.add(node);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void leave(IPDOMNode node) throws CoreException {
|
public void leave(IPDOMNode node) throws CoreException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPClassType[] getNestedClasses() {
|
public ICPPClassType[] getNestedClasses() {
|
||||||
return nestedClasses.toArray(new ICPPClassType[nestedClasses.size()]);
|
return nestedClasses.toArray(new ICPPClassType[nestedClasses.size()]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue