KDevelop API Documentation

lib/interfaces/codemodel_utils.h

Go to the documentation of this file.
00001 /* This file is part of KDevelop 00002 Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org> 00003 Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 */ 00020 00021 #ifndef _CODEMODEL_UTILS_H_ 00022 #define _CODEMODEL_UTILS_H_ 00023 00024 #include "codemodel.h" 00025 00026 namespace CodeModelUtils 00027 { 00028 00029 template <class Pred> void findFunctionDefinitions( Pred pred, const FileList& fileList, FunctionDefinitionList & lst ); 00030 template <class Pred> void findFunctionDefinitions( Pred pred, const NamespaceDom& ns, FunctionDefinitionList & lst ); 00031 template <class Pred> void findFunctionDefinitions( Pred pred, const NamespaceList& namespaceList, FunctionDefinitionList & lst ); 00032 template <class Pred> void findFunctionDefinitions( Pred pred, const ClassList& classList, FunctionDefinitionList & lst ); 00033 template <class Pred> void findFunctionDefinitions( Pred pred, const FunctionDefinitionList& functionDefinitionList, FunctionDefinitionList & lst ); 00034 template <class Pred> void findFunctionDefinitions( Pred pred, const ClassDom& klass, FunctionDefinitionList & lst ); 00035 template <class Pred> void findFunctionDefinitions( Pred pred, const FunctionDefinitionDom& fun, FunctionDefinitionList & lst ); 00036 template <class Pred> void findFunctionDefinitions( Pred pred, FunctionDefinitionList & lst ); 00037 00038 00039 template <class Pred> 00040 void findFunctionDefinitions( Pred pred, const FileList& fileList, FunctionDefinitionList & lst ) 00041 { 00042 for( FileList::ConstIterator it=fileList.begin(); it!=fileList.end(); ++it ) 00043 findFunctionDefinitions( pred, model_cast<NamespaceDom>(*it), lst ); 00044 } 00045 00046 template <class Pred> 00047 void findFunctionDefinitions( Pred pred, const NamespaceDom& ns, FunctionDefinitionList & lst ) 00048 { 00049 findFunctionDefinitions( pred, ns->namespaceList(), lst ); 00050 findFunctionDefinitions( pred, ns->classList(), lst ); 00051 findFunctionDefinitions( pred, ns->functionDefinitionList(), lst ); 00052 } 00053 00054 template <class Pred> 00055 void findFunctionDefinitions( Pred pred, const NamespaceList& namespaceList, FunctionDefinitionList & lst ) 00056 { 00057 for( NamespaceList::ConstIterator it=namespaceList.begin(); it!=namespaceList.end(); ++it ) 00058 findFunctionDefinitions( pred, *it, lst ); 00059 } 00060 00061 template <class Pred> 00062 void findFunctionDefinitions( Pred pred, const ClassList& classList, FunctionDefinitionList & lst ) 00063 { 00064 for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it ) 00065 findFunctionDefinitions( pred, *it, lst ); 00066 } 00067 00068 template <class Pred> 00069 void findFunctionDefinitions( Pred pred, const FunctionDefinitionList& functionDefinitionList, FunctionDefinitionList & lst ) 00070 { 00071 for( FunctionDefinitionList::ConstIterator it=functionDefinitionList.begin(); it!=functionDefinitionList.end(); ++it ) 00072 findFunctionDefinitions( pred, *it, lst ); 00073 } 00074 00075 template <class Pred> 00076 void findFunctionDefinitions( Pred pred, const ClassDom& klass, FunctionDefinitionList & lst ) 00077 { 00078 findFunctionDefinitions( pred, klass->classList(), lst ); 00079 findFunctionDefinitions( pred, klass->functionDefinitionList(), lst ); 00080 } 00081 00082 template <class Pred> 00083 void findFunctionDefinitions( Pred pred, const FunctionDefinitionDom& fun, FunctionDefinitionList & lst ) 00084 { 00085 if( pred(fun) ) 00086 lst << fun; 00087 } 00088 00089 #if 0 00090 template <class Pred> 00091 void findFunctionDefinitions( Pred pred, FunctionDefinitionList & lst ) 00092 { 00093 FileList fileList = m_store->fileList(); 00094 for( FileList::Iterator it=fileList.begin(); it!=fileList.end(); ++it ) 00095 findFunctionDefinitions( pred, model_cast<NamespaceDom>(*it), lst ); 00096 } 00097 #endif 00098 00099 struct Scope{ 00100 ClassDom klass; 00101 NamespaceDom ns; 00102 }; 00103 00104 struct AllFunctions{ 00105 QMap<FunctionDom, Scope> relations; 00106 FunctionList functionList; 00107 }; 00108 struct AllFunctionDefinitions{ 00109 QMap<FunctionDefinitionDom, Scope> relations; 00110 FunctionDefinitionList functionList; 00111 }; 00112 00113 namespace Functions{ 00114 void processClasses(FunctionList &list, const ClassDom dom); 00115 void processNamespaces(FunctionList &list, const NamespaceDom dom); 00116 void processClasses(FunctionList &list, const ClassDom dom, QMap<FunctionDom, Scope> &relations); 00117 void processClasses(FunctionList &list, const ClassDom dom, QMap<FunctionDom, Scope> &relations, const NamespaceDom &nsdom); 00118 void processNamespaces(FunctionList &list, const NamespaceDom dom, QMap<FunctionDom, Scope> &relations); 00119 } 00120 namespace FunctionDefinitions{ 00121 void processClasses(FunctionDefinitionList &list, const ClassDom dom); 00122 void processNamespaces(FunctionDefinitionList &list, const NamespaceDom dom); 00123 void processClasses(FunctionDefinitionList &list, const ClassDom dom, QMap<FunctionDefinitionDom, Scope> &relations); 00124 void processClasses(FunctionDefinitionList &list, const ClassDom dom, QMap<FunctionDefinitionDom, Scope> &relations, const NamespaceDom &nsdom); 00125 void processNamespaces(FunctionDefinitionList &list, const NamespaceDom dom, QMap<FunctionDefinitionDom, Scope> &relations); 00126 } 00127 00128 FunctionList allFunctions(const FileDom &dom); 00129 AllFunctions allFunctionsDetailed(const FileDom &dom); 00130 AllFunctionDefinitions allFunctionDefinitionsDetailed(const FileDom &dom); 00131 } 00132 00133 #endif // __CODEMODEL_UTILS_H
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 6 17:39:08 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003