Doxygen
Loading...
Searching...
No Matches
definition.cpp
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2023 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 * Documents produced by Doxygen are derivative works derived from the
12 * input used in their production; they are not affected by this license.
13 *
14 */
15
16#include <algorithm>
17#include <iterator>
18#include <unordered_map>
19#include <string>
20#include <optional>
21#include <cctype>
22#include <cstdio>
23#include <cstdlib>
24#include <cassert>
25
26#include "anchor.h"
27#include "md5.h"
28#include "regex.h"
29#include "config.h"
30#include "definitionimpl.h"
31#include "doxygen.h"
32#include "language.h"
33#include "message.h"
34#include "portable.h"
35#include "outputlist.h"
36#include "code.h"
37#include "util.h"
38#include "groupdef.h"
39#include "pagedef.h"
40#include "section.h"
41#include "htags.h"
42#include "parserintf.h"
43#include "debug.h"
44#include "vhdldocgen.h"
45#include "memberlist.h"
46#include "namespacedef.h"
47#include "filedef.h"
48#include "dirdef.h"
49#include "pagedef.h"
50#include "reflist.h"
51#include "utf8.h"
52#include "indexlist.h"
53#include "fileinfo.h"
54
55//-----------------------------------------------------------------------------------------
56
57/** Private data associated with a Symbol DefinitionImpl object. */
59{
60 public:
61 void init(const QCString &df, const QCString &n);
62 void setDefFileName(const QCString &df);
63
64 Definition *def = nullptr;
65
67
68 std::unordered_map<std::string,MemberDef *> sourceRefByDict;
69 std::unordered_map<std::string,MemberDef *> sourceRefsDict;
72
73 std::optional<DocInfo> details; // not exported
74 std::optional<DocInfo> inbodyDocs; // not exported
75 std::optional<BriefInfo> brief; // not exported
76 std::optional<BodyInfo> body; // not exported
77
80
81 QCString localName; // local (unqualified) name of the definition
82 // in the future m_name should become m_localName
84 QCString ref; // reference to external documentation
85
86 bool hidden = FALSE;
90
91 Definition *outerScope = nullptr; // not owner
92
93 // where the item was defined
96
97 SrcLangExt lang = SrcLangExt::Unknown;
98
99 QCString id; // clang unique id
100
106
107 MemberVector referencesMembers; // cache for getReferencesMembers()
108 MemberVector referencedByMembers; // cache for getReferencedByMembers()
109};
110
111
113{
114 defFileName = df;
115 FileInfo fi(df.data());
116 QCString ext = fi.extension(false);
117 if (!ext.isEmpty()) defFileExt = "." + ext;
118}
119
121{
122 setDefFileName(df);
123 if (n!="<globalScope>")
124 {
125 //extractNamespaceName(m_name,m_localName,ns);
127 }
128 else
129 {
130 localName=n;
131 }
132 //printf("localName=%s\n",qPrint(localName));
133
134 brief.reset();
135 details.reset();
136 body.reset();
137 inbodyDocs.reset();
138 sourceRefByDict.clear();
139 sourceRefsDict.clear();
141 hidden = FALSE;
144 lang = SrcLangExt::Unknown;
145}
146
147void DefinitionImpl::setDefFile(const QCString &df,int defLine,int defCol)
148{
149 p->setDefFileName(df);
150 p->defLine = defLine;
151 p->defColumn = defCol;
152}
153
154//-----------------------------------------------------------------------------------------
155
157{
158 const StringVector &exclSyms = Config_getList(EXCLUDE_SYMBOLS);
159 if (exclSyms.empty()) return FALSE; // nothing specified
160 const std::string &symName = name.str();
161 for (const auto &pat : exclSyms)
162 {
163 QCString pattern = pat;
164 bool forceStart=FALSE;
165 bool forceEnd=FALSE;
166 if (pattern.at(0)=='^')
167 {
168 pattern = pattern.mid(1);
169 forceStart = true;
170 }
171 if (pattern.at(pattern.length() - 1) == '$')
172 {
173 pattern = pattern.left(pattern.length() - 1);
174 forceEnd = true;
175 }
176 if (pattern.find('*')!=-1) // wildcard mode
177 {
178 const reg::Ex re(substitute(pattern,"*",".*").str());
179 reg::Match match;
180 if (reg::search(symName,match,re)) // wildcard match
181 {
182 size_t ui = match.position();
183 size_t pl = match.length();
184 size_t sl = symName.length();
185 if ((ui==0 || pattern.at(0)=='*' || (!isId(symName.at(ui-1)) && !forceStart)) &&
186 (ui+pl==sl || pattern.at(pattern.length()-1)=='*' || (!isId(symName.at(ui+pl)) && !forceEnd))
187 )
188 {
189 //printf("--> name=%s pattern=%s match at %d\n",qPrint(symName),qPrint(pattern),i);
190 return TRUE;
191 }
192 }
193 }
194 else if (!pattern.isEmpty()) // match words
195 {
196 size_t i = symName.find(pattern.str());
197 if (i!=std::string::npos) // we have a match!
198 {
199 size_t ui=i;
200 size_t pl=pattern.length();
201 size_t sl=symName.length();
202 // check if it is a whole word match
203 if ((ui==0 || (!isId(symName.at(ui-1)) && !forceStart)) &&
204 (ui+pl==sl || (!isId(symName.at(ui+pl)) && !forceEnd))
205 )
206 {
207 //printf("--> name=%s pattern=%s match at %d\n",qPrint(symName),qPrint(pattern),i);
208 return TRUE;
209 }
210 }
211 }
212 }
213 //printf("--> name=%s: no match\n",name);
214 return FALSE;
215}
216
217static void addToMap(const QCString &name,Definition *d)
218{
219 bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL);
222 if (!vhdlOpt && index!=-1) symbolName=symbolName.mid(index+2);
223 if (!symbolName.isEmpty())
224 {
225 //printf("adding symbol %s\n",qPrint(symbolName));
227
229 }
230}
231
232static void removeFromMap(const QCString &name,Definition *d)
233{
234 Doxygen::symbolMap->remove(name,d);
235}
236
238 const QCString &df,int dl,int dc,
239 const QCString &name,const char *b,
240 const char *d,bool isSymbol)
241 : p(std::make_unique<Private>())
242{
243 setName(name);
244 p->def = def;
245 p->defLine = dl;
246 p->defColumn = dc;
247 p->init(df,name);
248 p->isSymbol = isSymbol;
249 if (isSymbol) addToMap(name,def);
250 _setBriefDescription(b,df,dl);
253 {
254 p->hidden = TRUE;
255 }
256}
257
259 : p(std::make_unique<Private>(*d.p))
260{
261 if (p->isSymbol) addToMap(p->name,p->def);
262}
263
265{
266 if (this!=&other)
267 {
268 p = std::make_unique<Private>(*other.p);
269 }
270 return *this;
271}
272
274{
275 if (p->isSymbol)
276 {
277 removeFromMap(p->symbolName,p->def);
278 }
279}
280
282{
283 if (name.isEmpty()) return;
284 p->name = name;
285 p->isAnonymous = p->name.isEmpty() ||
286 p->name.at(0)=='@' ||
287 p->name.find("::@")!=-1;
288}
289
291{
292 if (id.isEmpty()) return;
293 p->id = id;
295 {
296 //printf("DefinitionImpl::setId '%s'->'%s'\n",id,qPrint(p->name));
297 Doxygen::clangUsrMap->emplace(id.str(),p->def);
298 }
299}
302{
303 return p->id;
304}
305
306void DefinitionImpl::addSectionsToDefinition(const std::vector<const SectionInfo*> &anchorList)
307{
308 //printf("%s: addSectionsToDefinition(%d)\n",qPrint(name()),anchorList->count());
309 for (const SectionInfo *si : anchorList)
310 {
311 //printf("Add section '%s' to definition '%s'\n",
312 // qPrint(si->label()),qPrint(name()));
314 SectionInfo *gsi=sm.find(si->label());
315 //printf("===== label=%s gsi=%p\n",qPrint(si->label()),(void*)gsi);
316 if (gsi==nullptr)
317 {
318 gsi = sm.add(*si);
319 }
320 if (p->sectionRefs.find(gsi->label())==nullptr)
321 {
322 p->sectionRefs.add(gsi);
323 }
324 gsi->setDefinition(p->def);
325 }
326}
327
329{
330 //printf("DefinitionImpl::hasSections(%s) #sections=%zu\n",qPrint(name()), p->sectionRefs.size());
331 if (p->sectionRefs.empty()) return FALSE;
332 for (const SectionInfo *si : p->sectionRefs)
333 {
334 if (si->type().isSection())
335 {
336 return TRUE;
337 }
338 }
339 return FALSE;
340}
341
343{
344 if (!p->sectionRefs.empty())
345 {
346 //printf("%s: writeDocAnchorsToTagFile(%d)\n",qPrint(name()),p->sectionRef.size());
347 for (const SectionInfo *si : p->sectionRefs)
348 {
349 if (!si->generated() && si->ref().isEmpty() && !AnchorGenerator::instance().isGenerated(si->label().str()))
350 {
351 //printf("write an entry!\n");
352 if (p->def->definitionType()==Definition::TypeMember) tagFile << " ";
353 QCString fn = si->fileName();
355 tagFile << " <docanchor file=\"" << fn << "\"";
356 if (!si->title().isEmpty())
357 {
358 tagFile << " title=\"" << convertToXML(si->title()) << "\"";
359 }
360 tagFile << ">" << si->label() << "</docanchor>\n";
361 }
362 }
363 }
364}
365
367{
368 uint8_t md5_sig[16];
369 char sigStr[33];
370 // to avoid mismatches due to differences in indenting, we first remove
371 // double whitespaces...
372 QCString docStr = doc.simplifyWhiteSpace();
373 MD5Buffer(docStr.data(),static_cast<unsigned int>(docStr.length()),md5_sig);
374 MD5SigToString(md5_sig,sigStr);
375 //printf("%s:_docsAlreadyAdded doc='%s' sig='%s' docSigs='%s'\n",
376 // qPrint(name()),qPrint(doc),qPrint(sigStr),qPrint(sigList));
377 if (sigList.find(sigStr)==-1) // new docs, add signature to prevent re-adding it
378 {
379 sigList+=QCString(":")+sigStr;
380 return FALSE;
381 }
382 else
383 {
384 return TRUE;
385 }
386}
387
389 bool stripWhiteSpace,bool atTop)
390{
391 //printf("%s::setDocumentation(%s,%s,%d,%d)\n",qPrint(name()),d,docFile,docLine,stripWhiteSpace);
392 if (d.isEmpty()) return;
393 QCString doc = d;
394 if (stripWhiteSpace)
395 {
397 }
398 else // don't strip whitespace
399 {
400 doc=d;
401 }
402 if (!_docsAlreadyAdded(doc,p->docSignatures))
403 {
404 //printf("setting docs for %s: '%s'\n",qPrint(name()),qPrint(m_doc));
405 if (!p->details.has_value())
406 {
407 p->details = std::make_optional<DocInfo>();
408 }
409 DocInfo &details = p->details.value();
410 if (details.doc.isEmpty()) // fresh detailed description
411 {
412 details.doc = doc;
413 }
414 else if (atTop) // another detailed description, append it to the start
415 {
416 details.doc = doc+"\n\n"+details.doc;
417 }
418 else // another detailed description, append it to the end
419 {
420 details.doc += "\n\n"+doc;
421 }
422 if (docLine!=-1) // store location if valid
423 {
424 details.file = docFile;
425 details.line = docLine;
426 }
427 else
428 {
429 details.file = docFile;
430 details.line = 1;
431 }
432 }
433}
434
440
442{
443 QCString brief = b;
444 brief = brief.stripWhiteSpace();
446 brief = brief.stripWhiteSpace();
447 if (brief.isEmpty()) return;
448 size_t bl = brief.length();
449 if (bl>0)
450 {
451 if (!theTranslator || theTranslator->needsPunctuation()) // add punctuation if needed
452 {
453 int c = brief.at(bl-1);
454 switch(c)
455 {
456 case '.': case '!': case '?': case ':': break;
457 default:
458 if (isUTF8CharUpperCase(brief.str(),0) && !lastUTF8CharIsMultibyte(brief.str())) brief+='.';
459 break;
460 }
461 }
462 }
463
464 if (!_docsAlreadyAdded(brief,p->briefSignatures))
465 {
466 if (p->brief && !p->brief->doc.isEmpty())
467 {
468 //printf("adding to details\n");
470 }
471 else
472 {
473 //fprintf(stderr,"DefinitionImpl::setBriefDescription(%s,%s,%d)\n",b,briefFile,briefLine);
474 if (!p->brief.has_value())
475 {
476 p->brief = std::make_optional<BriefInfo>();
477 }
478 BriefInfo &briefInfo = p->brief.value();
479 briefInfo.doc=brief;
480 if (briefLine!=-1)
481 {
482 briefInfo.file = briefFile;
483 briefInfo.line = briefLine;
484 }
485 else
486 {
487 briefInfo.file = briefFile;
488 briefInfo.line = 1;
489 }
490 }
491 }
492 else
493 {
494 //printf("do nothing!\n");
495 }
496}
497
503
505{
506 if (!_docsAlreadyAdded(doc,p->docSignatures))
507 {
508 if (!p->inbodyDocs.has_value())
509 {
510 p->inbodyDocs = std::make_optional<DocInfo>();
511 }
512 DocInfo &inbodyDocs = p->inbodyDocs.value();
513 if (inbodyDocs.doc.isEmpty()) // fresh inbody docs
514 {
515 inbodyDocs.doc = doc;
516 inbodyDocs.file = inbodyFile;
517 inbodyDocs.line = inbodyLine;
518 }
519 else // another inbody documentation fragment, append this to the end
520 {
521 inbodyDocs.doc += QCString("\n\n")+doc;
522 }
523 }
524}
525
531
532//---------------------------------------
533
534/*! Cache for storing the result of filtering a file */
536{
537 private:
539 {
540 size_t filePos;
541 size_t fileSize;
542 };
543 using LineOffsets = std::vector<size_t>;
544
545 public:
546 static FilterCache &instance();
547
548 //! collects the part of file \a fileName starting at \a startLine and ending at \a endLine into
549 //! buffer \a str. Applies filtering if FILTER_SOURCE_FILES is enabled and the file extension
550 //! matches a filter. Caches file information so that subsequent extraction of blocks from
551 //! the same file can be performed efficiently
552 bool getFileContents(const QCString &fileName,size_t startLine,size_t endLine, std::string &str)
553 {
554 bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES);
555 QCString filter = getFileFilter(fileName,TRUE);
556 bool usePipe = !filter.isEmpty() && filterSourceFiles;
557 return usePipe ? getFileContentsPipe(fileName,filter,startLine,endLine,str)
558 : getFileContentsDisk(fileName,startLine,endLine,str);
559 }
560 private:
561 bool getFileContentsPipe(const QCString &fileName,const QCString &filter,
562 size_t startLine,size_t endLine,std::string &str)
563 {
564 std::unique_lock<std::mutex> lock(m_mutex);
565 auto it = m_cache.find(fileName.str());
566 if (it!=m_cache.end()) // cache hit: reuse stored result
567 {
568 lock.unlock();
569 auto item = it->second;
570 //printf("getFileContents(%s): cache hit\n",qPrint(fileName));
571 // file already processed, get the results after filtering from the tmp file
572 Debug::print(Debug::FilterOutput,0,"Reusing filter result for {} from {} at offset={} size={}\n",
573 fileName,Doxygen::filterDBFileName,item.filePos,item.fileSize);
574
575 auto it_off = m_lineOffsets.find(fileName.str());
576 assert(it_off!=m_lineOffsets.end());
577 auto [ startLineOffset, fragmentSize] = getFragmentLocation(it_off->second,startLine,endLine);
578 //printf("%s: existing file [%zu-%zu]->[%zu-%zu] size=%zu\n",
579 // qPrint(fileName),startLine,endLine,startLineOffset,endLineOffset,fragmentSize);
581 item.filePos+startLineOffset, fragmentSize);
582 return true;
583 }
584 else // cache miss: filter active but file not previously processed
585 {
586 //printf("getFileContents(%s): cache miss\n",qPrint(fileName));
587 // filter file
588 QCString cmd=filter+" \""+fileName+"\"";
589 Debug::print(Debug::ExtCmd,0,"Executing popen(`{}`)\n",cmd);
590 FILE *f = Portable::popen(cmd,"r");
591 if (f==nullptr)
592 {
593 // handle error
594 err("Error opening filter pipe command '{}'\n",cmd);
595 return false;
596 }
598 FilterCacheItem item;
599 item.filePos = m_endPos;
600 if (bf==nullptr)
601 {
602 // handle error
603 err("Error opening filter database file {}\n",Doxygen::filterDBFileName);
605 return false;
606 }
607 // append the filtered output to the database file
608 size_t size=0;
609 while (!feof(f))
610 {
611 const int blockSize = 4096;
612 char buf[blockSize];
613 size_t bytesRead = fread(buf,1,blockSize,f);
614 size_t bytesWritten = fwrite(buf,1,bytesRead,bf);
615 if (bytesRead!=bytesWritten)
616 {
617 // handle error
618 err("Failed to write to filter database {}. Wrote {} out of {} bytes\n",
619 Doxygen::filterDBFileName,bytesWritten,bytesRead);
621 fclose(bf);
622 return false;
623 }
624 size+=bytesWritten;
625 str+=std::string_view(buf,bytesWritten);
626 }
627 item.fileSize = size;
628 // add location entry to the dictionary
629 m_cache.emplace(fileName.str(),item);
630 Debug::print(Debug::FilterOutput,0,"Storing new filter result for {} in {} at offset={} size={}\n",
631 fileName,Doxygen::filterDBFileName,item.filePos,item.fileSize);
632 // update end of file position
633 m_endPos += size;
635 fclose(bf);
636
637 // shrink buffer to [startLine..endLine] part
638 shrinkBuffer(str,fileName,startLine,endLine);
639 }
640 return true;
641 }
642
643 //! reads the fragment start at \a startLine and ending at \a endLine from file \a fileName
644 //! into buffer \a str
645 bool getFileContentsDisk(const QCString &fileName,size_t startLine,size_t endLine,std::string &str)
646 {
647 std::unique_lock<std::mutex> lock(m_mutex);
648 // normal file
649 //printf("getFileContents(%s): no filter\n",qPrint(fileName));
650 auto it = m_lineOffsets.find(fileName.str());
651 if (it == m_lineOffsets.end()) // new file
652 {
653 // read file completely into str buffer
654 readFragmentFromFile(str,fileName,0);
655 // shrink buffer to [startLine..endLine] part
656 shrinkBuffer(str,fileName,startLine,endLine);
657 }
658 else // file already processed before
659 {
660 lock.unlock();
661 auto [ startLineOffset, fragmentSize] = getFragmentLocation(it->second,startLine,endLine);
662 //printf("%s: existing file [%zu-%zu] -> start=%zu size=%zu\n",
663 // qPrint(fileName),startLine,endLine,startLineOffset,fragmentSize);
664 readFragmentFromFile(str,fileName,startLineOffset,fragmentSize);
665 }
666 return true;
667 }
668
669 //! computes the starting offset for each line for file \a fileName, whose contents should
670 //! already be stored in buffer \a str.
671 void compileLineOffsets(const QCString &fileName,const std::string &str)
672 {
673 // line 1 (index 0) is at offset 0
674 auto it = m_lineOffsets.emplace(fileName.data(),LineOffsets{0}).first;
675 const char *p=str.data();
676 while (*p)
677 {
678 char c=0;
679 while ((c=*p)!='\n' && c!=0) p++; // search until end of the line
680 if (c!=0) p++;
681 it->second.push_back(p-str.data());
682 }
683 }
684
685 //! Returns the byte offset and size within a file of a fragment given the array of
686 //! line offsets and the start and end line of the fragment.
687 auto getFragmentLocation(const LineOffsets &lineOffsets,
688 size_t startLine,size_t endLine) -> std::tuple<size_t,size_t>
689 {
690 assert(startLine > 0);
691 assert(startLine <= endLine);
692 const size_t startLineOffset = lineOffsets[std::min(startLine-1,lineOffsets.size()-1)];
693 const size_t endLineOffset = lineOffsets[std::min(endLine, lineOffsets.size()-1)];
694 assert(startLineOffset <= endLineOffset);
695 const size_t fragmentSize = endLineOffset-startLineOffset;
696 return std::tie(startLineOffset,fragmentSize);
697 }
698
699 //! Shrinks buffer \a str which should hold the contents of \a fileName to the
700 //! fragment starting a line \a startLine and ending at line \a endLine
701 void shrinkBuffer(std::string &str,const QCString &fileName,size_t startLine,size_t endLine)
702 {
703 // compute offsets from start for each line
704 compileLineOffsets(fileName,str);
705 auto it = m_lineOffsets.find(fileName.str());
706 assert(it!=m_lineOffsets.end());
707 const LineOffsets &lineOffsets = it->second;
708 auto [ startLineOffset, fragmentSize] = getFragmentLocation(lineOffsets,startLine,endLine);
709 //printf("%s: new file [%zu-%zu]->[%zu-%zu] size=%zu\n",
710 // qPrint(fileName),startLine,endLine,startLineOffset,endLineOffset,fragmentSize);
711 str.erase(0,startLineOffset);
712 str.resize(fragmentSize);
713 }
714
715 //! Reads the fragment start at byte offset \a startOffset of file \a fileName into buffer \a str.
716 //! Result will be a null terminated. If size==0 the whole file will be read and startOffset is ignored.
717 //! If size>0, size bytes will be read.
718 void readFragmentFromFile(std::string &str,const QCString &fileName,size_t startOffset,size_t size=0)
719 {
720 std::ifstream ifs = Portable::openInputStream(fileName,true,true);
721 if (size==0) { startOffset=0; size = static_cast<size_t>(ifs.tellg()); }
722 ifs.seekg(startOffset, std::ios::beg);
723 str.resize(size);
724 ifs.read(str.data(), size);
725 }
726
728 std::unordered_map<std::string,FilterCacheItem> m_cache;
729 std::unordered_map<std::string,LineOffsets> m_lineOffsets;
730 std::mutex m_mutex;
731 size_t m_endPos;
732};
733
735{
736 static FilterCache theInstance;
737 return theInstance;
738}
739
740//-----------------------------------------
741
742
743/*! Reads a fragment of code from file \a fileName starting at
744 * line \a startLine and ending at line \a endLine (inclusive). The fragment is
745 * stored in \a result. If FALSE is returned the code fragment could not be
746 * found.
747 *
748 * The file is scanned for a opening bracket ('{') from \a startLine onward
749 * The line actually containing the bracket is returned via startLine.
750 * The file is scanned for a closing bracket ('}') from \a endLine backward.
751 * The line actually containing the bracket is returned via endLine.
752 * Note that for VHDL code the bracket search is not done.
753 */
754bool readCodeFragment(const QCString &fileName,bool isMacro,
755 int &startLine,int &endLine,QCString &result)
756{
757 bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES);
758 QCString filter = getFileFilter(fileName,TRUE);
759 bool usePipe = !filter.isEmpty() && filterSourceFiles;
760 int tabSize = Config_getInt(TAB_SIZE);
761 SrcLangExt lang = getLanguageFromFileName(fileName);
762 const int blockSize = 4096;
763 std::string str;
765 static_cast<size_t>(std::max(1,startLine)),
766 static_cast<size_t>(std::max({1,startLine,endLine})),str);
767 //printf("readCodeFragment(%s,startLine=%d,endLine=%d)=\n[[[\n%s]]]\n",qPrint(fileName),startLine,endLine,qPrint(str));
768
769 bool found = lang==SrcLangExt::VHDL ||
770 lang==SrcLangExt::Python ||
771 lang==SrcLangExt::Fortran ||
772 isMacro;
773 // for VHDL, Python, and Fortran no bracket search is possible
774 char *p=str.data();
775 if (p && *p)
776 {
777 char c=0;
778 int col=0;
779 int lineNr=startLine;
780 // skip until the opening bracket or lonely : is found
781 char cn=0;
782 while (*p && !found)
783 {
784 int pc=0;
785 while ((c=*p++)!='{' && c!=':' && c!=0)
786 {
787 //printf("parsing char '%c'\n",c);
788 if (c=='\n')
789 {
790 lineNr++;
791 col = 0;
792 }
793 else if (c=='\t')
794 {
795 col+=tabSize - (col%tabSize);
796 }
797 else if (pc=='/' && c=='/') // skip single line comment
798 {
799 while ((c=*p++)!='\n' && c!=0);
800 if (c == '\n')
801 {
802 lineNr++;
803 col = 0;
804 }
805 }
806 else if (pc=='/' && c=='*') // skip C style comment
807 {
808 while (((c=*p++)!='/' || pc!='*') && c!=0)
809 {
810 if (c == '\n')
811 {
812 lineNr++;
813 col = 0;
814 }
815 pc=c;
816 }
817 }
818 else
819 {
820 col++;
821 }
822 pc = c;
823 }
824 if (c==':')
825 {
826 cn=*p++;
827 if (cn!=':') found=TRUE;
828 }
829 else if (c=='{')
830 {
831 found=TRUE;
832 }
833 else if (c==0)
834 {
835 break;
836 }
837 }
838 //printf(" -> readCodeFragment(%s,%d,%d) lineNr=%d\n",fileName,startLine,endLine,lineNr);
839 if (found)
840 {
841 // For code with more than one line,
842 // fill the line with spaces until we are at the right column
843 // so that the opening brace lines up with the closing brace
844 if (endLine!=startLine)
845 {
846 QCString spaces;
847 spaces.fill(' ',col);
848 result+=spaces;
849 }
850 // copy until end of line
851 if (c) result+=c;
852 startLine=lineNr;
853 if (c==':')
854 {
855 result+=cn;
856 if (cn=='\n') lineNr++;
857 }
858 char lineStr[blockSize];
859 do
860 {
861 //printf("reading line %d in range %d-%d\n",lineNr,startLine,endLine);
862 int size_read=0;
863 do
864 {
865 // read up to blockSize-1 non-zero characters
866 int i=0;
867 while ((c=*p) && i<blockSize-1)
868 {
869 lineStr[i++]=c;
870 p++;
871 if (c=='\n') break; // stop at end of the line
872 }
873 lineStr[i]=0;
874 size_read=i;
875 result+=lineStr; // append line to the output
876 } while (size_read == (blockSize-1)); // append more if line does not fit in buffer
877 lineNr++;
878 } while (*p);
879
880 // strip stuff after closing bracket
881 int newLineIndex = result.findRev('\n');
882 int braceIndex = result.findRev('}');
883 if (braceIndex > newLineIndex)
884 {
885 result.resize(static_cast<size_t>(braceIndex+1));
886 }
887 endLine=lineNr-1;
888 }
889 if (usePipe)
890 {
891 Debug::print(Debug::FilterOutput, 0, "Filter output\n");
892 Debug::print(Debug::FilterOutput,0,"-------------\n{}\n-------------\n",result);
893 }
894 }
895 QCString encoding = getEncoding(FileInfo(fileName.str()));
896 if (encoding!="UTF-8")
897 {
898 std::string encBuf = result.str();
899 bool ok = transcodeCharacterStringToUTF8(encBuf,encoding.data());
900 if (ok)
901 {
902 result = encBuf;
903 }
904 else
905 {
906 err("failed to transcode characters in code fragment in file {} lines {} to {}, from input encoding {} to UTF-8\n",
907 fileName,startLine,endLine,encoding);
908
909 }
910 }
911 if (!result.isEmpty() && result.at(result.length()-1)!='\n') result += "\n";
912 //printf("readCodeFragment(%d-%d)=%s\n",startLine,endLine,qPrint(result));
913 return found;
914}
915
917{
918 ASSERT(p->def->definitionType()!=Definition::TypeFile); // file overloads this method
919 QCString fn;
920 bool sourceBrowser = Config_getBool(SOURCE_BROWSER);
921 if (sourceBrowser &&
922 p->body && p->body->startLine!=-1 && p->body->fileDef)
923 {
924 fn = p->body->fileDef->getSourceFileBase();
925 }
926 return fn;
927}
928
930{
931 const int maxAnchorStrLen = 20;
932 char anchorStr[maxAnchorStrLen];
933 anchorStr[0]='\0';
934 if (p->body && p->body->startLine!=-1)
935 {
936 if (Htags::useHtags)
937 {
938 qsnprintf(anchorStr,maxAnchorStrLen,"L%d",p->body->defLine);
939 }
940 else
941 {
942 qsnprintf(anchorStr,maxAnchorStrLen,"l%05d",p->body->defLine);
943 }
944 }
945 return anchorStr;
946}
947
948/*! Write a reference to the source code defining this definition */
950{
951 //printf("DefinitionImpl::writeSourceRef %d %p\n",bodyLine,bodyDef);
953 if (!fn.isEmpty())
954 {
955 QCString refText = theTranslator->trDefinedAtLineInSourceFile();
956 int lineMarkerPos = refText.find("@0");
957 int fileMarkerPos = refText.find("@1");
958 if (lineMarkerPos!=-1 && fileMarkerPos!=-1) // should always pass this.
959 {
960 QCString lineStr;
961 lineStr.sprintf("%d",p->body->defLine);
962 QCString anchorStr = getSourceAnchor();
963 ol.startParagraph("definition");
964 if (lineMarkerPos<fileMarkerPos) // line marker before file marker
965 {
966 // write text left from linePos marker
967 ol.parseText(refText.left(lineMarkerPos));
968 ol.writeObjectLink(QCString(),fn,anchorStr,lineStr);
969 // write text between markers
970 ol.parseText(refText.mid(lineMarkerPos+2,fileMarkerPos-lineMarkerPos-2));
971 // write file link
972 ol.writeObjectLink(QCString(),fn,QCString(),p->body->fileDef->name());
973 // write text right from file marker
974 ol.parseText(refText.right(refText.length()-static_cast<size_t>(fileMarkerPos)-2));
975 }
976 else // file marker before line marker
977 {
978 // write text left from file marker
979 ol.parseText(refText.left(fileMarkerPos));
980 // write file link
981 ol.writeObjectLink(QCString(),fn,QCString(),p->body->fileDef->name());
982 // write text between markers
983 ol.parseText(refText.mid(fileMarkerPos+2,lineMarkerPos-fileMarkerPos-2));
984 // write line link
985 ol.writeObjectLink(QCString(),fn,anchorStr,lineStr);
986 // write text right from linePos marker
987 ol.parseText(refText.right(refText.length()-static_cast<size_t>(lineMarkerPos)-2));
988 }
989 ol.endParagraph();
990 }
991 else
992 {
993 err("translation error: invalid markers in trDefinedAtLineInSourceFile()\n");
994 }
995 }
996}
997
998void DefinitionImpl::setBodySegment(int defLine, int bls,int ble)
999{
1000 if (!p->body.has_value())
1001 {
1002 p->body = std::make_optional<BodyInfo>();
1003 }
1004 BodyInfo &body = p->body.value();
1005 body.defLine = defLine;
1006 body.startLine = bls;
1007 body.endLine = ble;
1008}
1009
1011{
1012 if (!p->body.has_value())
1013 {
1014 p->body = std::make_optional<BodyInfo>();
1015 }
1016 p->body.value().fileDef=fd;
1017}
1018
1020{
1021 return p->body && p->body->startLine!=-1 &&
1022 p->body->endLine>=p->body->startLine &&
1023 p->body->fileDef;
1024}
1025
1026/*! Write code of this definition into the documentation */
1028{
1029 const MemberDef *thisMd = nullptr;
1030 if (p->def->definitionType()==Definition::TypeMember)
1031 {
1032 thisMd = toMemberDef(p->def);
1033 }
1034 bool inlineSources = thisMd && thisMd->hasInlineSource();
1035 //printf("Source Fragment %s: %d-%d\n",qPrint(name()),
1036 // p->body->startLine,p->body->endLine);
1037 if (inlineSources && hasSources())
1038 {
1039 ol.pushGeneratorState();
1040 QCString codeFragment;
1041 bool isMacro = thisMd && thisMd->memberType()==MemberType::Define;
1042 int actualStart=p->body->startLine,actualEnd=p->body->endLine;
1043 if (readCodeFragment(p->body->fileDef->absFilePath(),isMacro,
1044 actualStart,actualEnd,codeFragment)
1045 )
1046 {
1047 //printf("Adding code fragment '%s' ext='%s' range=%d-%d\n",
1048 // qPrint(codeFragment),qPrint(p->defFileExt),actualStart,actualEnd);
1049 auto intf = Doxygen::parserManager->getCodeParser(p->defFileExt);
1050 intf->resetCodeParserState();
1051 //printf("Read:\n'%s'\n\n",qPrint(codeFragment));
1052
1053 auto &codeOL = ol.codeGenerators();
1054 codeOL.startCodeFragment("DoxyCode");
1055 size_t indent = 0;
1056 intf->parseCode(codeOL, // codeOutIntf
1057 scopeName, // scope
1058 detab(codeFragment,indent), // input
1059 p->lang, // lang
1060 Config_getBool(STRIP_CODE_COMMENTS),
1062 .setFileDef(p->body->fileDef)
1063 .setStartLine(actualStart)
1064 .setEndLine(actualEnd)
1065 .setInlineFragment(true)
1066 .setMemberDef(thisMd)
1067 );
1068 codeOL.endCodeFragment("DoxyCode");
1069 }
1070 ol.popGeneratorState();
1071 }
1072}
1073
1074static inline MemberVector refMapToVector(const std::unordered_map<std::string,MemberDef *> &map)
1075{
1076 // convert map to a vector of values
1077 MemberVector result;
1078 std::transform(map.begin(),map.end(), // iterate over map
1079 std::back_inserter(result), // add results to vector
1080 [](const auto &item)
1081 { return item.second; } // extract value to add from map Key,Value pair
1082 );
1083 // and sort it
1084 std::stable_sort(result.begin(),result.end(),
1085 [](const auto &m1,const auto &m2) { return genericCompareMembers(m1,m2)<0; });
1086 return result;
1087}
1088
1089/*! Write a reference to the source code fragments in which this
1090 * definition is used.
1091 */
1093 const QCString &text,const std::unordered_map<std::string,MemberDef *> &membersMap,
1094 bool /*funcOnly*/) const
1095{
1096 if (!membersMap.empty())
1097 {
1098 auto members = refMapToVector(membersMap);
1099
1100 auto replaceFunc = [this,&members,scopeName,&ol](size_t entryIndex)
1101 {
1102 bool sourceBrowser = Config_getBool(SOURCE_BROWSER);
1103 bool refLinkSource = Config_getBool(REFERENCES_LINK_SOURCE);
1104 const MemberDef *md=members[entryIndex];
1105 if (md)
1106 {
1107 QCString scope=md->getScopeString();
1108 QCString name=md->name();
1109 //printf("class=%p scope=%s scopeName=%s\n",md->getClassDef(),qPrint(scope),scopeName);
1110 if (!scope.isEmpty() && scope!=scopeName)
1111 {
1112 name.prepend(scope+getLanguageSpecificSeparator(p->lang));
1113 }
1114 if (!md->isObjCMethod() &&
1115 (md->isFunction() || md->isSlot() ||
1116 md->isPrototype() || md->isSignal()
1117 )
1118 )
1119 {
1120 name+="()";
1121 }
1122 if (sourceBrowser &&
1123 !(md->isLinkable() && !refLinkSource) &&
1124 md->getStartBodyLine()!=-1 &&
1125 md->getBodyDef()
1126 )
1127 {
1128 const int maxLineNrStr = 10;
1129 char anchorStr[maxLineNrStr];
1130 qsnprintf(anchorStr,maxLineNrStr,"l%05d",md->getStartBodyLine());
1131 //printf("Write object link to %s\n",qPrint(md->getBodyDef()->getSourceFileBase()));
1132 ol.writeObjectLink(QCString(),md->getBodyDef()->getSourceFileBase(),anchorStr,name);
1133 }
1134 else if (md->isLinkable())
1135 {
1137 md->getOutputFileBase(),
1138 md->anchor(),name);
1139 }
1140 else
1141 {
1142 ol.docify(name);
1143 }
1144 }
1145 };
1146
1147 ol.startParagraph("reference");
1148 ol.parseText(text);
1149 ol.docify(" ");
1150 writeMarkerList(ol,
1151 theTranslator->trWriteList(static_cast<int>(members.size())).str(),
1152 members.size(),
1153 replaceFunc);
1154 ol.writeString(".");
1155 ol.endParagraph();
1156
1157 }
1158}
1159
1161{
1162 _writeSourceRefList(ol,scopeName,theTranslator->trReferencedBy(),p->sourceRefByDict,FALSE);
1163}
1164
1166{
1167 _writeSourceRefList(ol,scopeName,theTranslator->trReferences(),p->sourceRefsDict,TRUE);
1168}
1169
1171{
1172 return !p->sourceRefByDict.empty();
1173}
1174
1176{
1177 return !p->sourceRefsDict.empty();
1178}
1179
1181{
1182 bool extractAll = Config_getBool(EXTRACT_ALL);
1183 //bool sourceBrowser = Config_getBool(SOURCE_BROWSER);
1184 bool hasDocs =
1185 (p->details && !p->details->doc.isEmpty()) || // has detailed docs
1186 (p->brief && !p->brief->doc.isEmpty()) || // has brief description
1187 (p->inbodyDocs && !p->inbodyDocs->doc.isEmpty()) || // has inbody docs
1188 extractAll //|| // extract everything
1189 // (sourceBrowser && p->body &&
1190 // p->body->startLine!=-1 && p->body->fileDef)
1191 ; // link to definition
1192 return hasDocs;
1193}
1194
1196{
1197 bool hasDocs =
1198 (p->details && !p->details->doc.isEmpty()) ||
1199 (p->brief && !p->brief->doc.isEmpty()) ||
1200 (p->inbodyDocs && !p->inbodyDocs->doc.isEmpty());
1201 return hasDocs;
1202}
1203
1205{
1206 if (md)
1207 {
1208 p->sourceRefByDict.emplace(sourceRefName.str(),md);
1209 }
1210}
1211
1213{
1214 if (md)
1215 {
1216 p->sourceRefsDict.emplace(sourceRefName.str(),md);
1217 }
1218}
1219
1221{
1222 return nullptr;
1223}
1224
1226{
1227 err("DefinitionImpl::addInnerCompound() called\n");
1228}
1229
1230static std::recursive_mutex g_qualifiedNameMutex;
1231
1233{
1234 std::lock_guard<std::recursive_mutex> lock(g_qualifiedNameMutex);
1235 if (!p->qualifiedName.isEmpty())
1236 {
1237 return p->qualifiedName;
1238 }
1239
1240 //printf("start %s::qualifiedName() localName=%s\n",qPrint(name()),qPrint(p->localName));
1241 if (p->outerScope==nullptr)
1242 {
1243 if (p->localName=="<globalScope>")
1244 {
1245 return "";
1246 }
1247 else
1248 {
1249 return p->localName;
1250 }
1251 }
1252
1253 if (p->outerScope->name()=="<globalScope>")
1254 {
1255 p->qualifiedName = p->localName;
1256 }
1257 else
1258 {
1259 p->qualifiedName = p->outerScope->qualifiedName()+
1261 p->localName;
1262 }
1263 //printf("end %s::qualifiedName()=%s\n",qPrint(name()),qPrint(p->qualifiedName));
1264 //count--;
1265 return p->qualifiedName;
1266}
1267
1269{
1270 std::lock_guard<std::recursive_mutex> lock(g_qualifiedNameMutex);
1271 //printf("%s::setOuterScope(%s)\n",qPrint(name()),d?qPrint(d->name()):"<none>");
1272 Definition *outerScope = p->outerScope;
1273 bool found=false;
1274 // make sure that we are not creating a recursive scope relation.
1275 while (outerScope && !found)
1276 {
1277 found = (outerScope==d);
1278 outerScope = outerScope->getOuterScope();
1279 }
1280 if (!found)
1281 {
1282 p->qualifiedName.clear(); // flush cached scope name
1283 p->outerScope = d;
1284 }
1285 p->hidden = p->hidden || d->isHidden();
1286 assert(p->def!=p->outerScope);
1287}
1288
1290{
1291 return p->localName;
1292}
1293
1295{
1296 p->partOfGroups.push_back(gd);
1297}
1298
1300{
1301 p->xrefListItems.insert(p->xrefListItems.end(), sli.cbegin(), sli.cend());
1302}
1303
1305{
1306 auto otherXrefList = d->xrefListItems();
1307
1308 // append vectors
1309 p->xrefListItems.reserve(p->xrefListItems.size()+otherXrefList.size());
1310 p->xrefListItems.insert (p->xrefListItems.end(),
1311 otherXrefList.begin(),otherXrefList.end());
1312
1313 // sort results on itemId
1314 std::stable_sort(p->xrefListItems.begin(),p->xrefListItems.end(),
1315 [](RefItem *left,RefItem *right)
1316 { return left->id() <right->id() ||
1317 (left->id()==right->id() &&
1318 left->list()->listName() < right->list()->listName());
1319 });
1320
1321 // filter out duplicates
1322 auto last = std::unique(p->xrefListItems.begin(),p->xrefListItems.end(),
1323 [](const RefItem *left,const RefItem *right)
1324 { return left->id()==right->id() &&
1325 left->list()->listName()==right->list()->listName();
1326 });
1327 p->xrefListItems.erase(last, p->xrefListItems.end());
1328}
1329
1331{
1332 for (const RefItem *item : p->xrefListItems)
1333 {
1334 if (item->list()->listName()==listName)
1335 {
1336 return item->id();
1337 }
1338 }
1339 return -1;
1340}
1341
1343{
1344 return p->xrefListItems;
1345}
1346
1348{
1349 QCString result;
1350 if (p->outerScope && p->outerScope!=Doxygen::globalScope)
1351 {
1352 result = p->outerScope->pathFragment();
1353 }
1354 if (p->def->isLinkable())
1355 {
1356 if (!result.isEmpty()) result+="/";
1357 if (p->def->definitionType()==Definition::TypeGroup &&
1358 !toGroupDef(p->def)->groupTitle().isEmpty())
1359 {
1360 result+=toGroupDef(p->def)->groupTitle();
1361 }
1362 else if (p->def->definitionType()==Definition::TypePage &&
1363 toPageDef(p->def)->hasTitle())
1364 {
1365 result+=toPageDef(p->def)->title();
1366 }
1367 else
1368 {
1369 result+=p->localName;
1370 }
1371 }
1372 else
1373 {
1374 result+=p->localName;
1375 }
1376 return result;
1377}
1378
1379//----------------------------------------------------------------------------------------
1380
1381// TODO: move to htmlgen
1382/*! Returns the string used in the footer for $navpath when
1383 * GENERATE_TREEVIEW is enabled
1384 */
1386{
1387 QCString result;
1388 Definition *outerScope = getOuterScope();
1389 QCString locName = localName();
1390 if (outerScope && outerScope!=Doxygen::globalScope)
1391 {
1392 result+=outerScope->navigationPathAsString();
1393 }
1394 else if (p->def->definitionType()==Definition::TypeFile &&
1395 toFileDef(p->def)->getDirDef())
1396 {
1397 result+=(toFileDef(p->def))->getDirDef()->navigationPathAsString();
1398 }
1399 result+="<li class=\"navelem\">";
1400 if (p->def->isLinkableInProject())
1401 {
1402 QCString fn = p->def->getOutputFileBase();
1404 if (p->def->definitionType()==Definition::TypeGroup &&
1405 !toGroupDef(p->def)->groupTitle().isEmpty())
1406 {
1407 QCString title = parseCommentAsHtml(p->def,nullptr,toGroupDef(p->def)->groupTitle(),
1408 p->def->getDefFileName(),p->def->getDefLine());
1409 result+="<a href=\"$relpath^"+fn+"\">"+title+"</a>";
1410 }
1411 else if (p->def->definitionType()==Definition::TypePage &&
1412 toPageDef(p->def)->hasTitle())
1413 {
1414 QCString title = parseCommentAsHtml(p->def,nullptr,toPageDef(p->def)->title(),
1415 p->def->getDefFileName(),p->def->getDefLine());
1416 result+="<a href=\"$relpath^"+fn+"\">"+title+"</a>";
1417 }
1418 else if (p->def->definitionType()==Definition::TypeClass)
1419 {
1420 QCString name = toClassDef(p->def)->className();
1421 if (name.endsWith("-p"))
1422 {
1423 name = name.left(name.length()-2);
1424 }
1425 result+="<a href=\"$relpath^"+fn;
1426 if (!p->def->anchor().isEmpty()) result+="#"+p->def->anchor();
1427 result+="\">"+convertToHtml(name)+"</a>";
1428 }
1429 else
1430 {
1431 result+="<a href=\"$relpath^"+fn+"\">"+
1432 convertToHtml(locName)+"</a>";
1433 }
1434 }
1435 else
1436 {
1437 result+="<b>"+convertToHtml(locName)+"</b>";
1438 }
1439 result+="</li>";
1440 return result;
1441}
1442
1443// TODO: move to htmlgen
1445{
1446 ol.pushGeneratorState();
1448
1449 QCString navPath;
1450 navPath += "<div id=\"nav-path\" class=\"navpath\">\n"
1451 " <ul>\n";
1452 navPath += navigationPathAsString();
1453 navPath += " </ul>\n"
1454 "</div>\n";
1455 ol.writeNavigationPath(navPath);
1456
1457 ol.popGeneratorState();
1458}
1459
1460void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const
1461{
1462 // first check if we have anything to show or if the outline is already shown on the outline panel
1463 if (p->sectionRefs.empty() || (Config_getBool(GENERATE_TREEVIEW) && Config_getBool(PAGE_OUTLINE_PANEL))) return;
1464 // generate the embedded toc
1465 //ol.writeLocalToc(p->sectionRefs,localToc);
1466
1467 auto generateTocEntries = [this,&ol]()
1468 {
1469 for (const SectionInfo *si : p->sectionRefs)
1470 {
1471 if (si->type().isSection())
1472 {
1473 ol.startTocEntry(si);
1474 const MemberDef *md = p->def->definitionType()==Definition::TypeMember ? toMemberDef(p->def) : nullptr;
1475 const Definition *scope = p->def->definitionType()==Definition::TypeMember ? p->def->getOuterScope() : p->def;
1476 QCString docTitle = si->title();
1477 if (docTitle.isEmpty()) docTitle = si->label();
1478 ol.generateDoc(docFile(),
1480 scope,
1481 md,
1482 docTitle,
1483 DocOptions()
1484 .setIndexWords(true)
1485 .setSingleLine(true)
1486 .setSectionLevel(si->type().level())
1487 );
1488 ol.endTocEntry(si);
1489 }
1490 }
1491 };
1492
1493 if (localToc.isHtmlEnabled())
1494 {
1495 ol.pushGeneratorState();
1497 ol.startLocalToc(localToc.htmlLevel());
1498 generateTocEntries();
1499 ol.endLocalToc();
1500 ol.popGeneratorState();
1501 }
1502 if (localToc.isDocbookEnabled())
1503 {
1504 ol.pushGeneratorState();
1506 ol.startLocalToc(localToc.docbookLevel());
1507 generateTocEntries();
1508 ol.endLocalToc();
1509 ol.popGeneratorState();
1510 }
1511 if (localToc.isLatexEnabled())
1512 {
1513 ol.pushGeneratorState();
1515 ol.startLocalToc(localToc.latexLevel());
1516 // no gneerateTocEntries() needed for LaTeX
1517 ol.endLocalToc();
1518 ol.popGeneratorState();
1519 }
1520}
1521
1522//----------------------------------------------------------------------------------------
1523
1525{
1526 return p->sectionRefs;
1527}
1528
1530{
1531 return p->symbolName;
1532}
1533
1534//----------------------
1535
1537{
1538 return p->details ? p->details->doc : QCString("");
1539}
1540
1542{
1543 return p->details ? p->details->line : p->brief ? p->brief->line : 1;
1544}
1545
1547{
1548 if (p->details && !p->details->file.isEmpty()) return p->details->file;
1549 else if (p->brief && !p->brief->file.isEmpty()) return p->brief->file;
1550 else return "<" + p->name + ">";
1551}
1552
1553//----------------------------------------------------------------------------
1554// strips w from s iff s starts with w
1555static bool stripWord(QCString &s,QCString w)
1556{
1557 bool success=FALSE;
1558 if (s.left(w.length())==w)
1559 {
1560 success=TRUE;
1561 s=s.right(s.length()-w.length());
1562 }
1563 return success;
1564}
1565
1566//----------------------------------------------------------------------------
1567// some quasi intelligent brief description abbreviator :^)
1568static QCString abbreviate(const QCString &s,const QCString &name)
1569{
1570 QCString scopelessName=name;
1571 int i=scopelessName.findRev("::");
1572 if (i!=-1) scopelessName=scopelessName.mid(i+2);
1573 QCString result=s;
1574 result=result.stripWhiteSpace();
1575 // strip trailing .
1576 if (!result.isEmpty() && result.at(result.length()-1)=='.')
1577 result=result.left(result.length()-1);
1578
1579 // strip any predefined prefix
1580 const StringVector &briefDescAbbrev = Config_getList(ABBREVIATE_BRIEF);
1581 for (const auto &p : briefDescAbbrev)
1582 {
1583 QCString str = substitute(p,"$name",scopelessName); // replace $name with entity name
1584 str += " ";
1585 stripWord(result,str);
1586 }
1587
1588 // capitalize first character
1589 if (!result.isEmpty())
1590 {
1591 char c = result[0];
1592 if (c >= 'a' && c <= 'z') result[0] += 'A' - 'a';
1593 }
1594
1595 return result;
1596}
1597
1598
1599//----------------------
1600
1602{
1603 //printf("%s::briefDescription(%d)='%s'\n",qPrint(name()),abbr,p->brief?qPrint(p->brief->doc):"<none>");
1604 return p->brief ?
1605 (abbr ? abbreviate(p->brief->doc,p->def->displayName()) : p->brief->doc) :
1606 QCString("");
1607}
1608
1610{
1611 if (p->brief && p->brief->tooltip.isEmpty() && !p->brief->doc.isEmpty())
1612 {
1613 const MemberDef *md = p->def->definitionType()==Definition::TypeMember ? toMemberDef(p->def) : nullptr;
1614 const Definition *scope = p->def->definitionType()==Definition::TypeMember ? p->def->getOuterScope() : p->def;
1615 p->brief->tooltip = parseCommentAsText(scope,md,
1616 p->brief->doc, p->brief->file, p->brief->line);
1617 }
1618}
1619
1621{
1622 return p->brief ? p->brief->tooltip : QCString();
1623}
1624
1626{
1627 return p->brief ? p->brief->line : 1;
1628}
1629
1631{
1632 return p->brief && !p->brief->file.isEmpty() ? p->brief->file : QCString("<"+p->name+">");
1633}
1634
1635//----------------------
1636
1638{
1639 return p->inbodyDocs ? p->inbodyDocs->doc : QCString("");
1640}
1641
1643{
1644 return p->inbodyDocs ? p->inbodyDocs->line : 1;
1645}
1646
1648{
1649 return p->inbodyDocs && !p->inbodyDocs->file.isEmpty() ? p->inbodyDocs->file : QCString("<"+p->name+">");
1650}
1651
1652
1653//----------------------
1654
1656{
1657 return p->defFileName;
1658}
1659
1661{
1662 return p->defFileExt;
1663}
1664
1666{
1667 return p->hidden;
1668}
1669
1671{
1672 return p->def->isLinkableInProject() && !p->hidden;
1673}
1674
1676{
1677 return p->def->isLinkable() && !p->hidden;
1678}
1679
1681{
1682 return p->isArtificial;
1683}
1684
1686{
1687 return p->isExported;
1688}
1689
1691{
1692 return p->ref;
1693}
1694
1696{
1697 return !p->ref.isEmpty();
1698}
1699
1701{
1702 return p->body ? p->body->defLine : -1;
1703}
1704
1706{
1707 return p->body ? p->body->startLine : -1;
1708}
1709
1711{
1712 return p->body ? p->body->endLine : -1;
1713}
1714
1716{
1717 return p->body ? p->body->fileDef : nullptr;
1718}
1719
1721{
1722 return p->partOfGroups;
1723}
1724
1726{
1727 for (const auto &gd : partOfGroups())
1728 {
1729 if (gd->isLinkable()) return true;
1730 }
1731 return false;
1732}
1733
1735{
1736 return p->outerScope;
1737}
1738
1739static std::mutex g_memberReferenceMutex;
1740
1742{
1743 std::lock_guard<std::mutex> lock(g_memberReferenceMutex);
1744 if (p->referencesMembers.empty() && !p->sourceRefsDict.empty())
1745 {
1746 p->referencesMembers = refMapToVector(p->sourceRefsDict);
1747 }
1748 return p->referencesMembers;
1749}
1750
1752{
1753 std::lock_guard<std::mutex> lock(g_memberReferenceMutex);
1754 if (p->referencedByMembers.empty() && !p->sourceRefByDict.empty())
1755 {
1756 p->referencedByMembers = refMapToVector(p->sourceRefByDict);
1757 }
1758 return p->referencedByMembers;
1759}
1760
1762{
1763 const DefinitionImpl *defImpl = other->toDefinitionImpl_();
1764 if (defImpl)
1765 {
1766 for (const auto &kv : defImpl->p->sourceRefsDict)
1767 {
1768 auto it = p->sourceRefsDict.find(kv.first);
1769 if (it != p->sourceRefsDict.end())
1770 {
1771 p->sourceRefsDict.insert(kv);
1772 }
1773 }
1774 }
1775}
1776
1778{
1779 const DefinitionImpl *defImpl = other->toDefinitionImpl_();
1780 if (defImpl)
1781 {
1782 for (const auto &kv : defImpl->p->sourceRefByDict)
1783 {
1784 auto it = p->sourceRefByDict.find(kv.first);
1785 if (it != p->sourceRefByDict.end())
1786 {
1787 p->sourceRefByDict.emplace(kv.first,kv.second);
1788 }
1789 }
1790 }
1791}
1792
1793
1795{
1796 p->ref=r;
1797}
1798
1800{
1801 return p->lang;
1802}
1803
1805{
1806 p->hidden = p->hidden || b;
1807}
1808
1810{
1811 p->isArtificial = b;
1812}
1813
1815{
1816 p->isExported = b;
1817}
1818
1820{
1821 p->localName=name;
1822}
1823
1825{
1826 p->lang=lang;
1827}
1828
1829
1831{
1832 p->symbolName=name;
1833}
1834
1836{
1837 return p->symbolName;
1838}
1839
1841{
1842 bool briefMemberDesc = Config_getBool(BRIEF_MEMBER_DESC);
1843 return !briefDescription().isEmpty() && briefMemberDesc;
1844}
1845
1847{
1848 QCString ref = getReference();
1849 if (!ref.isEmpty())
1850 {
1851 auto it = Doxygen::tagDestinationMap.find(ref.str());
1853 {
1854 QCString result(it->second);
1855 size_t l = result.length();
1856 if (!relPath.isEmpty() && l>0 && result.at(0)=='.')
1857 { // relative path -> prepend relPath.
1858 result.prepend(relPath);
1859 l+=relPath.length();
1860 }
1861 if (l>0 && result.at(l-1)!='/') result+='/';
1862 return result;
1863 }
1864 }
1865 return relPath;
1866}
1867
1869{
1870 return p->name;
1871}
1872
1874{
1875 return p->isAnonymous;
1876}
1877
1879{
1880 return p->defLine;
1881}
1882
1884{
1885 return p->defColumn;
1886}
1887
1891
1895
1899
1900//---------------------------------------------------------------------------------
1901
1903 : m_def(def), m_scope(scope), m_symbolName(alias->_symbolName())
1904{
1905}
1906
1910
1912{
1913 //printf("%s::addToMap(%s)\n",qPrint(name()),qPrint(alias->name()));
1915 if (m_scope==nullptr)
1916 {
1917 m_qualifiedName = m_def->localName();
1918 }
1919 else
1920 {
1921 m_qualifiedName = m_scope->qualifiedName()+
1922 getLanguageSpecificSeparator(m_scope->getLanguage())+
1923 m_def->localName();
1924 }
1925}
1926
1931
1936
1938{
1939 return m_qualifiedName;
1940}
1941
1942//---------------------------------------------------------------------------------
1943
1945{
1946 return dm ? dm->toDefinition_() : nullptr;
1947}
1948
1950{
1951 return d ? d->toDefinitionMutable_() : nullptr;
1952}
1953
static AnchorGenerator & instance()
Returns the singleton instance.
Definition anchor.cpp:38
virtual QCString className() const =0
Returns the name of the class including outer classes, but not including namespaces.
@ FilterOutput
Definition debug.h:38
@ ExtCmd
Definition debug.h:36
static void print(DebugMask mask, int prio, fmt::format_string< Args... > fmt, Args &&... args)
Definition debug.h:76
DefinitionAliasImpl(Definition *def, const Definition *scope, const Definition *alias)
const Definition * m_scope
const QCString & name() const
QCString qualifiedName() const
virtual ~DefinitionAliasImpl()
The common base class of all entity definitions found in the sources.
Definition definition.h:76
virtual const RefItemVector & xrefListItems() const =0
virtual QCString navigationPathAsString() const =0
virtual bool isLinkable() const =0
virtual QCString anchor() const =0
virtual DefinitionMutable * toDefinitionMutable_()=0
virtual const FileDef * getBodyDef() const =0
virtual bool isHidden() const =0
virtual QCString getReference() const =0
virtual void _setSymbolName(const QCString &name)=0
virtual QCString getSourceFileBase() const =0
virtual QCString getOutputFileBase() const =0
virtual Definition * getOuterScope() const =0
virtual int getStartBodyLine() const =0
virtual const DefinitionImpl * toDefinitionImpl_() const =0
virtual const QCString & name() const =0
Private data associated with a Symbol DefinitionImpl object.
MemberVector referencesMembers
std::optional< BriefInfo > brief
std::optional< BodyInfo > body
void init(const QCString &df, const QCString &n)
std::optional< DocInfo > inbodyDocs
MemberVector referencedByMembers
std::unordered_map< std::string, MemberDef * > sourceRefByDict
std::unordered_map< std::string, MemberDef * > sourceRefsDict
RefItemVector xrefListItems
void setDefFileName(const QCString &df)
void setId(const QCString &name)
void setBodySegment(int defLine, int bls, int ble)
void setExported(bool b)
int getDefLine() const
bool isHidden() const
void mergeRefItems(Definition *d)
QCString documentation() const
void addSourceReferencedBy(MemberDef *d, const QCString &sourceRefName)
const RefItemVector & xrefListItems() const
void writeSummaryLinks(OutputList &) const
void setHidden(bool b)
QCString _symbolName() const
QCString getSourceFileBase() const
QCString externalReference(const QCString &relPath) const
bool isReference() const
bool isVisible() const
int briefLine() const
void addSectionsToDefinition(const std::vector< const SectionInfo * > &anchorList)
bool isAnonymous() const
bool isLinkableViaGroup() const
void setDefFile(const QCString &df, int defLine, int defColumn)
const Definition * findInnerCompound(const QCString &name) const
void setName(const QCString &name)
SrcLangExt getLanguage() const
void addInnerCompound(Definition *d)
void setArtificial(bool b)
bool hasSourceReffedBy() const
void _writeSourceRefList(OutputList &ol, const QCString &scopeName, const QCString &text, const std::unordered_map< std::string, MemberDef * > &members, bool) const
void writeNavigationPath(OutputList &ol) const
QCString getDefFileName() const
void writeSourceReffedBy(OutputList &ol, const QCString &scopeName) const
bool _docsAlreadyAdded(const QCString &doc, QCString &sigList)
void _setInbodyDocumentation(const QCString &d, const QCString &docFile, int docLine)
void setRefItems(const RefItemVector &sli)
int getStartBodyLine() const
void setLocalName(const QCString &name)
QCString symbolName() const
QCString id() const
void setOuterScope(Definition *d)
void _setBriefDescription(const QCString &b, const QCString &briefFile, int briefLine)
QCString qualifiedName() const
const MemberVector & getReferencesMembers() const
void setBodyDef(const FileDef *fd)
void writeInlineCode(OutputList &ol, const QCString &scopeName) const
int docLine() const
void setInbodyDocumentation(const QCString &d, const QCString &docFile, int docLine)
bool isArtificial() const
bool isExported() const
QCString briefDescriptionAsTooltip() const
int _getXRefListId(const QCString &listName) const
QCString inbodyDocumentation() const
QCString getSourceAnchor() const
QCString getDefFileExtension() const
void writeQuickMemberLinks(OutputList &, const MemberDef *) const
const GroupList & partOfGroups() const
void setBriefDescription(const QCString &b, const QCString &briefFile, int briefLine)
const QCString & name() const
QCString briefFile() const
bool hasUserDocumentation() const
int inbodyLine() const
QCString briefDescription(bool abbreviate=FALSE) const
bool hasBriefDescription() const
bool hasSources() const
const SectionRefs & getSectionRefs() const
DefinitionImpl & operator=(const DefinitionImpl &d)
bool isVisibleInProject() const
void writeSourceRefs(OutputList &ol, const QCString &scopeName) const
void makePartOfGroup(GroupDef *gd)
const QCString & localName() const
void mergeReferencedBy(const Definition *other)
int getStartDefLine() const
void setDocumentation(const QCString &d, const QCString &docFile, int docLine, bool stripWhiteSpace=TRUE)
void setReference(const QCString &r)
bool hasSourceRefs() const
void writeToc(OutputList &ol, const LocalToc &lt) const
QCString navigationPathAsString() const
void _setDocumentation(const QCString &d, const QCString &docFile, int docLine, bool stripWhiteSpace, bool atTop)
void writePageNavigation(OutputList &ol) const
const FileDef * getBodyDef() const
void writeSourceDef(OutputList &ol) const
void setLanguage(SrcLangExt lang)
void mergeReferences(const Definition *other)
QCString inbodyFile() const
std::unique_ptr< Private > p
bool hasSections() const
QCString docFile() const
bool hasDocumentation() const
Definition * getOuterScope() const
const MemberVector & getReferencedByMembers() const
QCString pathFragment() const
DefinitionImpl(Definition *def, const QCString &defFileName, int defLine, int defColumn, const QCString &name, const char *b=nullptr, const char *d=nullptr, bool isSymbol=TRUE)
int getDefColumn() const
int getEndBodyLine() const
void writeDocAnchorsToTagFile(TextStream &) const
void _setSymbolName(const QCString &name)
QCString getReference() const
void addSourceReferences(MemberDef *d, const QCString &sourceRefName)
virtual Definition * toDefinition_()=0
static ParserManager * parserManager
Definition doxygen.h:130
static NamespaceDefMutable * globalScope
Definition doxygen.h:120
static StringMap tagDestinationMap
Definition doxygen.h:115
static QCString filterDBFileName
Definition doxygen.h:132
static SymbolMap< Definition > * symbolMap
Definition doxygen.h:124
static ClangUsrMap * clangUsrMap
Definition doxygen.h:125
A model of a file symbol.
Definition filedef.h:99
Minimal replacement for QFileInfo.
Definition fileinfo.h:23
std::string extension(bool complete) const
Definition fileinfo.cpp:130
void shrinkBuffer(std::string &str, const QCString &fileName, size_t startLine, size_t endLine)
std::vector< size_t > LineOffsets
auto getFragmentLocation(const LineOffsets &lineOffsets, size_t startLine, size_t endLine) -> std::tuple< size_t, size_t >
std::unordered_map< std::string, LineOffsets > m_lineOffsets
bool getFileContentsDisk(const QCString &fileName, size_t startLine, size_t endLine, std::string &str)
static FilterCache & instance()
void readFragmentFromFile(std::string &str, const QCString &fileName, size_t startOffset, size_t size=0)
size_t m_endPos
void compileLineOffsets(const QCString &fileName, const std::string &str)
bool getFileContents(const QCString &fileName, size_t startLine, size_t endLine, std::string &str)
bool getFileContentsPipe(const QCString &fileName, const QCString &filter, size_t startLine, size_t endLine, std::string &str)
std::unordered_map< std::string, FilterCacheItem > m_cache
std::mutex m_mutex
A model of a group of symbols.
Definition groupdef.h:52
virtual QCString groupTitle() const =0
const T * find(const std::string &key) const
Definition linkedmap.h:47
constexpr int docbookLevel() const noexcept
Definition types.h:622
constexpr int latexLevel() const noexcept
Definition types.h:620
constexpr bool isDocbookEnabled() const noexcept
Definition types.h:617
constexpr bool isLatexEnabled() const noexcept
Definition types.h:615
constexpr int htmlLevel() const noexcept
Definition types.h:619
constexpr bool isHtmlEnabled() const noexcept
Definition types.h:614
A model of a class/file/namespace member symbol.
Definition memberdef.h:48
virtual bool isSignal() const =0
virtual bool isObjCMethod() const =0
virtual bool isSlot() const =0
virtual bool isFunction() const =0
virtual QCString getScopeString() const =0
virtual bool hasInlineSource() const =0
virtual MemberType memberType() const =0
virtual bool isPrototype() const =0
A vector of MemberDef object.
Definition memberlist.h:35
iterator end() noexcept
Definition memberlist.h:56
iterator begin() noexcept
Definition memberlist.h:54
void startCodeFragment(const QCString &style)
Definition outputlist.h:279
Class representing a list of output generators that are written to in parallel.
Definition outputlist.h:315
void writeString(const QCString &text)
Definition outputlist.h:411
void startTocEntry(const SectionInfo *si)
Definition outputlist.h:748
const OutputCodeList & codeGenerators() const
Definition outputlist.h:358
void writeObjectLink(const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name)
Definition outputlist.h:439
void docify(const QCString &s)
Definition outputlist.h:437
void generateDoc(const QCString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const QCString &docStr, const DocOptions &options)
void startParagraph(const QCString &classDef=QCString())
Definition outputlist.h:407
void endParagraph()
Definition outputlist.h:409
void pushGeneratorState()
void endLocalToc()
Definition outputlist.h:746
void disableAllBut(OutputType o)
void popGeneratorState()
void endTocEntry(const SectionInfo *si)
Definition outputlist.h:750
void writeNavigationPath(const QCString &s)
Definition outputlist.h:608
void parseText(const QCString &textStr)
void startLocalToc(int level)
Definition outputlist.h:744
virtual QCString title() const =0
This is an alternative implementation of QCString.
Definition qcstring.h:101
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
QCString & prepend(const char *s)
Definition qcstring.h:422
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:166
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:241
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:593
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:163
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:260
void resize(size_t newlen)
Definition qcstring.h:180
QCString fill(char c, int len=-1)
Fills a string with a predefined character.
Definition qcstring.h:193
const std::string & str() const
Definition qcstring.h:552
QCString simplifyWhiteSpace() const
return a copy of this string with leading and trailing whitespace removed and multiple whitespace cha...
Definition qcstring.cpp:190
QCString right(size_t len) const
Definition qcstring.h:234
QCString & sprintf(const char *format,...)
Definition qcstring.cpp:29
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition qcstring.cpp:96
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:172
QCString left(size_t len) const
Definition qcstring.h:229
This struct represents an item in the list of references.
Definition reflist.h:32
int id() const
Definition reflist.h:52
RefList * list() const
Definition reflist.h:53
QCString listName() const
Definition reflist.h:101
class that provide information about a section.
Definition section.h:57
QCString label() const
Definition section.h:68
QCString ref() const
Definition section.h:71
void setDefinition(Definition *d)
Definition section.h:82
QCString fileName() const
Definition section.h:73
bool generated() const
Definition section.h:74
QCString title() const
Definition section.h:69
SectionType type() const
Definition section.h:70
singleton class that owns the list of all sections
Definition section.h:134
SectionInfo * add(const SectionInfo &si)
Definition section.h:138
static SectionManager & instance()
returns a reference to the singleton
Definition section.h:178
class that represents a list of constant references to sections.
Definition section.h:102
constexpr bool isSection() const
Definition section.h:46
constexpr int level() const
Definition section.h:45
Text streaming class that buffers data.
Definition textstream.h:36
ClassDef * toClassDef(Definition *d)
Class representing a regular expression.
Definition regex.h:39
Object representing the matching results.
Definition regex.h:151
#define Config_getInt(name)
Definition config.h:34
#define Config_getList(name)
Definition config.h:38
#define Config_getBool(name)
Definition config.h:33
std::vector< std::string > StringVector
Definition containers.h:33
static std::mutex g_memberReferenceMutex
static void removeFromMap(const QCString &name, Definition *d)
bool readCodeFragment(const QCString &fileName, bool isMacro, int &startLine, int &endLine, QCString &result)
Reads a fragment from file fileName starting with line startLine and ending with line endLine.
static void addToMap(const QCString &name, Definition *d)
static bool matchExcludedSymbols(const QCString &name)
static QCString abbreviate(const QCString &s, const QCString &name)
Definition * toDefinition(DefinitionMutable *dm)
static MemberVector refMapToVector(const std::unordered_map< std::string, MemberDef * > &map)
static std::recursive_mutex g_qualifiedNameMutex
static bool stripWord(QCString &s, QCString w)
DefinitionMutable * toDefinitionMutable(Definition *d)
DirIterator end(const DirIterator &) noexcept
Definition dir.cpp:175
FileDef * toFileDef(Definition *d)
Definition filedef.cpp:1951
GroupDef * toGroupDef(Definition *d)
Translator * theTranslator
Definition language.cpp:71
MemberDef * toMemberDef(Definition *d)
#define err(fmt,...)
Definition message.h:127
std::ifstream openInputStream(const QCString &name, bool binary=false, bool openAtEnd=false)
Definition portable.cpp:660
FILE * popen(const QCString &name, const QCString &type)
Definition portable.cpp:480
FILE * fopen(const QCString &fileName, const QCString &mode)
Definition portable.cpp:350
int pclose(FILE *stream)
Definition portable.cpp:489
bool search(std::string_view 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.
Definition regex.cpp:844
PageDef * toPageDef(Definition *d)
Definition pagedef.cpp:481
Portable versions of functions that are platform dependent.
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition qcstring.cpp:571
#define qsnprintf
Definition qcstring.h:49
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
#define ASSERT(x)
Definition qcstring.h:39
std::vector< RefItem * > RefItemVector
Definition reflist.h:133
std::string_view stripWhiteSpace(std::string_view s)
Given a string view s, returns a new, narrower view on that string, skipping over any leading or trai...
Definition stringutil.h:72
Data associated with description found in the body.
Definition definition.h:63
int startLine
line number of the start of the definition's body
Definition definition.h:65
int endLine
line number of the end of the definition's body
Definition definition.h:66
int defLine
line number of the start of the definition
Definition definition.h:64
Data associated with a brief description.
Definition definition.h:54
QCString file
Definition definition.h:58
QCString doc
Definition definition.h:55
Options to configure the code parser.
Definition parserintf.h:78
CodeParserOptions & setStartLine(int lineNr)
Definition parserintf.h:101
CodeParserOptions & setInlineFragment(bool enable)
Definition parserintf.h:107
CodeParserOptions & setEndLine(int lineNr)
Definition parserintf.h:104
CodeParserOptions & setMemberDef(const MemberDef *md)
Definition parserintf.h:110
Data associated with a detailed description.
Definition definition.h:46
QCString doc
Definition definition.h:47
int line
Definition definition.h:48
QCString file
Definition definition.h:49
static bool useHtags
Definition htags.h:23
SrcLangExt
Definition types.h:207
bool isUTF8CharUpperCase(const std::string &input, size_t pos)
Returns true iff the input string at byte position pos holds an upper case character.
Definition utf8.cpp:218
bool lastUTF8CharIsMultibyte(const std::string &input)
Returns true iff the last character in input is a multibyte character.
Definition utf8.cpp:212
Various UTF8 related helper functions.
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
Definition util.cpp:5147
QCString parseCommentAsHtml(const Definition *scope, const MemberDef *member, const QCString &doc, const QCString &fileName, int lineNr)
Definition util.cpp:5361
QCString convertToHtml(const QCString &s, bool keepEntities)
Definition util.cpp:3905
QCString parseCommentAsText(const Definition *scope, const MemberDef *md, const QCString &doc, const QCString &fileName, int lineNr)
Definition util.cpp:5305
bool transcodeCharacterStringToUTF8(std::string &input, const char *inputEncoding)
Definition util.cpp:1400
QCString stripScope(const QCString &name)
Definition util.cpp:3721
int computeQualifiedIndex(const QCString &name)
Return the index of the last :: in the string name that is still before the first <.
Definition util.cpp:6774
QCString convertToXML(const QCString &s, bool keepEntities)
Definition util.cpp:3854
QCString detab(const QCString &s, size_t &refIndent)
Definition util.cpp:6670
QCString getLanguageSpecificSeparator(SrcLangExt lang, bool classScope)
Returns the scope separator to use given the programming language lang.
Definition util.cpp:5849
QCString getEncoding(const FileInfo &fi)
Definition util.cpp:5647
QCString stripLeadingAndTrailingEmptyLines(const QCString &s, int &docLine)
Special version of QCString::stripWhiteSpace() that only strips completely blank lines.
Definition util.cpp:4966
QCString getFileFilter(const QCString &name, bool isSourceCode)
Definition util.cpp:1366
void writeMarkerList(OutputList &ol, const std::string &markerText, size_t numMarkers, std::function< void(size_t)> replaceFunc)
Definition util.cpp:1100
void addHtmlExtensionIfMissing(QCString &fName)
Definition util.cpp:4863
A bunch of utility functions.
bool isId(int c)
Definition util.h:207