Search in sources :

Example 6 with ClassInfo

use of org.eclipse.linuxtools.cdt.libhover.ClassInfo in project linuxtools by eclipse.

the class CDoxygenLibhoverGen method getClassInfo.

private ClassInfo getClassInfo(LibHoverInfo libHoverInfo, String className) {
    // $NON-NLS-1$ //$NON-NLS-2$
    String typedefName = className.replaceAll("<.*>", "<>");
    TypedefInfo typedef = libHoverInfo.typedefs.get(typedefName);
    if (typedef != null) {
        // Reset class name to typedef transformation
        className = typedef.getTransformedType(className);
    }
    int index = className.indexOf('<');
    // Check if it is a template reference.
    if (index != -1) {
        // It is.  We want to see if there are partial specific templates
        // and we choose the first match.  If nothing matches our particular
        // case, we fall back on the initial generic template.
        ClassInfo info = libHoverInfo.classes.get(className.substring(0, index));
        if (info == null)
            return null;
        ArrayList<ClassInfo> children = info.getChildren();
        if (children != null && children.size() > 0) {
            for (int x = 0; x < children.size(); ++x) {
                ClassInfo child = children.get(x);
                if (className.matches(child.getClassName())) {
                    info = child;
                    break;
                }
            }
        }
        return info;
    }
    // Otherwise no template, just fetch the class info directly.
    return libHoverInfo.classes.get(className);
}
Also used : TypedefInfo(org.eclipse.linuxtools.cdt.libhover.TypedefInfo) ClassInfo(org.eclipse.linuxtools.cdt.libhover.ClassInfo)

Aggregations

ClassInfo (org.eclipse.linuxtools.cdt.libhover.ClassInfo)6 TypedefInfo (org.eclipse.linuxtools.cdt.libhover.TypedefInfo)5 ArrayList (java.util.ArrayList)3 MemberInfo (org.eclipse.linuxtools.cdt.libhover.MemberInfo)3 NamedNodeMap (org.w3c.dom.NamedNodeMap)2 Node (org.w3c.dom.Node)2 NodeList (org.w3c.dom.NodeList)2 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 ObjectOutputStream (java.io.ObjectOutputStream)1 DOMException (org.eclipse.cdt.core.dom.ast.DOMException)1 IType (org.eclipse.cdt.core.dom.ast.IType)1 IFunctionSummary (org.eclipse.cdt.ui.IFunctionSummary)1 CoreException (org.eclipse.core.runtime.CoreException)1 FunctionInfo (org.eclipse.linuxtools.cdt.libhover.FunctionInfo)1 LibHoverInfo (org.eclipse.linuxtools.cdt.libhover.LibHoverInfo)1