1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

Patch for Dave Daoust: Fixes up the string demangling in IEntryResult + IndexerView

This commit is contained in:
Bogdan Gheorghe 2005-06-14 19:52:17 +00:00
parent ebffc66e0d
commit fae118c182
4 changed files with 43 additions and 6 deletions

View file

@ -28,6 +28,8 @@ public interface IEntryResult {
public int getRefKind();
public String getName();
public String getDisplayString();
public String getStringMetaKind();
public String getStringKind();
public String getStringRefKind();

View file

@ -196,5 +196,38 @@ public String getStringRefKind() {
return String.valueOf(ICIndexStorageConstants.encodingTypes[reftype]);
}
public String getDisplayString() {
switch (meta_type) {
case IIndex.FUNCTION:
case IIndex.METHOD:
int startReturn = longname.indexOf(")R/"); //$NON-NLS-1$
int finishReturn = longname.indexOf("/R("); //$NON-NLS-1$
int startParam = longname.indexOf(")/"); //$NON-NLS-1$
int finishParam = longname.indexOf("/("); //$NON-NLS-1$
String functionName;
String arguments = longname.substring(startParam + 2, finishParam);
// TODO: flip arguments
arguments = arguments.replace('/',',');
arguments = '(' + arguments + ')';
if (startReturn == -1 || finishReturn == -1) {
// there is no return type !!!
functionName = longname.substring(0, startParam -1);
return functionName + arguments ;
}
else {
String returnType = longname.substring(startReturn + 3, finishReturn);
functionName = longname.substring(0, startReturn -1);
return functionName + arguments + ':' + returnType;
}
default:
return longname;
}
}
}

View file

@ -59,7 +59,8 @@ public class IndexerNodeLeaf implements IAdaptable {
private class IndexerPropertySource implements IPropertySource {
private static final String IENTRYRESULT = "IEntryResult"; //$NON-NLS-1$
private static final String NAME = "Name"; //$NON-NLS-1$
private static final String NAME = "Encoded Name"; //$NON-NLS-1$
private static final String DNAME = "Display Name"; //$NON-NLS-1$
private static final String IENTRYRESULT_GETWORD__ = "IEntryResult#getWord()"; //$NON-NLS-1$
private static final String REFS = "References"; //$NON-NLS-1$
private static final String OFFSETS_LINE = "Line "; //$NON-NLS-1$
@ -111,7 +112,11 @@ public class IndexerNodeLeaf implements IAdaptable {
text = new TextPropertyDescriptor(new TextDescriptorId(NAME, entryResult.getName()), NAME);
text.setCategory(IENTRYRESULT);
descriptors = (IPropertyDescriptor[])ArrayUtil.append(IPropertyDescriptor.class, descriptors, text);
text = new TextPropertyDescriptor(new TextDescriptorId(DNAME, entryResult.getDisplayString()), DNAME);
text.setCategory(IENTRYRESULT);
descriptors = (IPropertyDescriptor[])ArrayUtil.append(IPropertyDescriptor.class, descriptors, text);
// add IEntryResult
text = new TextPropertyDescriptor(new TextDescriptorId("MetaKind", entryResult.getStringMetaKind()), "MetaKind");
text.setCategory(IENTRYRESULT);
@ -174,7 +179,7 @@ public class IndexerNodeLeaf implements IAdaptable {
if (!parent.isDisplayFullName())
return getShortName();
return getName();
return result.getDisplayString();
}
public int getFiltersType() {

View file

@ -73,9 +73,6 @@ public class IndexerViewPluginImages {
"union_obj.gif",
"derived.gif",
"friend.gif",
"fwd_class.gif",
"fwd_struct.gif",
"fwd_union.gif",
"include_obj.gif"
};