Chameleon

Chameleon Svn Source Tree

Root/branches/xZenu/src/util/doxygen/src/util.h

Source at commit 1322 created 12 years 8 months ago.
By meklort, Add doxygen to utils folder
1/******************************************************************************
2 *
3 * $Id: util.h,v 1.49 2001/03/19 19:27:42 root Exp $
4 *
5 * Copyright (C) 1997-2011 by Dimitri van Heesch.
6 *
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation under the terms of the GNU General Public License is hereby
9 * granted. No representations are made about the suitability of this software
10 * for any purpose. It is provided "as is" without express or implied warranty.
11 * See the GNU General Public License for more details.
12 *
13 * Documents produced by Doxygen are derivative works derived from the
14 * input used in their production; they are not affected by this license.
15 *
16 */
17
18#ifndef UTIL_H
19#define UTIL_H
20
21/*! \file util.h
22 * \brief A bunch of utility functions.
23 */
24
25#include "qtbc.h"
26#include <qlist.h>
27#include <qtextstream.h>
28#include <ctype.h>
29#include "sortdict.h"
30
31//--------------------------------------------------------------------
32
33class ClassDef;
34class FileDef;
35class MemberList;
36class NamespaceDef;
37class FileNameDict;
38class ArgumentList;
39class OutputList;
40class OutputDocInterface;
41class MemberDef;
42class ExampleSDict;
43class ClassSDict;
44class BaseClassList;
45class GroupDef;
46class NamespaceSDict;
47class ClassList;
48class MemberGroupSDict;
49struct TagInfo;
50class MemberNameInfoSDict;
51struct ListItemInfo;
52class PageDef;
53struct SectionInfo;
54class QDir;
55class Definition;
56class BufStr;
57class QFileInfo;
58class QStrList;
59class FTextStream;
60
61//--------------------------------------------------------------------
62
63class TextGeneratorIntf
64{
65 public:
66 virtual ~TextGeneratorIntf() {}
67 virtual void writeString(const char *,bool) const = 0;
68 virtual void writeBreak() const = 0;
69 virtual void writeLink(const char *extRef,const char *file,
70 const char *anchor,const char *text
71 ) const = 0;
72};
73
74class TextGeneratorOLImpl : public TextGeneratorIntf
75{
76 public:
77 virtual ~TextGeneratorOLImpl() {}
78 TextGeneratorOLImpl(OutputDocInterface &od);
79 void writeString(const char *s,bool keepSpaces) const;
80 void writeBreak() const;
81 void writeLink(const char *extRef,const char *file,
82 const char *anchor,const char *text
83 ) const;
84 private:
85 OutputDocInterface &m_od;
86};
87
88//--------------------------------------------------------------------
89
90enum SrcLangExt
91{
92 SrcLangExt_Unknown = 0x0000,
93 SrcLangExt_IDL = 0x0008,
94 SrcLangExt_Java = 0x0010,
95 SrcLangExt_CSharp = 0x0020,
96 SrcLangExt_D = 0x0040,
97 SrcLangExt_PHP = 0x0080,
98 SrcLangExt_ObjC = 0x0100,
99 SrcLangExt_Cpp = 0x0200,
100 SrcLangExt_JS = 0x0400,
101 SrcLangExt_Python = 0x0800,
102 SrcLangExt_F90 = 0x1000,
103 SrcLangExt_VHDL = 0x2000,
104 SrcLangExt_XML = 0x4000
105};
106
107//--------------------------------------------------------------------
108
109void linkifyText(const TextGeneratorIntf &ol,
110 Definition *scope,
111 FileDef *fileScope,
112 const char *name,
113 const char *text,
114 bool autoBreak=FALSE,
115 bool external=TRUE,
116 bool keepSpaces=FALSE
117 );
118
119void setAnchors(ClassDef *cd,char id,MemberList *ml,int groupId=-1);
120
121QCString fileToString(const char *name,bool filter=FALSE,bool isSourceCode=FALSE);
122
123QCString dateToString(bool);
124
125bool getDefs(const QCString &scopeName,
126 const QCString &memberName,
127 const char *,
128 MemberDef *&md,
129 ClassDef *&cd,
130 FileDef *&fd,
131 NamespaceDef *&nd,
132 GroupDef *&gd,
133 bool forceEmptyScope=FALSE,
134 FileDef *currentFile=0,
135 bool checkCV=FALSE
136 );
137
138QCString getFileFilter(const char* name,bool isSourceCode);
139
140bool resolveRef(/* in */ const char *scName,
141 /* in */ const char *name,
142 /* in */ bool inSeeBlock,
143 /* out */ Definition **resContext,
144 /* out */ MemberDef **resMember,
145 /* in */ bool lookForSpecializations = TRUE,
146 /* in */ FileDef *currentFile = 0,
147 /* in */ bool checkScope = FALSE
148 );
149
150bool resolveLink(/* in */ const char *scName,
151 /* in */ const char *lr,
152 /* in */ bool inSeeBlock,
153 /* out */ Definition **resContext,
154 /* out */ QCString &resAnchor
155 );
156
157//bool generateRef(OutputDocInterface &od,const char *,
158// const char *,bool inSeeBlock,const char * =0);
159
160bool generateLink(OutputDocInterface &od,const char *,
161 const char *,bool inSeeBlock,const char *);
162
163void generateFileRef(OutputDocInterface &od,const char *,
164 const char *linkTxt=0);
165
166void writePageRef(OutputDocInterface &od,const char *cn,const char *mn);
167
168QCString getCanonicalTemplateSpec(Definition *d,FileDef *fs,const QCString& spec);
169
170bool matchArguments2(Definition *srcScope,FileDef *srcFileScope,ArgumentList *srcAl,
171 Definition *dstScope,FileDef *dstFileScope,ArgumentList *dstAl,
172 bool checkCV
173 );
174
175void mergeArguments(ArgumentList *,ArgumentList *,bool forceNameOverwrite=FALSE);
176
177QCString substituteClassNames(const QCString &s);
178
179QCString substitute(const char *s,const char *src,const char *dst);
180
181QCString clearBlock(const char *s,const char *begin,const char *end);
182
183QCString selectBlock(const QCString& s,const QCString &name,bool which);
184
185QCString resolveDefines(const char *n);
186
187ClassDef *getClass(const char *key);
188
189ClassDef *getResolvedClass(Definition *scope,
190 FileDef *fileScope,
191 const char *key,
192 MemberDef **pTypeDef=0,
193 QCString *pTemplSpec=0,
194 bool mayBeUnlinkable=FALSE,
195 bool mayBeHidden=FALSE,
196 QCString *pResolvedType=0);
197
198NamespaceDef *getResolvedNamespace(const char *key);
199
200FileDef *findFileDef(const FileNameDict *fnDict,const char *n,
201 bool &ambig);
202
203QCString showFileDefMatches(const FileNameDict *fnDict,const char *n);
204
205int guessSection(const char *name);
206
207inline bool isId(int c)
208{
209 return c=='_' || c>=128 || c<0 || isalnum(c);
210}
211
212QCString removeRedundantWhiteSpace(const QCString &s);
213
214QCString argListToString(ArgumentList *al,bool useCanonicalType=FALSE,bool showDefVals=TRUE);
215
216QCString tempArgListToString(ArgumentList *al);
217
218QCString generateMarker(int id);
219
220void writeExample(OutputList &ol,ExampleSDict *el);
221
222QCString stripAnonymousNamespaceScope(const QCString &s);
223
224QCString stripFromPath(const QCString &path);
225
226QCString stripFromIncludePath(const QCString &path);
227
228bool rightScopeMatch(const QCString &scope, const QCString &name);
229
230bool leftScopeMatch(const QCString &scope, const QCString &name);
231
232QCString substituteKeywords(const QCString &s,const char *title);
233
234int getPrefixIndex(const QCString &name);
235
236QCString removeAnonymousScopes(const QCString &s);
237
238QCString replaceAnonymousScopes(const QCString &s,const char *replacement=0);
239
240void initClassHierarchy(ClassSDict *cl);
241
242bool hasVisibleRoot(BaseClassList *bcl);
243
244int minClassDistance(const ClassDef *cd,const ClassDef *bcd,int level=0);
245
246QCString convertNameToFile(const char *name,bool allowDots=FALSE,bool allowUnderscore=FALSE);
247
248void extractNamespaceName(const QCString &scopeName,
249 QCString &className,QCString &namespaceName,
250 bool allowEmptyClass=FALSE);
251
252QCString insertTemplateSpecifierInScope(const QCString &scope,const QCString &templ);
253
254QCString stripScope(const char *name);
255
256QCString convertToHtml(const char *s,bool keepEntities=TRUE);
257
258QCString convertToXML(const char *s);
259
260QCString convertToJSString(const char *s);
261
262QCString getOverloadDocs();
263
264void addMembersToMemberGroup(/* in */ MemberList *ml,
265 /* in,out */ MemberGroupSDict **ppMemberGroupSDict,
266 /* in */ Definition *context);
267
268int extractClassNameFromType(const QCString &type,int &pos,
269 QCString &name,QCString &templSpec);
270
271QCString substituteTemplateArgumentsInString(
272 const QCString &name,
273 ArgumentList *formalArgs,
274 ArgumentList *actualArgs);
275
276ArgumentList *copyArgumentList(const ArgumentList *src);
277
278QList<ArgumentList> *copyArgumentLists(const QList<ArgumentList> *srcLists);
279
280QCString stripTemplateSpecifiersFromScope(const QCString &fullName,
281 bool parentOnly=TRUE,
282 QCString *lastScopeStripped=0);
283
284QCString resolveTypeDef(Definition *d,const QCString &name,
285 Definition **typedefContext=0);
286
287QCString mergeScopes(const QCString &leftScope,const QCString &rightScope);
288
289int getScopeFragment(const QCString &s,int p,int *l);
290
291int filterCRLF(char *buf,int len);
292
293void addRefItem(const QList<ListItemInfo> *sli,const char *prefix,
294 const char *key,
295 const char *name,const char *title,const char *args);
296
297PageDef *addRelatedPage(const char *name,const QCString &ptitle,
298 const QCString &doc,QList<SectionInfo> *anchors,
299 const char *fileName,int startLine,
300 const QList<ListItemInfo> *sli,
301 GroupDef *gd=0,
302 TagInfo *tagInfo=0
303 );
304
305QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscore=FALSE);
306
307void addGroupListToTitle(OutputList &ol,Definition *d);
308
309void filterLatexString(FTextStream &t,const char *str,
310 bool insideTabbing=FALSE,bool insidePre=FALSE,
311 bool insideItem=FALSE);
312
313QCString rtfFormatBmkStr(const char *name);
314
315QCString linkToText(const char *link,bool isFileName);
316
317QCString stripExtension(const char *fName);
318
319void replaceNamespaceAliases(QCString &scope,int i);
320
321int isAccessibleFrom(Definition *scope,FileDef *fileScope,Definition *item);
322
323int isAccessibleFromWithExpScope(Definition *scope,FileDef *fileScope,Definition *item,
324 const QCString &explicitScopePart);
325
326int computeQualifiedIndex(const QCString &name);
327
328void addDirPrefix(QCString &fileName);
329
330QCString relativePathToRoot(const char *name);
331
332void createSubDirs(QDir &d);
333
334QCString stripPath(const char *s);
335
336bool containsWord(const QCString &s,const QCString &word);
337
338bool findAndRemoveWord(QCString &s,const QCString &word);
339
340QCString stripLeadingAndTrailingEmptyLines(const QCString &s);
341
342//void stringToSearchIndex(const QCString &docUrlBase,const QCString &title,
343// const QCString &str, bool priority=FALSE,
344// const QCString &anchor="");
345
346bool updateLanguageMapping(const QCString &extension,const QCString &parser);
347SrcLangExt getLanguageFromFileName(const QCString fileName);
348void initDefaultExtensionMapping();
349
350bool checkIfTypedef(Definition *scope,FileDef *fileScope,const char *n);
351
352ClassDef *newResolveTypedef(FileDef *fileScope,MemberDef *md,
353 MemberDef **pMemType=0,QCString *pTemplSpec=0,
354 QCString *pResolvedType=0,
355 ArgumentList *actTemplParams=0);
356
357QCString parseCommentAsText(const Definition *scope,const MemberDef *member,const QCString &doc,const QCString &fileName,int lineNr);
358
359QCString transcodeCharacterStringToUTF8(const QCString &input);
360
361QCString recodeString(const QCString &str,const char *fromEncoding,const char *toEncoding);
362
363QCString extractAliasArgs(const QCString &args,int pos);
364
365int countAliasArguments(const QCString argList);
366
367QCString replaceAliasArguments(const QCString &aliasValue,const QCString &argList);
368
369QCString resolveAliasCmd(const QCString aliasCmd);
370QCString expandAlias(const QCString &aliasName,const QCString &aliasValue);
371
372void writeTypeConstraints(OutputList &ol,Definition *d,ArgumentList *al);
373
374QCString convertCharEntitiesToUTF8(const QCString &s);
375
376bool usingTreeIndex();
377void stackTrace();
378
379bool readInputFile(const char *fileName,BufStr &inBuf);
380QCString filterTitle(const QCString &title);
381
382bool patternMatch(const QFileInfo &fi,const QStrList *patList);
383
384void writeSummaryLink(OutputList &ol,const char *label,const char *title,
385 bool &first);
386
387QCString externalLinkTarget();
388QCString externalRef(const QCString &relPath,const QCString &ref,bool href);
389int nextUtf8CharPosition(const QCString &utf8Str,int len,int startPos);
390
391struct ColoredImgDataItem
392{
393 const char *name;
394 unsigned short width;
395 unsigned short height;
396 unsigned char *content;
397 unsigned char *alpha;
398};
399
400void writeColoredImgData(const char *dir,ColoredImgDataItem data[]);
401QCString replaceColorMarkers(const char *str);
402
403#endif
404
405

Archive Download this file

Revision: 1322