A bunch of utility functions. More...
#include <qlist.h>
#include <ctype.h>
#include "types.h"
#include "sortdict.h"
#include "docparser.h"
Go to the source code of this file.
Classes | |
class | TextGeneratorIntf |
class | TextGeneratorOLImpl |
class | LetterToIndexMap< T > |
maps a unicode character code to a list of T::ElementType's More... | |
struct | ColoredImgDataItem |
void addCodeOnlyMappings | ( | ) |
Definition at line 7056 of file util.cpp.
void addDirPrefix | ( | QCString & | fileName | ) |
Definition at line 8189 of file util.cpp.
void addGroupListToTitle | ( | OutputList & | ol, |
Definition * | d | ||
) |
Definition at line 6528 of file util.cpp.
void addMembersToMemberGroup | ( | MemberList * | ml, |
MemberGroupSDict ** | ppMemberGroupSDict, | ||
Definition * | context | ||
) |
Definition at line 5867 of file util.cpp.
void addRefItem | ( | const QList< ListItemInfo > * | sli, |
const char * | prefix, | ||
const char * | key, | ||
const char * | name, | ||
const char * | title, | ||
const char * | args, | ||
Definition * | scope | ||
) |
Definition at line 6456 of file util.cpp.
PageDef* addRelatedPage | ( | const char * | name, |
const QCString & | ptitle, | ||
const QCString & | doc, | ||
QList< SectionInfo > * | anchors, | ||
const char * | fileName, | ||
int | startLine, | ||
const QList< ListItemInfo > * | sli, | ||
GroupDef * | gd = 0 , |
||
TagInfo * | tagInfo = 0 , |
||
SrcLangExt | lang = SrcLangExt_Unknown |
||
) |
Definition at line 6369 of file util.cpp.
QCString argListToString | ( | ArgumentList * | al, |
bool | useCanonicalType = FALSE , |
||
bool | showDefVals = TRUE |
||
) |
Definition at line 2151 of file util.cpp.
bool checkExtension | ( | const char * | fName, |
const char * | ext | ||
) |
Definition at line 6784 of file util.cpp.
bool checkIfTypedef | ( | Definition * | scope, |
FileDef * | fileScope, | ||
const char * | n | ||
) |
Returns true iff the given name string appears to be a typedef in scope.
Definition at line 7155 of file util.cpp.
Protection classInheritedProtectionLevel | ( | ClassDef * | cd, |
ClassDef * | bcd, | ||
Protection | prot = Public , |
||
int | level = 0 |
||
) |
Definition at line 2556 of file util.cpp.
QCString clearBlock | ( | const char * | s, |
const char * | begin, | ||
const char * | end | ||
) |
Clear a text block s from begin to end markers.
Definition at line 106 of file htmlgen.cpp.
returns TRUE
iff string s contains word w
Definition at line 6836 of file util.cpp.
Definition at line 5822 of file util.cpp.
This function determines the file name on disk of an item given its name, which could be a class name with template arguments, so special characters need to be escaped.
Definition at line 5354 of file util.cpp.
void convertProtectionLevel | ( | MemberListType | inListType, |
Protection | inProt, | ||
int * | outListType1, | ||
int * | outListType2 | ||
) |
Computes for a given list type inListType, which are the the corresponding list type(s) in the base class that are to be added to this list.
So for public inheritance, the mapping is 1-1, so outListType1=inListType Private members are to be hidden completely.
For protected inheritance, both protected and public members of the base class should be joined in the protected member section.
For private inheritance, both protected and public members of the base class should be joined in the private member section.
Definition at line 8378 of file util.cpp.
Converts a string to a HTML-encoded string
Definition at line 5746 of file util.cpp.
QCString convertToId | ( | const char * | s | ) |
Converts a string to a HTML id string
Definition at line 5685 of file util.cpp.
QCString convertToJSString | ( | const char * | s | ) |
Definition at line 5792 of file util.cpp.
Definition at line 5812 of file util.cpp.
QCString convertToXML | ( | const char * | s | ) |
Converts a string to an XML-encoded string
Definition at line 5717 of file util.cpp.
QList<ArgumentList>* copyArgumentLists | ( | const QList< ArgumentList > * | srcLists | ) |
Makes a deep copy of the list of argument lists srcLists. Will allocate memory, that is owned by the caller.
Definition at line 6205 of file util.cpp.
Copies the contents of file with name src to the newly created file with name dest. Returns TRUE if successful.
Definition at line 7966 of file util.cpp.
Corrects URL url according to the relative path relPath. Returns the corrected URL. For absolute URLs no correction will be done.
Definition at line 8084 of file util.cpp.
void createSubDirs | ( | QDir & | d | ) |
Definition at line 5458 of file util.cpp.
Definition at line 2473 of file util.cpp.
Definition at line 5242 of file util.cpp.
Definition at line 7572 of file util.cpp.
Definition at line 7856 of file util.cpp.
Returns the section of text, in between a pair of markers. Full lines are returned, excluding the lines on which the markers appear.
Definition at line 7998 of file util.cpp.
int extractClassNameFromType | ( | const QCString & | type, |
int & | pos, | ||
QCString & | name, | ||
QCString & | templSpec, | ||
SrcLangExt | lang | ||
) |
Extracts a (sub-)string from type starting at pos that could form a class. The index of the match is returned and the found class name and a template argument list templSpec. If -1 is returned there are no more matches.
Definition at line 5963 of file util.cpp.
Definition at line 8342 of file util.cpp.
void extractNamespaceName | ( | const QCString & | scopeName, |
QCString & | className, | ||
QCString & | namespaceName, | ||
bool | allowEmptyClass | ||
) |
Input is a scopeName, output is the scopename split into a namespace part (as large as possible) and a classname part.
Definition at line 5478 of file util.cpp.
reads a file with name name and returns it as a string. If filter is TRUE the file will be filtered by any user specified input filter. If name is "-" the string will be read from standard input.
Definition at line 2418 of file util.cpp.
int filterCRLF | ( | char * | buf, |
int | len | ||
) |
takes the buf of the given length len and converts CR LF (DOS) or CR (MAC) line ending to LF (Unix). Returns the length of the converted content (i.e. the same as len (Unix, MAC) or smaller (DOS).
void filterLatexString | ( | FTextStream & | t, |
const char * | str, | ||
bool | insideTabbing = FALSE , |
||
bool | insidePre = FALSE , |
||
bool | insideItem = FALSE , |
||
bool | keepSpaces = FALSE |
||
) |
Definition at line 6533 of file util.cpp.
Definition at line 7765 of file util.cpp.
Definition at line 6848 of file util.cpp.
FileDef* findFileDef | ( | const FileNameDict * | fnDict, |
const char * | n, | ||
bool & | ambig | ||
) |
Definition at line 4963 of file util.cpp.
void generateFileRef | ( | OutputDocInterface & | od, |
const char * | , | ||
const char * | linkTxt = 0 |
||
) |
Definition at line 4908 of file util.cpp.
bool generateLink | ( | OutputDocInterface & | od, |
const char * | , | ||
const char * | , | ||
bool | inSeeBlock, | ||
const char * | |||
) |
Definition at line 4866 of file util.cpp.
QCString generateMarker | ( | int | id | ) |
QCString getCanonicalTemplateSpec | ( | Definition * | d, |
FileDef * | fs, | ||
const QCString & | spec | ||
) |
Definition at line 3335 of file util.cpp.
ClassDef* getClass | ( | const char * | n | ) |
Get a class definition given its name. Returns 0 if the class is not found.
Definition at line 472 of file util.cpp.
bool getDefs | ( | const QCString & | scName, |
const QCString & | mbName, | ||
const char * | args, | ||
MemberDef *& | md, | ||
ClassDef *& | cd, | ||
FileDef *& | fd, | ||
NamespaceDef *& | nd, | ||
GroupDef *& | gd, | ||
bool | forceEmptyScope, | ||
FileDef * | currentFile, | ||
bool | checkCV, | ||
const char * | forceTagFile | ||
) |
Searches for a member definition given its name `memberName' as a string. memberName may also include a (partial) scope to indicate the scope in which the member is located.
The parameter `scName' is a string representing the name of the scope in which the link was found.
In case of a function args contains a string representation of the argument list. Passing 0 means the member has no arguments. Passing "()" means any argument list will do, but "()" is preferred.
The function returns TRUE if the member is known and documented or FALSE if it is not. If TRUE is returned parameter `md' contains a pointer to the member definition. Furthermore exactly one of the parameter `cd', `nd', or `fd' will be non-zero:
Definition at line 3932 of file util.cpp.
QCString getDotImageExtension | ( | void | ) |
Definition at line 8562 of file util.cpp.
looks for a filter for the file name. Returns the name of the filter if there is a match for the file name, otherwise an empty string. In case inSourceCode is TRUE then first the source filter list is considered.
Definition at line 2345 of file util.cpp.
SrcLangExt getLanguageFromFileName | ( | const QCString | fileName | ) |
Definition at line 7061 of file util.cpp.
QCString getLanguageSpecificSeparator | ( | SrcLangExt | lang, |
bool | classScope | ||
) |
Returns the scope separator to use given the programming language lang
Definition at line 8065 of file util.cpp.
MemberDef* getMemberFromSymbol | ( | Definition * | scope, |
FileDef * | fileScope, | ||
const char * | n | ||
) |
Definition at line 7083 of file util.cpp.
QCString getOverloadDocs | ( | ) |
int getPrefixIndex | ( | const QCString & | name | ) |
Returns the character index within name of the first prefix in Config_getList("IGNORE_PREFIX") that matches name at the left hand side, or zero if no match was found
Definition at line 5144 of file util.cpp.
ClassDef* getResolvedClass | ( | Definition * | scope, |
FileDef * | fileScope, | ||
const char * | key, | ||
MemberDef ** | pTypeDef = 0 , |
||
QCString * | pTemplSpec = 0 , |
||
bool | mayBeUnlinkable = FALSE , |
||
bool | mayBeHidden = FALSE , |
||
QCString * | pResolvedType = 0 |
||
) |
Definition at line 1563 of file util.cpp.
NamespaceDef* getResolvedNamespace | ( | const char * | key | ) |
Definition at line 489 of file util.cpp.
int getScopeFragment | ( | const QCString & | s, |
int | p, | ||
int * | l | ||
) |
Returns one unicode character as an unsigned integer from utf-8 string, making the character lower case if it was upper case.
s | utf-8 encoded string |
idx | byte position of given string s. |
Definition at line 8276 of file util.cpp.
Returns one unicode character as ian unsigned interger from utf-8 string, making the character upper case if it was lower case.
s | utf-8 encoded string |
idx | byte position of given string s. |
Definition at line 8291 of file util.cpp.
int guessSection | ( | const char * | name | ) |
try to determine if name is a source or a header file name by looking at the extension. A number of variations is allowed in both upper and lower case) If anyone knows or uses another extension please let me know :-)
bool hasVisibleRoot | ( | BaseClassList * | bcl | ) |
Definition at line 5224 of file util.cpp.
void initClassHierarchy | ( | ClassSDict * | cl | ) |
Definition at line 5211 of file util.cpp.
void initDefaultExtensionMapping | ( | ) |
Definition at line 6999 of file util.cpp.
void initFilePattern | ( | void | ) |
Definition at line 8569 of file util.cpp.
Definition at line 5527 of file util.cpp.
int isAccessibleFrom | ( | Definition * | scope, |
FileDef * | fileScope, | ||
Definition * | item | ||
) |
Definition at line 948 of file util.cpp.
int isAccessibleFromWithExpScope | ( | Definition * | scope, |
FileDef * | fileScope, | ||
Definition * | item, | ||
const QCString & | explicitScopePart | ||
) |
Definition at line 1051 of file util.cpp.
QCString langToString | ( | SrcLangExt | lang | ) |
Returns a string representation of lang.
Definition at line 8041 of file util.cpp.
Definition at line 6683 of file util.cpp.
Definition at line 6647 of file util.cpp.
QCString latexEscapePDFString | ( | const char * | s | ) |
Definition at line 6721 of file util.cpp.
void linkifyText | ( | const TextGeneratorIntf & | ol, |
Definition * | scope, | ||
FileDef * | fileScope, | ||
Definition * | self, | ||
const char * | text, | ||
bool | autoBreak = FALSE , |
||
bool | external = TRUE , |
||
bool | keepSpaces = FALSE , |
||
int | indentLevel = 0 |
||
) |
Definition at line 1916 of file util.cpp.
QCString linkToText | ( | SrcLangExt | lang, |
const char * | link, | ||
bool | isFileName | ||
) |
Definition at line 4659 of file util.cpp.
bool matchArguments2 | ( | Definition * | srcScope, |
FileDef * | srcFileScope, | ||
ArgumentList * | srcAl, | ||
Definition * | dstScope, | ||
FileDef * | dstFileScope, | ||
ArgumentList * | dstAl, | ||
bool | checkCV | ||
) |
Definition at line 3647 of file util.cpp.
void mergeArguments | ( | ArgumentList * | , |
ArgumentList * | , | ||
bool | forceNameOverwrite = FALSE |
||
) |
Definition at line 3732 of file util.cpp.
Merges two scope parts together. The parts may (partially) overlap. Example1: A::B
and B::C
will result in A::B::C
Example2: A
and B
will be A::B
Example3: A::B
and B will be A::B
leftScope | the left hand part of the scope. |
rightScope | the right hand part of the scope. |
Definition at line 6287 of file util.cpp.
Definition at line 2527 of file util.cpp.
bool namespaceHasVisibleChild | ( | NamespaceDef * | nd, |
bool | includeClasses | ||
) |
Definition at line 8299 of file util.cpp.
ClassDef* newResolveTypedef | ( | FileDef * | fileScope, |
MemberDef * | md, | ||
MemberDef ** | pMemType, | ||
QCString * | pTemplSpec, | ||
QCString * | pResolvedType, | ||
ArgumentList * | actTemplParams | ||
) |
Returns the class representing the value of the typedef represented by md within file fileScope.
Example: typedef A T; will return the class representing A if it is a class.
Example: typedef int T; will return 0, since "int" is not a class.
Definition at line 535 of file util.cpp.
int nextUtf8CharPosition | ( | const QCString & | utf8Str, |
int | len, | ||
int | startPos | ||
) |
Definition at line 7195 of file util.cpp.
QCString normalizeNonTemplateArgumentsInString | ( | const QCString & | name, |
Definition * | context, | ||
const ArgumentList * | formalArgs | ||
) |
Definition at line 6037 of file util.cpp.
Definition at line 8588 of file util.cpp.
QCString parseCommentAsText | ( | const Definition * | scope, |
const MemberDef * | member, | ||
const QCString & | doc, | ||
const QCString & | fileName, | ||
int | lineNr | ||
) |
Definition at line 7242 of file util.cpp.
Definition at line 7784 of file util.cpp.
bool protectionLevelVisible | ( | Protection | prot | ) |
Definition at line 8098 of file util.cpp.
bool readInputFile | ( | const char * | fileName, |
BufStr & | inBuf, | ||
bool | filter = TRUE , |
||
bool | isSourceCode = FALSE |
||
) |
read a file name fileName and optionally filter and transcode it
Definition at line 7673 of file util.cpp.
QCString relativePathToRoot | ( | const char * | name | ) |
Definition at line 5436 of file util.cpp.
Removes all anonymous scopes from string s Possible examples:
"bla::@10::blep" => "bla::blep" "bla::@10::@11::blep" => "bla::blep" "@10::blep" => "blep" " @10::blep" => "blep" "@9::@10::blep" => "blep" "bla::@1" => "bla" "bla::@1::@2" => "bla" "bla @1" => "bla"
Definition at line 164 of file util.cpp.
Definition at line 1655 of file util.cpp.
Definition at line 191 of file util.cpp.
QCString replaceColorMarkers | ( | const char * | str | ) |
Replaces any markers of the form ##AA in input string str by new markers of the form #AABBCC, where #AABBCC represents a valid color, based on the intensity represented by hex number AA and the current HTML_COLORSTYLE_* settings.
Definition at line 7919 of file util.cpp.
void replaceNamespaceAliases | ( | QCString & | scope, |
int | i | ||
) |
Definition at line 6804 of file util.cpp.
Definition at line 7562 of file util.cpp.
QCString resolveDefines | ( | const char * | n | ) |
bool resolveLink | ( | const char * | scName, |
const char * | lr, | ||
bool | inSeeBlock, | ||
Definition ** | resContext, | ||
QCString & | resAnchor | ||
) |
Definition at line 4753 of file util.cpp.
bool resolveRef | ( | const char * | scName, |
const char * | name, | ||
bool | inSeeBlock, | ||
Definition ** | resContext, | ||
MemberDef ** | resMember, | ||
bool | lookForSpecialization, | ||
FileDef * | currentFile, | ||
bool | checkScope | ||
) |
Returns an object to reference to given its name and context
Definition at line 4479 of file util.cpp.
QCString resolveTypeDef | ( | Definition * | d, |
const QCString & | name, | ||
Definition ** | typedefContext = 0 |
||
) |
Definition at line 346 of file util.cpp.
QCString rtfFormatBmkStr | ( | const char * | name | ) |
Definition at line 6744 of file util.cpp.
Definition at line 146 of file htmlgen.cpp.
void setAnchors | ( | MemberList * | ml | ) |
Definition at line 2254 of file util.cpp.
QCString showFileDefMatches | ( | const FileNameDict * | fnDict, |
const char * | n | ||
) |
Definition at line 5058 of file util.cpp.
Definition at line 218 of file util.cpp.
QCString stripExtension | ( | const char * | fName | ) |
Definition at line 6799 of file util.cpp.
QCString stripExtensionGeneral | ( | const char * | fName, |
const char * | ext | ||
) |
Definition at line 6789 of file util.cpp.
strip part of path if it matches one of the paths in the Config_getList("INCLUDE_PATH") list
Definition at line 306 of file util.cpp.
strip part of path if it matches one of the paths in the Config_getList("STRIP_FROM_PATH") list
Definition at line 298 of file util.cpp.
Definition at line 8110 of file util.cpp.
Special version of QCString::stripWhiteSpace() that only strips completely blank lines.
s | the string to be stripped |
docLine | the line number corresponding to the start of the string. This will be adjusted based on the number of lines stripped from the start. |
Definition at line 6876 of file util.cpp.
QCString stripPath | ( | const char * | s | ) |
Definition at line 6819 of file util.cpp.
QCString stripScope | ( | const char * | name | ) |
Definition at line 5605 of file util.cpp.
QCString stripTemplateSpecifiersFromScope | ( | const QCString & | fullName, |
bool | parentOnly, | ||
QCString * | pLastScopeStripped | ||
) |
Strips template specifiers from scope fullName, except those that make up specialized classes. The switch parentOnly determines whether or not a template "at the end" of a scope should be considered, e.g. with parentOnly is TRUE
, A<T>::B<S> will try to strip <T> and not <S>, while parentOnly is FALSE
will strip both unless A<T> or B<S> are specialized template classes.
Definition at line 6226 of file util.cpp.
substitute all occurrences of src in s by dst
Definition at line 5088 of file util.cpp.
QCString substituteKeywords | ( | const QCString & | s, |
const char * | title, | ||
const char * | projName, | ||
const char * | projNum, | ||
const char * | projBrief | ||
) |
Definition at line 5122 of file util.cpp.
QCString substituteTemplateArgumentsInString | ( | const QCString & | name, |
ArgumentList * | formalArgs, | ||
ArgumentList * | actualArgs | ||
) |
Substitutes any occurrence of a formal argument from argument list formalArgs in name by the corresponding actual argument in argument list actualArgs. The result after substitution is returned as a string. The argument name is used to prevent recursive substitution.
Definition at line 6099 of file util.cpp.
QCString tempArgListToString | ( | ArgumentList * | al, |
SrcLangExt | lang | ||
) |
Definition at line 2197 of file util.cpp.
Definition at line 2374 of file util.cpp.
void writeColoredImgData | ( | const char * | dir, |
ColoredImgDataItem | data[] | ||
) |
Writes the intensity only bitmap representated by data as an image to directory dir using the colors defined by HTML_COLORSTYLE_*.
Definition at line 7889 of file util.cpp.
void writeExample | ( | OutputList & | ol, |
ExampleSDict * | el | ||
) |
Definition at line 2106 of file util.cpp.
void writePageRef | ( | OutputDocInterface & | od, |
const char * | cn, | ||
const char * | mn | ||
) |
Definition at line 247 of file util.cpp.
void writeTypeConstraints | ( | OutputList & | ol, |
Definition * | d, | ||
ArgumentList * | al | ||
) |
Definition at line 7585 of file util.cpp.
const char* writeUtf8Char | ( | FTextStream & | t, |
const char * | s | ||
) |