public OffsetSortedKey(CsmOffsetableDeclaration declaration) { start = ((CsmOffsetable) declaration).getStartOffset(); name = Math.abs(declaration.getName().hashCode()); }
@Override public CharSequence getName() { return getTemplateDeclaration().getName(); }
private static CharSequence getName(CsmInstantiation inst) { StringBuilder sb = new StringBuilder(inst.getTemplateDeclaration().getName()); sb.append("<"); // NOI18N Map<CsmTemplateParameter, CsmSpecializationParameter> mapping = inst.getMapping(); boolean first = true; for (CsmTemplateParameter param : mapping.keySet()) { CsmSpecializationParameter specParam = mapping.get(param); if(CsmKindUtilities.isTypeBasedSpecalizationParameter(specParam)) { if(!first) { sb.append(","); // NOI18N } CsmType type = ((CsmTypeBasedSpecializationParameter)specParam).getType(); sb.append(type.getCanonicalText()); first = false; } } sb.append(">"); // NOI18N return sb; }
@SuppressWarnings("unchecked") @Override public void removeDeclaration(CsmOffsetableDeclaration declaration) { CsmUID<CsmOffsetableDeclaration> declarationUid; if (declaration.getName().length() == 0) { declarationUid = UIDs.get(declaration); unnamedDeclarations.remove(declarationUid); } else { getDeclarationsSorage().removeDeclaration(declaration); } // do not clean repository, it must be done from physical container of declaration if (false) { RepositoryUtils.remove(declarationUid, declaration); } // update repository RepositoryUtils.put(this); notify(declaration, NotifyEvent.DECLARATION_REMOVED); }
public CsmType resolveTemplateParameterType(CsmType type, CsmInstantiation instantiation) { if (CsmKindUtilities.isTemplateParameterType(type)) { if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Instantiation.resolveTemplateParameter {0}; mapping={1}\n", new Object[]{type.getText(), instantiation.getTemplateDeclaration().getName()}); } MapHierarchy<CsmTemplateParameter, CsmSpecializationParameter> mapping = new MapHierarchy<>(instantiation.getMapping()); CsmTemplateParameter param = ((CsmTemplateParameterType) type).getParameter(); if (param != null) { CsmType resolvedType = resolveTemplateParameterType(param, mapping); if (resolvedType != null) { return resolvedType; } } else { LOG.log(Level.INFO, "no param for " + type + " and \n" + instantiation, new IllegalStateException()); // NOI18N; } } return type; }
protected SortedName getSortedName(CsmOffsetableDeclaration d){ if( CsmKindUtilities.isClass(d) ) { return new SortedName(1,d.getName(),0); } else if( d.getKind() == CsmDeclaration.Kind.CLASS_FORWARD_DECLARATION ) { return new SortedName(1,d.getName(),0); } else if( d.getKind() == CsmDeclaration.Kind.ENUM ) { return new SortedName(1,d.getName(),1); } else if (d.getKind() == CsmDeclaration.Kind.ENUM_FORWARD_DECLARATION) { return new SortedName(1, d.getName(), 1); } else if( d.getKind() == CsmDeclaration.Kind.TYPEDEF ) { return new SortedName(1,d.getName(),2); } else if( d.getKind() == CsmDeclaration.Kind.VARIABLE ) { return new SortedName(2,d.getName(),0); } else if( d.getKind() == CsmDeclaration.Kind.FUNCTION ) { return new SortedName(3,CVUtil.getSignature((CsmFunction)d),0); } else if( d.getKind() == CsmDeclaration.Kind.FUNCTION_DEFINITION ) { return new SortedName(3,CVUtil.getSignature((CsmFunction)d),1); } else if( d.getKind() == CsmDeclaration.Kind.FUNCTION_FRIEND ) { return new SortedName(3,CVUtil.getSignature((CsmFunction)d),0); } else if( d.getKind() == CsmDeclaration.Kind.FUNCTION_FRIEND_DEFINITION ) { return new SortedName(3,CVUtil.getSignature((CsmFunction)d),1); } return new SortedName(9,d.getName(),0); }
public static PersistentKey createKey(CsmOffsetableDeclaration decl){ CharSequence name = decl.getName(); CharSequence uniq = decl.getUniqueName(); CsmProject project = decl.getContainingFile().getProject(); if (name.length() > 0 && CharSequences.indexOf(uniq, "::::") < 0 && project != null){ // NOI18N return new PersistentKey(uniq, project, DECLARATION); } else { //System.out.println("Skip "+uniq); } // obtain UID directly without "null-check", because notificator works // in separate thread which can be run after closed project return new PersistentKey(UIDProviderIml.get(decl, false)); }
if (nameAcceptor.accept(decl.getName())) { if(CsmVisibilityQuery.isVisible(decl)) { symbols.add(new CppSymbolDescriptor(decl));
CsmOffsetableDeclaration decl = it.next(); if (CsmKindUtilities.isVariable(decl)) { CharSequence varName = decl.getName(); if (fromUnnamedNamespace || (anyVariable || CsmKindUtilities.isFileLocalVariable(decl))) { if (varName.length() != 0) {
while (declarations.hasNext() && !cancelled.get()) { CsmOffsetableDeclaration decl = declarations.next(); if (nameAcceptor.accept(decl.getName())) { if (CsmKindUtilities.isFunctionDefinition(decl) && ((CsmFunction)decl).isStatic()) { CsmFunction func = (CsmFunction) decl;
if (nameAcceptor.accept(decl.getName())) { if (CsmKindUtilities.isFunction(decl)) {
protected boolean canCreateNode(CsmOffsetableDeclaration d) { if (d.getName().length() > 0) { if( CsmKindUtilities.isClass(d) ) { CsmClass cls = (CsmClass) d;
LOG.log(Level.FINE, "Instantiation.createType {0}; inst:{1}\n", new Object[]{type.getText(), instantiation.getTemplateDeclaration().getName()});
CharSequence name = decl.getName(); CharSequence uniq = decl.getUniqueName(); CsmScope scope = decl.getScope();
if (updater != null) { if (d.getName().length() > 0) { if( CsmKindUtilities.isClass(d) ) { CsmClass cls = (CsmClass) d;