1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-29 03:45:35 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2013-10-21 15:39:29 -07:00
parent d722e6d367
commit d2b9c42395
2 changed files with 24 additions and 26 deletions

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Andrew Ferguson (Symbian) - Initial implementation * Andrew Ferguson (Symbian) - Initial implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite; package org.eclipse.cdt.internal.core.index.composite;
@ -18,20 +18,21 @@ import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
import org.eclipse.cdt.internal.core.index.IIndexScope; import org.eclipse.cdt.internal.core.index.IIndexScope;
public interface ICompositesFactory { public interface ICompositesFactory {
public IIndexScope getCompositeScope(IIndexScope rscope); public IIndexScope getCompositeScope(IIndexScope rscope);
/** /**
* Returns a composite (in the sense of potentially spanning multiple index fragments - i.e. not to be confused * Returns a composite (in the sense of potentially spanning multiple index fragments -
* with ICompositeType) type for the specified type. * i.e. not to be confused with ICompositeType) type for the specified type.
*/ */
public IType getCompositeType(IType rtype); public IType getCompositeType(IType rtype);
/** /**
* Returns a composite (index context carrying) binding for the specified binding. It does not * Returns a composite (index context carrying) binding for the specified binding. It does not
* matter which fragment the specified binding comes from * matter which fragment the specified binding comes from.
* @param binding a binding that will be used when searching for information to return from the composite *
* binding methods * @param binding a binding that will be used when searching for information to return from
* the composite binding methods
* @return a composite (index context carrying) binding for the specified binding * @return a composite (index context carrying) binding for the specified binding
*/ */
public IIndexBinding getCompositeBinding(IIndexFragmentBinding binding); public IIndexBinding getCompositeBinding(IIndexFragmentBinding binding);

View file

@ -6,13 +6,10 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom; package org.eclipse.cdt.internal.core.pdom.dom;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.index.IIndexFile; import org.eclipse.cdt.core.index.IIndexFile;
import org.eclipse.cdt.core.index.IIndexMacro; import org.eclipse.cdt.core.index.IIndexMacro;
@ -24,25 +21,28 @@ import org.eclipse.cdt.internal.core.index.IIndexScope;
import org.eclipse.cdt.internal.core.pdom.db.Database; import org.eclipse.cdt.internal.core.pdom.db.Database;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import java.util.ArrayList;
import java.util.List;
/** /**
* A container collecting definitions and references for macros. * A container collecting definitions and references for macros.
* @since 5.0 * @since 5.0
*/ */
public class PDOMMacroContainer extends PDOMNamedNode implements IIndexMacroContainer, IPDOMBinding { public class PDOMMacroContainer extends PDOMNamedNode implements IIndexMacroContainer, IPDOMBinding {
private static final int FIRST_DEF_OFFSET = PDOMNamedNode.RECORD_SIZE + 0; // size 4 private static final int FIRST_DEF_OFFSET = PDOMNamedNode.RECORD_SIZE + 0; // size 4
private static final int FIRST_REF_OFFSET = PDOMNamedNode.RECORD_SIZE + 4; // size 4 private static final int FIRST_REF_OFFSET = PDOMNamedNode.RECORD_SIZE + 4; // size 4
@SuppressWarnings("hiding") @SuppressWarnings("hiding")
protected static final int RECORD_SIZE = PDOMNamedNode.RECORD_SIZE + 8; protected static final int RECORD_SIZE = PDOMNamedNode.RECORD_SIZE + 8;
public PDOMMacroContainer(PDOMLinkage linkage, char[] name) throws CoreException { public PDOMMacroContainer(PDOMLinkage linkage, char[] name) throws CoreException {
super(linkage, linkage, name); super(linkage, linkage, name);
} }
PDOMMacroContainer(PDOMLinkage linkage, long record) { PDOMMacroContainer(PDOMLinkage linkage, long record) {
super(linkage, record); super(linkage, record);
} }
@Override @Override
public int getNodeType() { public int getNodeType() {
return IIndexBindingConstants.MACRO_CONTAINER; return IIndexBindingConstants.MACRO_CONTAINER;
@ -52,7 +52,7 @@ public class PDOMMacroContainer extends PDOMNamedNode implements IIndexMacroCont
protected int getRecordSize() { protected int getRecordSize() {
return RECORD_SIZE; return RECORD_SIZE;
} }
public boolean isOrphaned() throws CoreException { public boolean isOrphaned() throws CoreException {
Database db = getDB(); Database db = getDB();
return db.getRecPtr(record + FIRST_DEF_OFFSET) == 0 return db.getRecPtr(record + FIRST_DEF_OFFSET) == 0
@ -67,7 +67,7 @@ public class PDOMMacroContainer extends PDOMNamedNode implements IIndexMacroCont
} }
setFirstDefinition(name); setFirstDefinition(name);
} }
public void addReference(PDOMMacroReferenceName name) throws CoreException { public void addReference(PDOMMacroReferenceName name) throws CoreException {
PDOMMacroReferenceName first = getFirstReference(); PDOMMacroReferenceName first = getFirstReference();
if (first != null) { if (first != null) {
@ -76,22 +76,22 @@ public class PDOMMacroContainer extends PDOMNamedNode implements IIndexMacroCont
} }
setFirstReference(name); setFirstReference(name);
} }
public PDOMMacro getFirstDefinition() throws CoreException { public PDOMMacro getFirstDefinition() throws CoreException {
long namerec = getDB().getRecPtr(record + FIRST_DEF_OFFSET); long namerec = getDB().getRecPtr(record + FIRST_DEF_OFFSET);
return namerec != 0 ? new PDOMMacro(getLinkage(), namerec) : null; return namerec != 0 ? new PDOMMacro(getLinkage(), namerec) : null;
} }
void setFirstDefinition(PDOMMacro macro) throws CoreException { void setFirstDefinition(PDOMMacro macro) throws CoreException {
long namerec = macro != null ? macro.getRecord() : 0; long namerec = macro != null ? macro.getRecord() : 0;
getDB().putRecPtr(record + FIRST_DEF_OFFSET, namerec); getDB().putRecPtr(record + FIRST_DEF_OFFSET, namerec);
} }
public PDOMMacroReferenceName getFirstReference() throws CoreException { public PDOMMacroReferenceName getFirstReference() throws CoreException {
long namerec = getDB().getRecPtr(record + FIRST_REF_OFFSET); long namerec = getDB().getRecPtr(record + FIRST_REF_OFFSET);
return namerec != 0 ? new PDOMMacroReferenceName(getLinkage(), namerec) : null; return namerec != 0 ? new PDOMMacroReferenceName(getLinkage(), namerec) : null;
} }
void setFirstReference(PDOMMacroReferenceName nextName) throws CoreException { void setFirstReference(PDOMMacroReferenceName nextName) throws CoreException {
long namerec = nextName != null ? nextName.getRecord() : 0; long namerec = nextName != null ? nextName.getRecord() : 0;
getDB().putRecPtr(record + FIRST_REF_OFFSET, namerec); getDB().putRecPtr(record + FIRST_REF_OFFSET, namerec);
@ -119,9 +119,6 @@ public class PDOMMacroContainer extends PDOMNamedNode implements IIndexMacroCont
return IIndexBindingConstants.MACRO_CONTAINER; return IIndexBindingConstants.MACRO_CONTAINER;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.index.IIndexFragmentBinding#getFragment()
*/
@Override @Override
public IIndexFragment getFragment() { public IIndexFragment getFragment() {
return getPDOM(); return getPDOM();