KDevelop API Documentation

parts/ctags/ctagskinds.cpp

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * Copyright (C) 2001-2002 by Bernd Gehrmann * 00003 * bernd@kdevelop.org * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 ***************************************************************************/ 00011 00012 #include "ctagskinds.h" 00013 00014 #include <klocale.h> 00015 00016 struct CTagsKindMapping { 00017 char abbrev; 00018 const char *verbose; 00019 }; 00020 00021 00022 struct CTagsExtensionMapping { 00023 const char *extension; 00024 CTagsKindMapping *kinds; 00025 }; 00026 00027 00028 static CTagsKindMapping kindMappingAsm[] = { 00029 { 'd', I18N_NOOP("define") }, 00030 { 'l', I18N_NOOP("label") }, 00031 { 'm', I18N_NOOP("macro") }, 00032 { 0 , 0 } 00033 }; 00034 00035 00036 static CTagsKindMapping kindMappingAsp[] = { 00037 { 'f', I18N_NOOP("function") }, 00038 { 's', I18N_NOOP("subroutine") }, 00039 { 0 , 0 } 00040 }; 00041 00042 00043 static CTagsKindMapping kindMappingAwk[] = { 00044 { 'f', I18N_NOOP("function") }, 00045 { 0 , 0 } 00046 }; 00047 00048 00049 static CTagsKindMapping kindMappingBeta[] = { 00050 { 'f', I18N_NOOP("fragment definition") }, 00051 { 'p', I18N_NOOP("any pattern") }, 00052 { 's', I18N_NOOP("slot") }, 00053 { 'v', I18N_NOOP("pattern") }, 00054 { 0 , 0 } 00055 }; 00056 00057 00058 static CTagsKindMapping kindMappingC[] = { 00059 { 'c', I18N_NOOP("class") }, 00060 { 'd', I18N_NOOP("macro") }, 00061 { 'e', I18N_NOOP("enumerator") }, 00062 { 'f', I18N_NOOP("function") }, 00063 { 'g', I18N_NOOP("enumeration") }, 00064 { 'm', I18N_NOOP("member") }, 00065 { 'n', I18N_NOOP("namespace") }, 00066 { 'p', I18N_NOOP("prototype") }, 00067 { 's', I18N_NOOP("struct") }, 00068 { 't', I18N_NOOP("typedef") }, 00069 { 'u', I18N_NOOP("union") }, 00070 { 'v', I18N_NOOP("variable") }, 00071 { 'x', I18N_NOOP("external variable") }, 00072 { 0 , 0 } 00073 }; 00074 00075 00076 static CTagsKindMapping kindMappingCobol[] = { 00077 { 'p', I18N_NOOP("paragraph") }, 00078 { 0 , 0 } 00079 }; 00080 00081 00082 static CTagsKindMapping kindMappingEiffel[] = { 00083 { 'c', I18N_NOOP("class") }, 00084 { 'f', I18N_NOOP("feature") }, 00085 { 'l', I18N_NOOP("local entity") }, 00086 { 0 , 0 } 00087 }; 00088 00089 00090 static CTagsKindMapping kindMappingFortran[] = { 00091 { 'b', I18N_NOOP("block") }, 00092 { 'c', I18N_NOOP("common") }, 00093 { 'e', I18N_NOOP("entry") }, 00094 { 'f', I18N_NOOP("function") }, 00095 { 'i', I18N_NOOP("interface") }, 00096 { 'k', I18N_NOOP("type component") }, 00097 { 'l', I18N_NOOP("label") }, 00098 { 'L', I18N_NOOP("local") }, 00099 { 'm', I18N_NOOP("module") }, 00100 { 'n', I18N_NOOP("namelist") }, 00101 { 'p', I18N_NOOP("program") }, 00102 { 's', I18N_NOOP("subroutine") }, 00103 { 't', I18N_NOOP("type") }, 00104 { 'v', I18N_NOOP("variable") }, 00105 { 0 , 0 } 00106 }; 00107 00108 00109 static CTagsKindMapping kindMappingJava[] = { 00110 { 'c', I18N_NOOP("class") }, 00111 { 'f', I18N_NOOP("field") }, 00112 { 'i', I18N_NOOP("interface") }, 00113 { 'm', I18N_NOOP("method") }, 00114 { 'p', I18N_NOOP("package") }, 00115 { 0 , 0 } 00116 }; 00117 00118 00119 static CTagsKindMapping kindMappingLisp[] = { 00120 { 'f', I18N_NOOP("function") }, 00121 { 0 , 0 } 00122 }; 00123 00124 00125 static CTagsKindMapping kindMappingMake[] = { 00126 { 'm', I18N_NOOP("macro") }, 00127 { 0 , 0 } 00128 }; 00129 00130 00131 static CTagsKindMapping kindMappingPascal[] = { 00132 { 'f', I18N_NOOP("function") }, 00133 { 'p', I18N_NOOP("procedure") }, 00134 { 0 , 0 } 00135 }; 00136 00137 00138 static CTagsKindMapping kindMappingPerl[] = { 00139 { 's', I18N_NOOP("subroutine") }, 00140 { 0 , 0 } 00141 }; 00142 00143 00144 static CTagsKindMapping kindMappingPHP[] = { 00145 { 'c', I18N_NOOP("class") }, 00146 { 'f', I18N_NOOP("function") }, 00147 { 0 , 0 } 00148 }; 00149 00150 00151 static CTagsKindMapping kindMappingPython[] = { 00152 { 'c', I18N_NOOP("class") }, 00153 { 'f', I18N_NOOP("function") }, 00154 { 0 , 0 } 00155 }; 00156 00157 00158 static CTagsKindMapping kindMappingRexx[] = { 00159 { 's', I18N_NOOP("subroutine") }, 00160 { 0 , 0 } 00161 }; 00162 00163 00164 static CTagsKindMapping kindMappingRuby[] = { 00165 { 'c', I18N_NOOP("class") }, 00166 { 'f', I18N_NOOP("function") }, 00167 { 'm', I18N_NOOP("mixin") }, 00168 { 0 , 0 } 00169 }; 00170 00171 00172 static CTagsKindMapping kindMappingScheme[] = { 00173 { 'f', I18N_NOOP("function") }, 00174 { 's', I18N_NOOP("set") }, 00175 { 0 , 0 } 00176 }; 00177 00178 00179 static CTagsKindMapping kindMappingSh[] = { 00180 { 'f', I18N_NOOP("function") }, 00181 { 0 , 0 } 00182 }; 00183 00184 00185 static CTagsKindMapping kindMappingSlang[] = { 00186 { 'f', I18N_NOOP("function") }, 00187 { 'n', I18N_NOOP("namespace") }, 00188 { 0 , 0 } 00189 }; 00190 00191 00192 static CTagsKindMapping kindMappingTcl[] = { 00193 { 'p', I18N_NOOP("procedure") }, 00194 { 0 , 0 } 00195 }; 00196 00197 00198 static CTagsKindMapping kindMappingVim[] = { 00199 { 'f', I18N_NOOP("function") }, 00200 { 0 , 0 } 00201 }; 00202 00203 00204 static CTagsExtensionMapping extensionMapping[] = { 00205 { "asm", kindMappingAsm }, 00206 { "s", kindMappingAsm }, 00207 { "S", kindMappingAsm }, 00208 { "asp", kindMappingAsp }, 00209 { "asa", kindMappingAsp }, 00210 { "awk", kindMappingAwk }, 00211 { "c++", kindMappingC }, 00212 { "cc", kindMappingC }, 00213 { "cp" , kindMappingC }, 00214 { "cpp", kindMappingC }, 00215 { "cxx", kindMappingC }, 00216 { "h" , kindMappingC }, 00217 { "h++", kindMappingC }, 00218 { "hh" , kindMappingC }, 00219 { "hp" , kindMappingC }, 00220 { "hpp", kindMappingC }, 00221 { "hxx", kindMappingC }, 00222 { "beta", kindMappingBeta }, 00223 { "cob", kindMappingCobol }, 00224 { "COB", kindMappingCobol }, 00225 { "e", kindMappingEiffel }, 00226 { "f" , kindMappingFortran }, 00227 { "for" , kindMappingFortran }, 00228 { "ftn" , kindMappingFortran }, 00229 { "f77" , kindMappingFortran }, 00230 { "f90" , kindMappingFortran }, 00231 { "f95" , kindMappingFortran }, 00232 { "java", kindMappingJava }, 00233 { "cl", kindMappingLisp }, 00234 { "clisp", kindMappingLisp }, 00235 { "el", kindMappingLisp }, 00236 { "l", kindMappingLisp }, 00237 { "lisp", kindMappingLisp }, 00238 { "lsp", kindMappingLisp }, 00239 { "ml", kindMappingLisp }, 00240 { "mak", kindMappingMake }, 00241 { "p", kindMappingPascal }, 00242 { "pas", kindMappingPascal }, 00243 { "pl", kindMappingPerl }, 00244 { "pm", kindMappingPerl }, 00245 { "perl", kindMappingPerl }, 00246 { "php", kindMappingPHP }, 00247 { "php3", kindMappingPHP }, 00248 { "phtml", kindMappingPHP }, 00249 { "py", kindMappingPython }, 00250 { "python", kindMappingPython }, 00251 { "cmd", kindMappingRexx }, 00252 { "rexx", kindMappingRexx }, 00253 { "rx", kindMappingRexx }, 00254 { "rb", kindMappingRuby }, 00255 { "sch", kindMappingScheme }, 00256 { "scheme", kindMappingScheme }, 00257 { "scm", kindMappingScheme }, 00258 { "sm", kindMappingScheme }, 00259 { "SCM", kindMappingScheme }, 00260 { "SM", kindMappingScheme }, 00261 { "sh", kindMappingSh }, 00262 { "SH", kindMappingSh }, 00263 { "bsh", kindMappingSh }, 00264 { "bash", kindMappingSh }, 00265 { "ksh", kindMappingSh }, 00266 { "zsh", kindMappingSh }, 00267 { "sl", kindMappingSlang }, 00268 { "tcl", kindMappingTcl }, 00269 { "wish", kindMappingTcl }, 00270 { "vim", kindMappingVim }, 00271 { 0 , 0 } 00272 }; 00273 00274 00275 static CTagsKindMapping *findKindMapping(const QString &extension) 00276 { 00277 const char *pextension = extension.latin1(); 00278 00279 CTagsExtensionMapping *pem = extensionMapping; 00280 while (pem->extension != 0) { 00281 if (strcmp(pem->extension, pextension) == 0) 00282 return pem->kinds; 00283 ++pem; 00284 } 00285 00286 return 0; 00287 } 00288 00289 00290 QString CTagsKinds::findKind(char kindChar, const QString &extension) 00291 { 00292 QString res; 00293 00294 CTagsKindMapping *kindMapping = findKindMapping(extension); 00295 if (kindMapping) { 00296 CTagsKindMapping *pkm = kindMapping; 00297 while (pkm->verbose != 0) { 00298 if (pkm->abbrev == kindChar) 00299 return i18n(pkm->verbose); 00300 ++pkm; 00301 } 00302 } 00303 00304 return QString::null; 00305 }
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Oct 19 08:01:50 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003