浏览该文件的文档.
4 #include <unordered_map>
105 int lastDot = defFileName.
findRev(
'.');
108 defFileExt = defFileName.mid(lastDot);
116 if (lname!=
"<globalScope>")
131 sourceRefByDict.clear();
132 sourceRefsDict.clear();
151 if (exclSyms.empty())
return FALSE;
152 std::string symName =
name.
str();
153 for (
const auto &pat : exclSyms)
156 bool forceStart=
FALSE;
158 if (pattern.
at(0)==
'^')
159 pattern=pattern.
mid(1),forceStart=
TRUE;
160 if (pattern.
at(pattern.
length()-1)==
'$')
162 if (pattern.
find(
'*')!=-1)
168 size_t ui =
match.position();
169 size_t pl =
match.length();
170 size_t sl = symName.length();
171 if ((ui==0 || pattern.
at(0)==
'*' || (!
isId(symName.at(ui-1)) && !forceStart)) &&
172 (ui+pl==sl || pattern.
at(pattern.
length()-1)==
'*' || (!
isId(symName.at(ui+pl)) && !forceEnd))
182 size_t i = symName.find(pattern.
str());
183 if (i!=std::string::npos)
186 size_t pl=pattern.
length();
187 size_t sl=symName.length();
189 if ((ui==0 || (!
isId(symName.at(ui-1)) && !forceStart)) &&
190 (ui+pl==sl || (!
isId(symName.at(ui+pl)) && !forceEnd))
225 const char *d,
bool isSymbol)
292 if (
id.isEmpty())
return;
355 int nextLevel = (int)type;
359 for (i=level;i<nextLevel;i++)
364 else if (nextLevel<level)
366 for (i=nextLevel;i<level;i++)
374 auto it_next = std::next(it);
376 ((
int)((*it_next)->type()) > nextLevel) :
FALSE;
409 tagFile <<
">" << si->
label() <<
"</docanchor>\n";
422 MD5Buffer((
const unsigned char *)docStr.
data(),docStr.
length(),md5_sig);
423 MD5SigToString(md5_sig,sigStr);
426 if (sigList.
find(sigStr)==-1)
438 bool stripWhiteSpace,
bool atTop)
491 static OUTPUT_LANGUAGE_t outputLanguage =
Config_getEnum(OUTPUT_LANGUAGE);
492 static bool needsDot = outputLanguage!=OUTPUT_LANGUAGE_t::Japanese &&
493 outputLanguage!=OUTPUT_LANGUAGE_t::Chinese &&
494 outputLanguage!=OUTPUT_LANGUAGE_t::Korean;
501 if (bl>0 && needsDot)
503 int c = brief.
at(bl-1);
506 case '.':
case '!':
case '?':
case '>':
case ':':
case ')':
break;
591 static bool filterSourceFiles =
Config_getBool(FILTER_SOURCE_FILES);
593 bool usePipe = !filter.
isEmpty() && filterSourceFiles;
595 const int blockSize = 4096;
597 auto it = m_cache.find(fileName.
str());
598 if (usePipe && it!=m_cache.end())
600 auto item = it->second;
609 str.
resize(
static_cast<uint>(item.fileSize+1));
617 size_t numBytes = fread(str.
data(),1,item.fileSize,f);
618 if (numBytes!=item.fileSize)
620 err(
"Failed to read %d bytes from position %d in filter database file %s: got %d bytes\n",
639 QCString cmd=filter+
" \""+fileName+
"\"";
657 size_t bytesRead = fread(buf,1,blockSize,f);
658 size_t bytesWritten = fwrite(buf,1,bytesRead,bf);
659 if (bytesRead!=bytesWritten)
662 err(
"Failed to write to filter database %s. Wrote %d out of %d bytes\n",
675 m_cache.insert(std::make_pair(fileName.str(),item));
690 size_t bytesRead = fread(buf,1,blockSize,f);
699 std::unordered_map<std::string,FilterCacheItem>
m_cache;
720 int &startLine,
int &endLine,
QCString &result)
723 static bool filterSourceFiles =
Config_getBool(FILTER_SOURCE_FILES);
725 bool usePipe = !filter.
isEmpty() && filterSourceFiles;
728 const int blockSize = 4096;
743 while (lineNr<startLine && *p)
745 while ((c=*p++)!=
'\n' && c!=0) ;
747 if (found && c ==
'\n') c =
'\0';
753 while (lineNr<=endLine && *p && !found)
756 while ((c=*p++)!=
'{' && c!=
':' && c!=0)
765 col+=tabSize - (col%tabSize);
767 else if (pc==
'/' && c==
'/')
769 while ((c=*p++)!=
'\n' && c!=0) pc=c;
770 if (c==
'\n') lineNr++,col=0;
772 else if (pc==
'/' && c==
'*')
774 while (((c=*p++)!=
'/' || pc!=
'*') && c!=0)
776 if (c==
'\n') lineNr++,col=0;
789 if (cn!=
':') found=
TRUE;
802 if (endLine!=startLine)
805 spaces.
fill(
' ',col);
814 if (cn==
'\n') lineNr++;
816 char lineStr[blockSize];
825 while ((c=*p++) && i<blockSize-1)
833 }
while (size_read == (blockSize-1));
835 }
while (lineNr<=endLine && *p);
838 int newLineIndex = result.
findRev(
'\n');
839 int braceIndex = result.
findRev(
'}');
840 if (braceIndex > newLineIndex)
854 if (!result.
isEmpty() && result.
at(result.
length()-1)!=
'\n') result +=
"\n";
874 const int maxAnchorStrLen = 20;
875 char anchorStr[maxAnchorStrLen];
899 int lineMarkerPos = refText.
find(
"@0");
900 int fileMarkerPos = refText.
find(
"@1");
901 if (lineMarkerPos!=-1 && fileMarkerPos!=-1)
907 if (lineMarkerPos<fileMarkerPos)
913 ol.
parseText(refText.
mid(lineMarkerPos+2,fileMarkerPos-lineMarkerPos-2));
926 ol.
parseText(refText.
mid(fileMarkerPos+2,lineMarkerPos-fileMarkerPos-2));
936 err(
"translation error: invalid markers in trDefinedAtLineInSourceFile()\n");
975 actualStart,actualEnd,codeFragment)
981 intf->resetCodeParserState();
1013 std::transform(map.begin(),map.end(),
1014 std::back_inserter(result),
1015 [](
const auto &item)
1016 { return item.second; }
1019 std::sort(result.
begin(),result.
end(),
1020 [](
const auto &m1,
const auto &m2) { return genericCompareMembers(m1,m2)<0; });
1028 const QCString &text,
const std::unordered_map<std::string,const MemberDef *> &membersMap,
1032 static bool refLinkSource =
Config_getBool(REFERENCES_LINK_SOURCE);
1033 if (!membersMap.empty())
1037 auto replaceFunc = [
this,&members,scopeName,&ol](
size_t entryIndex)
1039 const MemberDef *md=members[entryIndex];
1045 if (!scope.
isEmpty() && scope!=scopeName)
1057 if (sourceBrowser &&
1063 const int maxLineNrStr = 10;
1064 char anchorStr[maxLineNrStr];
1179 err(
"DefinitionImpl::addInnerCompound() called\n");
1263 otherXrefList.begin(),otherXrefList.end());
1268 { return left->id() <right->id() ||
1269 (left->id()==right->id() &&
1270 left->list()->listName() < right->list()->listName());
1276 { return left->id()==right->id() &&
1277 left->list()->listName()==right->list()->listName();
1308 if (!result.
isEmpty()) result+=
"/";
1351 result+=
"<li class=\"navelem\">";
1398 navPath +=
"<div id=\"nav-path\" class=\"navpath\">\n"
1401 navPath +=
" </ul>\n"
1432 int nextLevel = (int)type;
1433 if (nextLevel>level)
1435 for (l=level;l<nextLevel;l++)
1440 else if (nextLevel<level)
1442 for (l=level;l>nextLevel;l--)
1444 if (l <= maxLevel && inLi[l]) ol.
writeString(
"</li>\n");
1449 cs[0]=(char)(
'0'+nextLevel);
1450 if (nextLevel <= maxLevel && inLi[nextLevel])
1455 if (nextLevel <= maxLevel)
1458 "<a href=\"#"+si->
label()+
"\">"+
1461 inLi[nextLevel]=
true;
1465 if (level > maxLevel) level = maxLevel;
1466 while (level>1 && level <= maxLevel)
1476 if (level <= maxLevel && inLi[level]) ol.
writeString(
"</li>\n");
1497 int nextLevel = (int)type;
1498 if (nextLevel>level)
1500 for (l=level;l<nextLevel;l++)
1505 else if (nextLevel<level)
1507 for (l=level;l>nextLevel;l--)
1510 if (l <= maxLevel) ol.
writeString(
" </tocdiv>\n");
1513 if (nextLevel <= maxLevel)
1520 inLi[nextLevel]=
TRUE;
1524 if (level > maxLevel) level = maxLevel;
1525 while (level>1 && level <= maxLevel)
1595 int i=scopelessName.
findRev(
"::");
1596 if (i!=-1) scopelessName=scopelessName.
mid(i+2);
1605 for (
const auto &p : briefDescAbbrev)
1616 if (c>=
'a' && c<=
'z') c+=
'A'-
'a';
1748 if (gd->isLinkable())
return true;
1866 if (!relPath.
isEmpty() && l>0 && result.
at(0)==
'.')
1871 if (l>0 && result.
at(l-1)!=
'/') result+=
'/';
1909 : m_def(def), m_scope(scope), m_symbolName(alias->
_symbolName())
1952 if (dm==0)
return 0;
Definition * toDefinition(DefinitionMutable *dm)
std::vector< std::string > StringVector
void disableAllBut(OutputGenerator::OutputType o)
QCString getReference() const
bool isArtificial() const
QCString getDefFileName() const
void _setSymbolName(const QCString &name)
void writeMarkerList(OutputList &ol, const std::string &markerText, size_t numMarkers, std::function< void(size_t)> replaceFunc)
void setRefItems(const RefItemVector &sli)
GroupDef * toGroupDef(Definition *d)
void writeSummaryLinks(OutputList &) const
FILE * popen(const QCString &name, const QCString &type)
virtual QCString getSourceFileBase() const =0
QCString pathFragment() const
const FileDef * fileDef
file definition containing the function body
#define Config_getEnum(name)
void writeInlineCode(OutputList &ol, const QCString &scopeName) const
void setLanguage(SrcLangExt lang)
The common base class of all entity definitions found in the sources.
FILE * fopen(const QCString &fileName, const QCString &mode)
virtual bool isSignal() const =0
QCString stripScope(const QCString &name)
QCString inbodyFile() const
static void removeFromMap(const QCString &name, Definition *d)
virtual bool isLinkable() const =0
int getEndBodyLine() const
void docify(const QCString &s)
DefinitionImpl(Definition *def, const QCString &defFileName, int defLine, int defColumn, const QCString &name, const char *b=0, const char *d=0, bool isSymbol=TRUE)
QCString briefDescription(bool abbreviate=FALSE) const
Buffer used to store strings
void add(const SectionInfo *si)
Adds a non-owning section reference.
bool isUTF8CharUpperCase(const std::string &input, size_t pos)
Returns true iff the input string at byte position pos holds an upper case character.
uint length() const
Returns the length of the string, not counting the 0-terminator.
static StringMap tagDestinationMap
int findRev(char c, int index=-1, bool cs=TRUE) const
void addInnerCompound(const Definition *d)
bool isEmpty() const
Returns TRUE iff the string is empty
void setBodyDef(const FileDef *fd)
bool match(const std::string &str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
MemberVector referencedByMembers
static IndexList * indexList
std::vector< bool > BoolVector
virtual QCString groupTitle() const =0
const MemberVector & getReferencesMembers() const
void writeString(const QCString &text)
This struct represents an item in the list of references.
const RefItemVector & xrefListItems() const
QCString transcodeCharacterStringToUTF8(const QCString &input)
virtual const DefinitionImpl * toDefinitionImpl_() const =0
MemberDef * toMemberDef(Definition *d)
virtual QCString trDefinedAtLineInSourceFile()=0
SrcLangExt
Language as given by extension
void setBriefDescription(const QCString &b, const QCString &briefFile, int briefLine)
virtual bool isPrototype() const =0
void setDefFileName(const QCString &df)
static NamespaceDefMutable * globalScope
virtual ~DefinitionAliasImpl()
SrcLangExt getLanguage() const
MemberVector referencesMembers
virtual bool isHidden() const =0
bool isLatexEnabled() const
static bool matchExcludedSymbols(const QCString &name)
QCString inbodyDocumentation() const
void mergeReferencedBy(const Definition *other)
void err(const char *fmt,...)
const_iterator end() const
void writeSourceRefs(OutputList &ol, const QCString &scopeName) const
char & at(size_t i)
Returns a reference to the character at index i.
Text streaming class that buffers data.
QCString externalReference(const QCString &relPath) const
int find(char c, int index=0, bool cs=TRUE) const
virtual QCString trRTFTableOfContents()=0
int _getXRefListId(const QCString &listName) const
virtual QCString pathFragment() const =0
static FilterCache g_filterCache
void writeNavigationPath(OutputList &ol) const
QCString getSourceFileBase() const
static QCString abbreviate(const QCString &s, const QCString &name)
SectionType
enum representing the various types of sections and entities that can be referred to.
void _setBriefDescription(const QCString &b, const QCString &briefFile, int briefLine)
void _setInbodyDocumentation(const QCString &d, const QCString &docFile, int docLine)
virtual QCString getReference() const =0
bool isLinkableViaGroup() const
void setDefinition(Definition *d)
bool isDocbookEnabled() const
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
virtual bool isObjCMethod() const =0
bool hasUserDocumentation() const
static SymbolMap< Definition > * symbolMap
Data associated with description found in the body.
QCString localName() const
DirIterator end(const DirIterator &) noexcept
PageDef * toPageDef(Definition *d)
virtual bool isLinkable() const =0
virtual ~DefinitionImpl()
A model of a group of symbols.
DefinitionMutable * toDefinitionMutable(Definition *d)
virtual QCString anchor() const =0
virtual const FileDef * getBodyDef() const =0
Class representing a list of output generators that are written to in parallel.
virtual QCString qualifiedName() const =0
QCString addHtmlExtensionIfMissing(const QCString &fName)
A model of a class/file/namespace member symbol.
Data associated with a detailed description.
Private data associated with a Symbol DefinitionImpl object.
void setDocumentation(const QCString &d, const QCString &docFile, int docLine, bool stripWhiteSpace=TRUE)
Definition * getOuterScope() const
void setInbodyDocumentation(const QCString &d, const QCString &docFile, int docLine)
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
int getStartDefLine() const
#define Config_getInt(name)
void _setDocumentation(const QCString &d, const QCString &docFile, int docLine, bool stripWhiteSpace, bool atTop)
QCString left(size_t len) const
virtual QCString name() const =0
void addContentsItem(bool isDir, const QCString &name, const QCString &ref, const QCString &file, const QCString &anchor, bool separateIndex=FALSE, bool addToNavIndex=FALSE, const Definition *def=0)
const_iterator begin() const
static ParserManager * parserManager
void mergeRefItems(Definition *d)
void _writeSourceRefList(OutputList &ol, const QCString &scopeName, const QCString &text, const std::unordered_map< std::string, const MemberDef * > &members, bool) const
virtual QCString trReferences()=0
static void print(DebugMask mask, int prio, const char *fmt,...)
Data associated with a brief description.
virtual bool isSlot() const =0
RefItemVector xrefListItems
void addSourceReferences(const MemberDef *d)
QCString simplifyWhiteSpace() const
return a copy of this string with leading and trailing whitespace removed and multiple whitespace cha...
bool _docsAlreadyAdded(const QCString &doc, QCString &sigList)
Translator * theTranslator
virtual QCString displayName(bool includeScope=TRUE) const =0
const Definition * findInnerCompound(const QCString &name) const
virtual QCString name() const =0
QCString _symbolName() const
singleton class that owns the list of all sections
QCString parseCommentAsText(const Definition *scope, const MemberDef *md, const QCString &doc, const QCString &fileName, int lineNr)
bool lastUTF8CharIsMultibyte(const std::string &input)
Returns true iff the last character in input is a multibyte character.
static void addToMap(const QCString &name, Definition *d)
void init(const QCString &df, const QCString &n)
QCString getLanguageSpecificSeparator(SrcLangExt lang, bool classScope)
Returns the scope separator to use given the programming language lang
int computeQualifiedIndex(const QCString &name)
virtual bool isFunction() const =0
bool readCodeFragment(const QCString &fileName, int &startLine, int &endLine, QCString &result)
Reads a fragment from file fileName starting with line startLine and ending with line endLine.
void setLocalName(const QCString &name)
QCString fileName() const
Object representing the matching results.
std::unique_ptr< CodeParserInterface > getCodeParser(const QCString &extension)
Gets the interface to the parser associated with a given extension.
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
virtual QCString getOutputFileBase() const =0
QCString listName() const
bool hasSourceReffedBy() const
virtual int getStartBodyLine() const =0
A vector of MemberDef object
void setOuterScope(Definition *d)
int endLine
line number of the end of the definition's body
void add(const QCString &name, Ptr def)
Add a symbol def into the map under key name
virtual bool hasTitle() const =0
QCString briefFile() const
QCString qualifiedName() const
virtual QCString navigationPathAsString() const =0
QCString getSourceAnchor() const
const T * find(const std::string &key) const
Find an object given the key.
int startLine
line number of the start of the definition's body
bool fill(char c, int len=-1)
Fills a string with a predefined character
virtual QCString trReferencedBy()=0
void writeNavigationPath(const QCString &s)
SectionInfo * add(const SectionInfo &si)
Add a new section given the data of an existing section.
void addArray(const char *a, uint len)
void setBodySegment(int defLine, int bls, int ble)
virtual DefType definitionType() const =0
const GroupList & partOfGroups() const
bool truncate(size_t pos)
Truncates the string at position pos.
portable_off_t fseek(FILE *f, portable_off_t offset, int whence)
Various UTF8 related helper functions.
void startCodeFragment(const QCString &style)
void addSectionsToDefinition(const std::vector< const SectionInfo * > &anchorList)
void makePartOfGroup(const GroupDef *gd)
void addSourceReferencedBy(const MemberDef *d)
void remove(const QCString &name, Ptr def)
Remove a symbol def from the map that was stored under key name
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
QCString documentation() const
QCString getDefFileExtension() const
static QCString filterDBFileName
QCString symbolName() const
void writeSourceDef(OutputList &ol, const QCString &scopeName) const
std::vector< RefItem * > RefItemVector
virtual QCString getOutputFileBase() const =0
void setName(const QCString &name)
void writeToc(OutputList &ol, const LocalToc <) const
virtual QCString anchor() const =0
QCString qualifiedName() const
#define Config_getBool(name)
std::unordered_map< std::string, const MemberDef * > sourceRefsDict
bool isHtmlEnabled() const
const Definition * m_scope
const SectionInfo * find(const QCString &label) const
Returns a constant pointer to the section info given a section label or nullptr if no section with th...
virtual QCString getScopeString() const =0
static SectionManager & instance()
returns a reference to the singleton
void setDefFile(const QCString &df, int defLine, int defColumn)
void addSectionsToIndex()
Class representing a regular expression.
void writeQuickMemberLinks(OutputList &, const MemberDef *) const
const MemberVector & getReferencedByMembers() const
void mergeReferences(const Definition *other)
virtual Definition * getOuterScope() const =0
virtual void _setSymbolName(const QCString &name)=0
bool hasBriefDescription() const
bool startsWith(const char *s) const
void parseText(const QCString &textStr)
virtual QCString absFilePath() const =0
const char * qPrint(const char *s)
class that represents a list of constant references to sections.
QCString stripLeadingAndTrailingEmptyLines(const QCString &s, int &docLine)
Special version of QCString::stripWhiteSpace() that only strips completely blank lines.
bool hasDocumentation() const
bool getFileContents(const QCString &fileName, BufStr &str)
QCString navigationPathAsString() const
constexpr bool isSection(SectionType type)
return true if type is a section, and false if it is a page, anchor or table.
QCString briefDescriptionAsTooltip() const
class that provide information about a section.
QCString convertToDocBook(const QCString &s)
void writeDocAnchorsToTagFile(TextStream &) const
virtual Definition * toDefinition_()=0
void pushGeneratorState()
bool isVisibleInProject() const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string
QCString convertToXML(const QCString &s, bool keepEntities)
void setArtificial(bool b)
A model of a file symbol.
virtual QCString title() const =0
FileDef * toFileDef(Definition *d)
virtual DefinitionMutable * toDefinitionMutable_()=0
const SectionRefs & getSectionRefs() const
virtual bool isLinkableInProject() const =0
void writeObjectLink(const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name)
virtual const RefItemVector & xrefListItems() const =0
std::unordered_map< std::string, const MemberDef * > sourceRefByDict
bool hasSourceRefs() const
void setReference(const QCString &r)
void writeSourceReffedBy(OutputList &ol, const QCString &scopeName) const
Portable versions of functions that are platform dependent.
virtual DirDef * getDirDef() const =0
bool search(const std::string &str, Match &match, const Ex &re, size_t pos)
Search in a given string str starting at position pos for a match against regular expression re.
std::unordered_map< std::string, FilterCacheItem > m_cache
static bool stripWord(QCString &s, QCString w)
A bunch of utility functions.
QCString getFileFilter(const QCString &name, bool isSourceCode)
virtual QCString localName() const =0
int defLine
line number of the start of the definition
QCString right(size_t len) const
void endCodeFragment(const QCString &style)
QCString & prepend(const char *s)
bool resize(size_t newlen)
Resizes the string to hold newlen characters (this value should also count the 0-terminator).
QCString & sprintf(const char *format,...)
QCString convertToHtml(const QCString &s, bool keepEntities)
static MemberVector refMapToVector(const std::unordered_map< std::string, const MemberDef * > &map)
const FileDef * getBodyDef() const
void startParagraph(const QCString &classDef=QCString())
static ClangUsrMap * clangUsrMap
void setId(const QCString &name)
#define Config_getList(name)
virtual QCString trWriteList(int numEntries)=0
DefinitionAliasImpl(Definition *def, const Definition *scope, const Definition *alias)
int getStartBodyLine() const
This is an alternative implementation of QCString.