summaryrefslogtreecommitdiffstats
path: root/languages/java/javasupport_utils.cpp
blob: f3c00904f08bb6e13b8efec4d08203b9b1793d31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

#include "javasupport_utils.h"
#include <codemodel.h>

static void typeNameList( TQStringList& path, TQStringList & lst, const CodeModel * model );
static void typeNameList( TQStringList& path, TQStringList & lst, NamespaceDom ns );
static void typeNameList( TQStringList & path, TQStringList & lst, ClassDom klass );

TQStringList typeNameList( const CodeModel* model )
{
    TQStringList lst;
    TQStringList path;
    typeNameList( path, lst, model );
    return lst;
}

static void typeNameList( TQStringList& path, TQStringList & lst, const CodeModel * model )
{
    const FileList fileList = model->fileList();
    for( FileList::ConstIterator it=fileList.begin(); it!=fileList.end(); ++it )
       typeNameList( path, lst, model_cast<NamespaceDom>(*it) );
}

static void typeNameList( TQStringList& path, TQStringList & lst, NamespaceDom ns )
{
    if( !ns->isFile() )
        path.push_back( ns->name() );

    const NamespaceList namespaceList = ns->namespaceList();
    for( NamespaceList::ConstIterator it=namespaceList.begin(); it!=namespaceList.end(); ++it )
       typeNameList( path, lst, *it );

    const ClassList classList = ns->classList();
    for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it )
       typeNameList( path, lst, *it );

    if( !ns->isFile() )
        path.pop_back();
}

static void typeNameList( TQStringList & path, TQStringList & lst, ClassDom klass )
{
    path.push_back( klass->name() );

    lst << path.join( "::" );

    const ClassList classList = klass->classList();
    for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it )
       typeNameList( path, lst, *it );
    path.pop_back();
}