summaryrefslogtreecommitdiffstats
path: root/languages/java/javasupport_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'languages/java/javasupport_utils.cpp')
-rw-r--r--languages/java/javasupport_utils.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/languages/java/javasupport_utils.cpp b/languages/java/javasupport_utils.cpp
new file mode 100644
index 00000000..1fa28b81
--- /dev/null
+++ b/languages/java/javasupport_utils.cpp
@@ -0,0 +1,52 @@
+
+#include "javasupport_utils.h"
+#include <codemodel.h>
+
+static void typeNameList( QStringList& path, QStringList & lst, const CodeModel * model );
+static void typeNameList( QStringList& path, QStringList & lst, NamespaceDom ns );
+static void typeNameList( QStringList & path, QStringList & lst, ClassDom klass );
+
+QStringList typeNameList( const CodeModel* model )
+{
+ QStringList lst;
+ QStringList path;
+ typeNameList( path, lst, model );
+ return lst;
+}
+
+static void typeNameList( QStringList& path, QStringList & 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( QStringList& path, QStringList & 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( QStringList & path, QStringList & 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();
+}
+