mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 10:25:32 +02:00
toString method.
This commit is contained in:
parent
60d02ba145
commit
f0be726ff0
1 changed files with 86 additions and 67 deletions
|
@ -65,12 +65,14 @@ public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPI
|
||||||
throw new DOMException(this);
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final char[] EMPTY_CHAR_ARRAY = { };
|
private static final char[] EMPTY_CHAR_ARRAY = { };
|
||||||
|
|
||||||
IASTName[] namespaceDefinitions = null;
|
IASTName[] namespaceDefinitions = null;
|
||||||
ICPPNamespaceScope scope = null;
|
ICPPNamespaceScope scope = null;
|
||||||
|
|
||||||
ICPPASTTranslationUnit tu = null;
|
ICPPASTTranslationUnit tu = null;
|
||||||
|
|
||||||
public CPPNamespace(ICPPASTNamespaceDefinition nsDef) {
|
public CPPNamespace(ICPPASTNamespaceDefinition nsDef) {
|
||||||
findAllDefinitions(nsDef);
|
findAllDefinitions(nsDef);
|
||||||
if (namespaceDefinitions.length == 0) {
|
if (namespaceDefinitions.length == 0) {
|
||||||
|
@ -256,7 +258,7 @@ public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPI
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getPhysicalNode()
|
* @see org.eclipse.cdt.core.dom.ast.IBinding#getPhysicalNode()
|
||||||
*/
|
*/
|
||||||
public IASTNode getPhysicalNode() {
|
public IASTNode getPhysicalNode() {
|
||||||
return ( tu != null ? (IASTNode) tu : namespaceDefinitions[0] );
|
return tu != null ? (IASTNode) tu : namespaceDefinitions[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -344,4 +346,21 @@ public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPI
|
||||||
public ILinkage getLinkage() {
|
public ILinkage getLinkage() {
|
||||||
return Linkage.CPP_LINKAGE;
|
return Linkage.CPP_LINKAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
String[] names = getQualifiedName();
|
||||||
|
if (names.length == 0) {
|
||||||
|
return "<unnamed namespace>"; //$NON-NLS-1$
|
||||||
|
} else if (names.length == 1) {
|
||||||
|
return names[0];
|
||||||
|
} else {
|
||||||
|
StringBuilder buf = new StringBuilder(names[0]);
|
||||||
|
for (int i = 1; i < names.length; i++) {
|
||||||
|
buf.append("::"); //$NON-NLS-1$
|
||||||
|
buf.append(names[i]);
|
||||||
|
}
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue