@Override public CharSequence getClassifierText() { return clazz.getName(); }
@Override public CsmScope getScope() { if (clazz != null) { return clazz.getScope(); } return null; }
@Override public CsmDeclaration.Kind getKind() { if (clazz != null) { return clazz.getKind(); } return kind; }
public SimpleClass(CsmClassifier clazz) { this.clazz = clazz; this.name = clazz.getName(); this.fullName = clazz.getQualifiedName(); }
@SuppressWarnings("unchecked") public CppTypeDescriptor(CsmClassifier classifier) { uid = UIDs.get(classifier); kind = classifier.getKind(); modifiers = CsmUtilities.getModifiers(classifier); if( CsmKindUtilities.isOffsetable(classifier) ) { simpleName = ((CsmTemplate)classifier).getDisplayName().toString(); } else { simpleName = classifier.getName().toString(); CsmScope scope = classifier.getScope(); if( CsmKindUtilities.isClass(scope) ) { CsmClass cls = ((CsmClass) scope);
@Override public CharSequence getQualifiedName() { if (clazz != null) { return clazz.getQualifiedName(); } if (fullName == null) { fullName = (packageName.length() > 0) ? (packageName + "." + name) : name; // NOI18N } return fullName; }
CsmClassifier classifier = returnType.getClassifier(); if (classifier != null) { String toReplace = classifier.getName().toString(); if (type.indexOf(toReplace) == 0) { CsmScope scope = classifier.getScope(); if (CsmKindUtilities.isClass(scope)) { type = ((CsmClass)scope).getName()+"::"+type; //NOI18N CsmScope scope = classifier.getScope(); if (CsmKindUtilities.isClass(scope)) { type = "const "+((CsmClass)scope).getName()+"::"+type.substring(6); //NOI18N
CsmClassifier declCls = declSpecParam.getClassifier(); if (declCls != null && !CsmKindUtilities.isTemplateParameter(declCls)) { String declClsQualifiedName = declCls.getQualifiedName().toString(); if (declClsQualifiedName.equals(paramsText.get(i))) { match += 2; } else if (declCls.isValid()) { final Set<String> nestedQualifiedNames = getNestedTypeNames(instSpecParam); int matchValue = 0;
validCandidate = (cls != null && cls.isValid()); if (retType != null && !validCandidate && ctx.getContextScope() != null) { List<CsmInstantiation> instantiations = null;
/*package*/static void dumpProjectClassifierContainer(ProjectBase project, PrintStream printStream, boolean offsetString) { ClassifierContainer container = project.getClassifierSorage(); for (int phase = 0; phase < 3; phase++) { Map<CharSequence, CsmClassifier> map = null; switch (phase) { case 0: printStream.printf("\n========== Dumping %s Project Classifiers\n", project.getName());//NOI18N map = container.getTestClassifiers(); break; case 1: printStream.printf("\n========== Dumping %s Project Short Classifiers\n", project.getName());//NOI18N map = container.getTestShortClassifiers(); break; case 2: printStream.printf("\n========== Dumping %s Project Typedefs\n", project.getName());//NOI18N map = container.getTestTypedefs(); break; } for (Map.Entry<CharSequence, CsmClassifier> entry : map.entrySet()) { printStream.print("\t" + entry.getKey().toString() + " ");//NOI18N CsmClassifier value = entry.getValue(); if (value == null) { printStream.println("null");//NOI18N } else { String pos = offsetString ? CsmTracer.getOffsetString(value, true) : "";//NOI18N printStream.printf("%s %s\n", value.getUniqueName(), pos);//NOI18N } } } }
public int compareTo(Object o) { if (this == o) { return 0; } CsmType t = (CsmType) o; int order = clazz.getQualifiedName().toString().compareTo(t.getClassifier().getQualifiedName().toString()); if (order == 0) { order = arrayDepth - t.getArrayDepth(); } return order; }
CsmClassifier classifier = returnType.getClassifier(); if (classifier != null) { String toReplace = classifier.getName().toString(); if (type.indexOf(toReplace) == 0) { CsmScope scope = classifier.getScope(); if (CsmKindUtilities.isClass(scope)) { type = ((CsmClass)scope).getName()+"::"+type; //NOI18N CsmScope scope = classifier.getScope(); if (CsmKindUtilities.isClass(scope)) { type = "const "+((CsmClass)scope).getName()+"::"+type.substring(6); //NOI18N
private static String formatType(CsmType type, boolean useFullName, boolean appendDblComma, boolean appendStar) { StringBuilder sb = new StringBuilder(); if (type != null && type.getClassifier() != null) { // sb.append(type.format(useFullName)); sb.append(useFullName ? type.getClassifier().getQualifiedName() : type.getClassifier().getName()); } if (appendDblComma) { sb.append(CsmCompletion.SCOPE); } if (appendStar) { sb.append('*'); //NOI18N } return sb.toString(); }
@Override public final Collection<CsmClassifier> findClassifiers(CharSequence qualifiedName) { CsmClassifier result = getClassifierSorage().getClassifier(qualifiedName); Collection<CsmClassifier> out = new ArrayList<>(); //Collection<CsmClassifier> out = new LazyCsmCollection<CsmClassifier, CsmClassifier>(new ArrayList<CsmUID<CsmClassifier>>(), TraceFlags.SAFE_UID_ACCESS); if (result != null) { if (CsmKindUtilities.isBuiltIn(result)) { return Collections.<CsmClassifier>singletonList(result); } CharSequence[] allClassifiersUniqueNames = Utils.getAllClassifiersUniqueNames(result.getUniqueName()); Collection<CsmClassifier> fwds = new ArrayList<>(1); for (CharSequence curUniqueName : allClassifiersUniqueNames) { Collection<? extends CsmDeclaration> decls = this.findDeclarations(curUniqueName); @SuppressWarnings("unchecked") Collection<CsmClassifier> classifiers = (Collection<CsmClassifier>) decls; for (CsmClassifier csmClassifier : classifiers) { if (ForwardClass.isForwardClass(csmClassifier)) { fwds.add(csmClassifier); } else { out.add(csmClassifier); } } } // All forwards move at the end out.addAll(fwds); } return out; }
@Override public final CharSequence getName() { if (clazz != null) { return clazz.getName(); } return name; }
sb.append(CsmInstantiationProvider.getDefault().getTemplateSignature(((CsmTemplate)classifier))); } else { sb.append(classifier.getQualifiedName());
public CsmNamespace _getClassNamespace(CsmClassifier cls) { CsmScope scope = cls.getScope(); while (scope != null) { if (CsmKindUtilities.isNamespace(scope)) { return (CsmNamespace) scope; } if (CsmKindUtilities.isScopeElement(scope)) { scope = ((CsmScopeElement) scope).getScope(); } else { break; } } return null; }
public static boolean isPrimitiveClass(CsmClassifier c) { return c.getKind() == CsmDeclaration.Kind.BUILT_IN; } //====================
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof CsmClassifier) { CsmClassifier c = (CsmClassifier) o; String className = (c.getName() == null) ? null : c.getName().toString().replace('.', '$'); String thisName = name.toString().replace('.', '$'); return thisName.equals(className);//XXX && packageName.equals(c.getPackageName()); } return false; }
public static boolean checkTypesEqual(CsmType type1, CsmFile contextFile1, CsmType type2, CsmFile contextFile2, QualifiersEqualizer qualsEqualizer) { if (type1 != null && type2 != null) { if (!qualsEqualizer.areQualsEqual(type1, type2)) { return false; } boolean resolveTypeChain = false; for (int i = 0; i < 2; i++) { CsmClassifier tbsp1Cls = getClassifier(type1, contextFile1, resolveTypeChain); if (tbsp1Cls != null) { CsmClassifier tbsp2Cls = getClassifier(type2, contextFile2, resolveTypeChain); if (tbsp2Cls != null) { if (tbsp1Cls.getQualifiedName().toString().equals(tbsp2Cls.getQualifiedName().toString())) { return true; } } } resolveTypeChain = true; if (contextFile1 == null && contextFile2 == null) { break; } } } return false; }