lib/interfaces/codemodel_utils.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
This file is part of the documentation for KDevelop Version 3.0.4.