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 QCString lname = n;
124 if (lname!="<globalScope>")
125 {
126 //extractNamespaceName(m_name,m_localName,ns);
128 }
129 else
130 {
131 localName=n;
132 }
133 //printf("localName=%s\n",qPrint(localName));
134
135 brief.reset();
136 details.reset();
137 body.reset();
138 inbodyDocs.reset();
139 sourceRefByDict.clear();
140 sourceRefsDict.clear();
142 hidden = FALSE;
145 lang = SrcLangExt::Unknown;
146}
147
148void DefinitionImpl::setDefFile(const QCString &df,int defLine,int defCol)
149{
150 p->setDefFileName(df);
151 p->defLine = defLine;
152 p->defColumn = defCol;
153}
154
155//-----------------------------------------------------------------------------------------
156
158{
159 const StringVector &exclSyms = Config_getList(EXCLUDE_SYMBOLS);
160 if (exclSyms.empty()) return FALSE; // nothing specified
161 std::string symName = name.str();
162 for (const auto &pat : exclSyms)
163 {
164 QCString pattern = pat;
165 bool forceStart=FALSE;
166 bool forceEnd=FALSE;
167 if (pattern.at(0)=='^')
168 pattern=pattern.mid(1),forceStart=TRUE;
169 if (pattern.at(pattern.length()-1)=='$')
170 pattern=pattern.left(pattern.length()-1),forceEnd=TRUE;
171 if (pattern.find('*')!=-1) // wildcard mode
172 {
173 const reg::Ex re(substitute(pattern,"*",".*").str());
174 reg::Match match;
175 if (reg::search(symName,match,re)) // wildcard match
176 {
177 size_t ui = match.position();
178 size_t pl = match.length();
179 size_t sl = symName.length();
180 if ((ui==0 || pattern.at(0)=='*' || (!isId(symName.at(ui-1)) && !forceStart)) &&
181 (ui+pl==sl || pattern.at(pattern.length()-1)=='*' || (!isId(symName.at(ui+pl)) && !forceEnd))
182 )
183 {
184 //printf("--> name=%s pattern=%s match at %d\n",qPrint(symName),qPrint(pattern),i);
185 return TRUE;
186 }
187 }
188 }
189 else if (!pattern.isEmpty()) // match words
190 {
191 size_t i = symName.find(pattern.str());
192 if (i!=std::string::npos) // we have a match!
193 {
194 size_t ui=i;
195 size_t pl=pattern.length();
196 size_t sl=symName.length();
197 // check if it is a whole word match
198 if ((ui==0 || (!isId(symName.at(ui-1)) && !forceStart)) &&
199 (ui+pl==sl || (!isId(symName.at(ui+pl)) && !forceEnd))
200 )
201 {
202 //printf("--> name=%s pattern=%s match at %d\n",qPrint(symName),qPrint(pattern),i);
203 return TRUE;
204 }
205 }
206 }
207 }
208 //printf("--> name=%s: no match\n",name);
209 return FALSE;
210}
211
212static void addToMap(const QCString &name,Definition *d)
213{
214 bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL);
217 if (!vhdlOpt && index!=-1) symbolName=symbolName.mid(index+2);
218 if (!symbolName.isEmpty())
219 {
220 //printf("adding symbol %s\n",qPrint(symbolName));
222
224 }
225}
226
227static void removeFromMap(const QCString &name,Definition *d)
228{
229 Doxygen::symbolMap->remove(name,d);
230}
231
233 const QCString &df,int dl,int dc,
234 const QCString &name,const char *b,
235 const char *d,bool isSymbol)
236 : p(std::make_unique<Private>())
237{
238 setName(name);
239 p->def = def;
240 p->defLine = dl;
241 p->defColumn = dc;
242 p->init(df,name);
243 p->isSymbol = isSymbol;
244 if (isSymbol) addToMap(name,def);
245 _setBriefDescription(b,df,dl);
248 {
249 p->hidden = TRUE;
250 }
251}
252
254 : p(std::make_unique<Private>(*d.p))
255{
256 if (p->isSymbol) addToMap(p->name,p->def);
257}
258
260{
261 if (this!=&other)
262 {
263 p = std::make_unique<Private>(*other.p);
264 }
265 return *this;
266}
267
269{
270 if (p->isSymbol)
271 {
272 removeFromMap(p->symbolName,p->def);
273 }
274}
275
277{
278 if (name.isEmpty()) return;
279 p->name = name;
280 p->isAnonymous = p->name.isEmpty() ||
281 p->name.at(0)=='@' ||
282 p->name.find("::@")!=-1;
283}
284
286{
287 if (id.isEmpty()) return;
288 p->id = id;
290 {
291 //printf("DefinitionImpl::setId '%s'->'%s'\n",id,qPrint(p->name));
292 Doxygen::clangUsrMap->emplace(id.str(),p->def);
293 }
294}
295
297{
298 return p->id;
299}
301void DefinitionImpl::addSectionsToDefinition(const std::vector<const SectionInfo*> &anchorList)
302{
303 //printf("%s: addSectionsToDefinition(%d)\n",qPrint(name()),anchorList->count());
304 for (const SectionInfo *si : anchorList)
305 {
306 //printf("Add section '%s' to definition '%s'\n",
307 // qPrint(si->label()),qPrint(name()));
309 SectionInfo *gsi=sm.find(si->label());
310 //printf("===== label=%s gsi=%p\n",qPrint(si->label()),(void*)gsi);
311 if (gsi==nullptr)
312 {
313 gsi = sm.add(*si);
314 }
315 if (p->sectionRefs.find(gsi->label())==nullptr)
316 {
317 p->sectionRefs.add(gsi);
318 }
319 gsi->setDefinition(p->def);
320 }
321}
322
324{
325 //printf("DefinitionImpl::hasSections(%s) #sections=%zu\n",qPrint(name()), p->sectionRefs.size());
326 if (p->sectionRefs.empty()) return FALSE;
327 for (const SectionInfo *si : p->sectionRefs)
328 {
329 if (si->type().isSection())
330 {
331 return TRUE;
332 }
333 }
334 return FALSE;
335}
336
338{
339 if (!p->sectionRefs.empty())
340 {
341 //printf("%s: writeDocAnchorsToTagFile(%d)\n",qPrint(name()),p->sectionRef.size());
342 for (const SectionInfo *si : p->sectionRefs)
343 {
344 if (!si->generated() && si->ref().isEmpty() && !AnchorGenerator::instance().isGenerated(si->label().str()))
345 {
346 //printf("write an entry!\n");
347 if (p->def->definitionType()==Definition::TypeMember) tagFile << " ";
348 QCString fn = si->fileName();
350 tagFile << " <docanchor file=\"" << fn << "\"";
351 if (!si->title().isEmpty())
352 {
353 tagFile << " title=\"" << convertToXML(si->title()) << "\"";
354 }
355 tagFile << ">" << si->label() << "</docanchor>\n";
356 }
357 }
358 }
359}
360
362{
363 uint8_t md5_sig[16];
364 char sigStr[33];
365 // to avoid mismatches due to differences in indenting, we first remove
366 // double whitespaces...
367 QCString docStr = doc.simplifyWhiteSpace();
368 MD5Buffer(docStr.data(),static_cast<unsigned int>(docStr.length()),md5_sig);
369 MD5SigToString(md5_sig,sigStr);
370 //printf("%s:_docsAlreadyAdded doc='%s' sig='%s' docSigs='%s'\n",
371 // qPrint(name()),qPrint(doc),qPrint(sigStr),qPrint(sigList));
372 if (sigList.find(sigStr)==-1) // new docs, add signature to prevent re-adding it
373 {
374 sigList+=QCString(":")+sigStr;
375 return FALSE;
376 }
377 else
378 {
379 return TRUE;
380 }
381}
382
384 bool stripWhiteSpace,bool atTop)
385{
386 //printf("%s::setDocumentation(%s,%s,%d,%d)\n",qPrint(name()),d,docFile,docLine,stripWhiteSpace);
387 if (d.isEmpty()) return;
388 QCString doc = d;
390 {
392 }
393 else // don't strip whitespace
394 {
395 doc=d;
396 }
397 if (!_docsAlreadyAdded(doc,p->docSignatures))
398 {
399 //printf("setting docs for %s: '%s'\n",qPrint(name()),qPrint(m_doc));
400 if (!p->details.has_value())
401 {
402 p->details = std::make_optional<DocInfo>();
403 }
404 DocInfo &details = p->details.value();
405 if (details.doc.isEmpty()) // fresh detailed description
406 {
407 details.doc = doc;
408 }
409 else if (atTop) // another detailed description, append it to the start
410 {
411 details.doc = doc+"\n\n"+details.doc;
412 }
413 else // another detailed description, append it to the end
414 {
415 details.doc += "\n\n"+doc;
416 }
417 if (docLine!=-1) // store location if valid
418 {
419 details.file = docFile;
420 details.line = docLine;
421 }
422 else
423 {
424 details.file = docFile;
425 details.line = 1;
426 }
427 }
428}
429
435
437{
438 QCString brief = b;
439 brief = brief.stripWhiteSpace();
441 brief = brief.stripWhiteSpace();
442 if (brief.isEmpty()) return;
443 size_t bl = brief.length();
444 if (bl>0)
445 {
446 if (!theTranslator || theTranslator->needsPunctuation()) // add punctuation if needed
447 {
448 int c = brief.at(bl-1);
449 switch(c)
450 {
451 case '.': case '!': case '?': case ':': break;
452 default:
453 if (isUTF8CharUpperCase(brief.str(),0) && !lastUTF8CharIsMultibyte(brief.str())) brief+='.';
454 break;
455 }
456 }
457 }
458
459 if (!_docsAlreadyAdded(brief,p->briefSignatures))
460 {
461 if (p->brief && !p->brief->doc.isEmpty())
462 {
463 //printf("adding to details\n");
465 }
466 else
467 {
468 //fprintf(stderr,"DefinitionImpl::setBriefDescription(%s,%s,%d)\n",b,briefFile,briefLine);
469 if (!p->brief.has_value())
470 {
471 p->brief = std::make_optional<BriefInfo>();
472 }
473 BriefInfo &briefInfo = p->brief.value();
474 briefInfo.doc=brief;
475 if (briefLine!=-1)
476 {
477 briefInfo.file = briefFile;
478 briefInfo.line = briefLine;
479 }
480 else
481 {
482 briefInfo.file = briefFile;
483 briefInfo.line = 1;
484 }
485 }
486 }
487 else
488 {
489 //printf("do nothing!\n");
490 }
491}
492
498
500{
501 if (!_docsAlreadyAdded(doc,p->docSignatures))
502 {
503 if (!p->inbodyDocs.has_value())
504 {
505 p->inbodyDocs = std::make_optional<DocInfo>();
506 }
507 DocInfo &inbodyDocs = p->inbodyDocs.value();
508 if (inbodyDocs.doc.isEmpty()) // fresh inbody docs
509 {
510 inbodyDocs.doc = doc;
511 inbodyDocs.file = inbodyFile;
512 inbodyDocs.line = inbodyLine;
513 }
514 else // another inbody documentation fragment, append this to the end
515 {
516 inbodyDocs.doc += QCString("\n\n")+doc;
517 }
518 }
519}
520
526
527//---------------------------------------
528
529/*! Cache for storing the result of filtering a file */
531{
532 private:
534 {
535 size_t filePos;
536 size_t fileSize;
537 };
538 using LineOffsets = std::vector<size_t>;
539
540 public:
541 static FilterCache &instance();
542
543 //! collects the part of file \a fileName starting at \a startLine and ending at \a endLine into
544 //! buffer \a str. Applies filtering if FILTER_SOURCE_FILES is enabled and the file extension
545 //! matches a filter. Caches file information so that subsequent extraction of blocks from
546 //! the same file can be performed efficiently
547 bool getFileContents(const QCString &fileName,size_t startLine,size_t endLine, std::string &str)
548 {
549 bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES);
550 QCString filter = getFileFilter(fileName,TRUE);
551 bool usePipe = !filter.isEmpty() && filterSourceFiles;
552 return usePipe ? getFileContentsPipe(fileName,filter,startLine,endLine,str)
553 : getFileContentsDisk(fileName,startLine,endLine,str);
554 }
555 private:
556 bool getFileContentsPipe(const QCString &fileName,const QCString &filter,
557 size_t startLine,size_t endLine,std::string &str)
558 {
559 std::unique_lock<std::mutex> lock(m_mutex);
560 auto it = m_cache.find(fileName.str());
561 if (it!=m_cache.end()) // cache hit: reuse stored result
562 {
563 lock.unlock();
564 auto item = it->second;
565 //printf("getFileContents(%s): cache hit\n",qPrint(fileName));
566 // file already processed, get the results after filtering from the tmp file
567 Debug::print(Debug::FilterOutput,0,"Reusing filter result for {} from {} at offset={} size={}\n",
568 fileName,Doxygen::filterDBFileName,item.filePos,item.fileSize);
569
570 auto it_off = m_lineOffsets.find(fileName.str());
571 assert(it_off!=m_lineOffsets.end());
572 auto [ startLineOffset, fragmentSize] = getFragmentLocation(it_off->second,startLine,endLine);
573 //printf("%s: existing file [%zu-%zu]->[%zu-%zu] size=%zu\n",
574 // qPrint(fileName),startLine,endLine,startLineOffset,endLineOffset,fragmentSize);
576 item.filePos+startLineOffset, fragmentSize);
577 return true;
578 }
579 else // cache miss: filter active but file not previously processed
580 {
581 //printf("getFileContents(%s): cache miss\n",qPrint(fileName));
582 // filter file
583 QCString cmd=filter+" \""+fileName+"\"";
584 Debug::print(Debug::ExtCmd,0,"Executing popen(`{}`)\n",cmd);
585 FILE *f = Portable::popen(cmd,"r");
586 if (f==nullptr)
587 {
588 // handle error
589 err("Error opening filter pipe command '{}'\n",cmd);
590 return false;
591 }
593 FilterCacheItem item;
594 item.filePos = m_endPos;
595 if (bf==nullptr)
596 {
597 // handle error
598 err("Error opening filter database file {}\n",Doxygen::filterDBFileName);
600 return false;
601 }
602 // append the filtered output to the database file
603 size_t size=0;
604 while (!feof(f))
605 {
606 const int blockSize = 4096;
607 char buf[blockSize];
608 size_t bytesRead = fread(buf,1,blockSize,f);
609 size_t bytesWritten = fwrite(buf,1,bytesRead,bf);
610 if (bytesRead!=bytesWritten)
611 {
612 // handle error
613 err("Failed to write to filter database {}. Wrote {} out of {} bytes\n",
614 Doxygen::filterDBFileName,bytesWritten,bytesRead);
616 fclose(bf);
617 return false;
618 }
619 size+=bytesWritten;
620 str+=std::string_view(buf,bytesWritten);
621 }
622 item.fileSize = size;
623 // add location entry to the dictionary
624 m_cache.emplace(fileName.str(),item);
625 Debug::print(Debug::FilterOutput,0,"Storing new filter result for {} in {} at offset={} size={}\n",
626 fileName,Doxygen::filterDBFileName,item.filePos,item.fileSize);
627 // update end of file position
628 m_endPos += size;
630 fclose(bf);
631
632 // shrink buffer to [startLine..endLine] part
633 shrinkBuffer(str,fileName,startLine,endLine);
634 }
635 return true;
636 }
637
638 //! reads the fragment start at \a startLine and ending at \a endLine from file \a fileName
639 //! into buffer \a str
640 bool getFileContentsDisk(const QCString &fileName,size_t startLine,size_t endLine,std::string &str)
641 {
642 std::unique_lock<std::mutex> lock(m_mutex);
643 // normal file
644 //printf("getFileContents(%s): no filter\n",qPrint(fileName));
645 auto it = m_lineOffsets.find(fileName.str());
646 if (it == m_lineOffsets.end()) // new file
647 {
648 // read file completely into str buffer
649 readFragmentFromFile(str,fileName,0);
650 // shrink buffer to [startLine..endLine] part
651 shrinkBuffer(str,fileName,startLine,endLine);
652 }
653 else // file already processed before
654 {
655 lock.unlock();
656 auto [ startLineOffset, fragmentSize] = getFragmentLocation(it->second,startLine,endLine);
657 //printf("%s: existing file [%zu-%zu] -> start=%zu size=%zu\n",
658 // qPrint(fileName),startLine,endLine,startLineOffset,fragmentSize);
659 readFragmentFromFile(str,fileName,startLineOffset,fragmentSize);
660 }
661 return true;
662 }
663
664 //! computes the starting offset for each line for file \a fileName, whose contents should
665 //! already be stored in buffer \a str.
666 void compileLineOffsets(const QCString &fileName,const std::string &str)
667 {
668 // line 1 (index 0) is at offset 0
669 auto it = m_lineOffsets.emplace(fileName.data(),LineOffsets{0}).first;
670 const char *p=str.data();
671 while (*p)
672 {
673 char c=0;
674 while ((c=*p)!='\n' && c!=0) p++; // search until end of the line
675 if (c!=0) p++;
676 it->second.push_back(p-str.data());
677 }
678 }
679
680 //! Returns the byte offset and size within a file of a fragment given the array of
681 //! line offsets and the start and end line of the fragment.
682 auto getFragmentLocation(const LineOffsets &lineOffsets,
683 size_t startLine,size_t endLine) -> std::tuple<size_t,size_t>
684 {
685 assert(startLine > 0);
686 assert(startLine <= endLine);
687 const size_t startLineOffset = lineOffsets[std::min(startLine-1,lineOffsets.size()-1)];
688 const size_t endLineOffset = lineOffsets[std::min(endLine, lineOffsets.size()-1)];
689 assert(startLineOffset <= endLineOffset);
690 const size_t fragmentSize = endLineOffset-startLineOffset;
691 return std::tie(startLineOffset,fragmentSize);
692 };
693
694 //! Shrinks buffer \a str which should hold the contents of \a fileName to the
695 //! fragment starting a line \a startLine and ending at line \a endLine
696 void shrinkBuffer(std::string &str,const QCString &fileName,size_t startLine,size_t endLine)
697 {
698 // compute offsets from start for each line
699 compileLineOffsets(fileName,str);
700 auto it = m_lineOffsets.find(fileName.str());
701 assert(it!=m_lineOffsets.end());
702 const LineOffsets &lineOffsets = it->second;
703 auto [ startLineOffset, fragmentSize] = getFragmentLocation(lineOffsets,startLine,endLine);
704 //printf("%s: new file [%zu-%zu]->[%zu-%zu] size=%zu\n",
705 // qPrint(fileName),startLine,endLine,startLineOffset,endLineOffset,fragmentSize);
706 str.erase(0,startLineOffset);
707 str.resize(fragmentSize);
708 }
709
710 //! Reads the fragment start at byte offset \a startOffset of file \a fileName into buffer \a str.
711 //! Result will be a null terminated. If size==0 the whole file will be read and startOffset is ignored.
712 //! If size>0, size bytes will be read.
713 void readFragmentFromFile(std::string &str,const QCString &fileName,size_t startOffset,size_t size=0)
714 {
715 std::ifstream ifs = Portable::openInputStream(fileName,true,true);
716 if (size==0) { startOffset=0; size = static_cast<size_t>(ifs.tellg()); }
717 ifs.seekg(startOffset, std::ios::beg);
718 str.resize(size);
719 ifs.read(str.data(), size);
720 }
721
723 std::unordered_map<std::string,FilterCacheItem> m_cache;
724 std::unordered_map<std::string,LineOffsets> m_lineOffsets;
725 std::mutex m_mutex;
726 size_t m_endPos;
727};
728
730{
731 static FilterCache theInstance;
732 return theInstance;
733}
734
735//-----------------------------------------
736
737
738/*! Reads a fragment of code from file \a fileName starting at
739 * line \a startLine and ending at line \a endLine (inclusive). The fragment is
740 * stored in \a result. If FALSE is returned the code fragment could not be
741 * found.
742 *
743 * The file is scanned for a opening bracket ('{') from \a startLine onward
744 * The line actually containing the bracket is returned via startLine.
745 * The file is scanned for a closing bracket ('}') from \a endLine backward.
746 * The line actually containing the bracket is returned via endLine.
747 * Note that for VHDL code the bracket search is not done.
748 */
749bool readCodeFragment(const QCString &fileName,bool isMacro,
750 int &startLine,int &endLine,QCString &result)
751{
752 bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES);
753 QCString filter = getFileFilter(fileName,TRUE);
754 bool usePipe = !filter.isEmpty() && filterSourceFiles;
755 int tabSize = Config_getInt(TAB_SIZE);
756 SrcLangExt lang = getLanguageFromFileName(fileName);
757 const int blockSize = 4096;
758 std::string str;
760 static_cast<size_t>(std::max(1,startLine)),
761 static_cast<size_t>(std::max({1,startLine,endLine})),str);
762 //printf("readCodeFragment(%s,startLine=%d,endLine=%d)=\n[[[\n%s]]]\n",qPrint(fileName),startLine,endLine,qPrint(str));
763
764 bool found = lang==SrcLangExt::VHDL ||
765 lang==SrcLangExt::Python ||
766 lang==SrcLangExt::Fortran ||
767 isMacro;
768 // for VHDL, Python, and Fortran no bracket search is possible
769 char *p=str.data();
770 if (p && *p)
771 {
772 char c=0;
773 int col=0;
774 int lineNr=startLine;
775 // skip until the opening bracket or lonely : is found
776 char cn=0;
777 while (*p && !found)
778 {
779 int pc=0;
780 while ((c=*p++)!='{' && c!=':' && c!=0)
781 {
782 //printf("parsing char '%c'\n",c);
783 if (c=='\n')
784 {
785 lineNr++,col=0;
786 }
787 else if (c=='\t')
788 {
789 col+=tabSize - (col%tabSize);
790 }
791 else if (pc=='/' && c=='/') // skip single line comment
792 {
793 while ((c=*p++)!='\n' && c!=0);
794 if (c=='\n') lineNr++,col=0;
795 }
796 else if (pc=='/' && c=='*') // skip C style comment
797 {
798 while (((c=*p++)!='/' || pc!='*') && c!=0)
799 {
800 if (c=='\n') lineNr++,col=0;
801 pc=c;
802 }
803 }
804 else
805 {
806 col++;
807 }
808 pc = c;
809 }
810 if (c==':')
811 {
812 cn=*p++;
813 if (cn!=':') found=TRUE;
814 }
815 else if (c=='{')
816 {
817 found=TRUE;
818 }
819 else if (c==0)
820 {
821 break;
822 }
823 }
824 //printf(" -> readCodeFragment(%s,%d,%d) lineNr=%d\n",fileName,startLine,endLine,lineNr);
825 if (found)
826 {
827 // For code with more than one line,
828 // fill the line with spaces until we are at the right column
829 // so that the opening brace lines up with the closing brace
830 if (endLine!=startLine)
831 {
832 QCString spaces;
833 spaces.fill(' ',col);
834 result+=spaces;
835 }
836 // copy until end of line
837 if (c) result+=c;
838 startLine=lineNr;
839 if (c==':')
840 {
841 result+=cn;
842 if (cn=='\n') lineNr++;
843 }
844 char lineStr[blockSize];
845 do
846 {
847 //printf("reading line %d in range %d-%d\n",lineNr,startLine,endLine);
848 int size_read=0;
849 do
850 {
851 // read up to blockSize-1 non-zero characters
852 int i=0;
853 while ((c=*p) && i<blockSize-1)
854 {
855 lineStr[i++]=c;
856 p++;
857 if (c=='\n') break; // stop at end of the line
858 }
859 lineStr[i]=0;
860 size_read=i;
861 result+=lineStr; // append line to the output
862 } while (size_read == (blockSize-1)); // append more if line does not fit in buffer
863 lineNr++;
864 } while (*p);
865
866 // strip stuff after closing bracket
867 int newLineIndex = result.findRev('\n');
868 int braceIndex = result.findRev('}');
869 if (braceIndex > newLineIndex)
870 {
871 result.resize(static_cast<size_t>(braceIndex+1));
872 }
873 endLine=lineNr-1;
874 }
875 if (usePipe)
876 {
877 Debug::print(Debug::FilterOutput, 0, "Filter output\n");
878 Debug::print(Debug::FilterOutput,0,"-------------\n{}\n-------------\n",result);
879 }
880 }
881 QCString encoding = getEncoding(FileInfo(fileName.str()));
882 if (encoding!="UTF-8")
883 {
884 std::string encBuf = result.str();
885 bool ok = transcodeCharacterStringToUTF8(encBuf,encoding.data());
886 if (ok)
887 {
888 result = encBuf;
889 }
890 else
891 {
892 err("failed to transcode characters in code fragment in file {} lines {} to {}, from input encoding {} to UTF-8\n",
893 fileName,startLine,endLine,encoding);
894
895 }
896 }
897 if (!result.isEmpty() && result.at(result.length()-1)!='\n') result += "\n";
898 //printf("readCodeFragment(%d-%d)=%s\n",startLine,endLine,qPrint(result));
899 return found;
900}
901
903{
904 ASSERT(p->def->definitionType()!=Definition::TypeFile); // file overloads this method
905 QCString fn;
906 bool sourceBrowser = Config_getBool(SOURCE_BROWSER);
907 if (sourceBrowser &&
908 p->body && p->body->startLine!=-1 && p->body->fileDef)
909 {
910 fn = p->body->fileDef->getSourceFileBase();
911 }
912 return fn;
913}
914
916{
917 const int maxAnchorStrLen = 20;
918 char anchorStr[maxAnchorStrLen];
919 anchorStr[0]='\0';
920 if (p->body && p->body->startLine!=-1)
921 {
922 if (Htags::useHtags)
923 {
924 qsnprintf(anchorStr,maxAnchorStrLen,"L%d",p->body->defLine);
925 }
926 else
927 {
928 qsnprintf(anchorStr,maxAnchorStrLen,"l%05d",p->body->defLine);
929 }
930 }
931 return anchorStr;
932}
933
934/*! Write a reference to the source code defining this definition */
936{
937 //printf("DefinitionImpl::writeSourceRef %d %p\n",bodyLine,bodyDef);
939 if (!fn.isEmpty())
940 {
941 QCString refText = theTranslator->trDefinedAtLineInSourceFile();
942 int lineMarkerPos = refText.find("@0");
943 int fileMarkerPos = refText.find("@1");
944 if (lineMarkerPos!=-1 && fileMarkerPos!=-1) // should always pass this.
945 {
946 QCString lineStr;
947 lineStr.sprintf("%d",p->body->defLine);
948 QCString anchorStr = getSourceAnchor();
949 ol.startParagraph("definition");
950 if (lineMarkerPos<fileMarkerPos) // line marker before file marker
951 {
952 // write text left from linePos marker
953 ol.parseText(refText.left(lineMarkerPos));
954 ol.writeObjectLink(QCString(),fn,anchorStr,lineStr);
955 // write text between markers
956 ol.parseText(refText.mid(lineMarkerPos+2,fileMarkerPos-lineMarkerPos-2));
957 // write file link
958 ol.writeObjectLink(QCString(),fn,QCString(),p->body->fileDef->name());
959 // write text right from file marker
960 ol.parseText(refText.right(refText.length()-static_cast<size_t>(fileMarkerPos)-2));
961 }
962 else // file marker before line marker
963 {
964 // write text left from file marker
965 ol.parseText(refText.left(fileMarkerPos));
966 // write file link
967 ol.writeObjectLink(QCString(),fn,QCString(),p->body->fileDef->name());
968 // write text between markers
969 ol.parseText(refText.mid(fileMarkerPos+2,lineMarkerPos-fileMarkerPos-2));
970 // write line link
971 ol.writeObjectLink(QCString(),fn,anchorStr,lineStr);
972 // write text right from linePos marker
973 ol.parseText(refText.right(refText.length()-static_cast<size_t>(lineMarkerPos)-2));
974 }
975 ol.endParagraph();
976 }
977 else
978 {
979 err("translation error: invalid markers in trDefinedAtLineInSourceFile()\n");
980 }
981 }
982}
983
984void DefinitionImpl::setBodySegment(int defLine, int bls,int ble)
985{
986 if (!p->body.has_value())
987 {
988 p->body = std::make_optional<BodyInfo>();
989 }
990 BodyInfo &body = p->body.value();
991 body.defLine = defLine;
992 body.startLine = bls;
993 body.endLine = ble;
994}
995
997{
998 if (!p->body.has_value())
999 {
1000 p->body = std::make_optional<BodyInfo>();
1001 }
1002 p->body.value().fileDef=fd;
1003}
1004
1006{
1007 return p->body && p->body->startLine!=-1 &&
1008 p->body->endLine>=p->body->startLine &&
1009 p->body->fileDef;
1010}
1011
1012/*! Write code of this definition into the documentation */
1014{
1015 const MemberDef *thisMd = nullptr;
1016 if (p->def->definitionType()==Definition::TypeMember)
1017 {
1018 thisMd = toMemberDef(p->def);
1019 }
1020 bool inlineSources = thisMd && thisMd->hasInlineSource();
1021 //printf("Source Fragment %s: %d-%d\n",qPrint(name()),
1022 // p->body->startLine,p->body->endLine);
1023 if (inlineSources && hasSources())
1024 {
1025 ol.pushGeneratorState();
1026 QCString codeFragment;
1027 bool isMacro = thisMd && thisMd->memberType()==MemberType::Define;
1028 int actualStart=p->body->startLine,actualEnd=p->body->endLine;
1029 if (readCodeFragment(p->body->fileDef->absFilePath(),isMacro,
1030 actualStart,actualEnd,codeFragment)
1031 )
1032 {
1033 //printf("Adding code fragment '%s' ext='%s' range=%d-%d\n",
1034 // qPrint(codeFragment),qPrint(p->defFileExt),actualStart,actualEnd);
1035 auto intf = Doxygen::parserManager->getCodeParser(p->defFileExt);
1036 intf->resetCodeParserState();
1037 //printf("Read:\n'%s'\n\n",qPrint(codeFragment));
1038
1039 auto &codeOL = ol.codeGenerators();
1040 codeOL.startCodeFragment("DoxyCode");
1041 size_t indent = 0;
1042 intf->parseCode(codeOL, // codeOutIntf
1043 scopeName, // scope
1044 detab(codeFragment,indent), // input
1045 p->lang, // lang
1046 Config_getBool(STRIP_CODE_COMMENTS),
1047 FALSE, // isExample
1048 QCString(), // exampleName
1049 p->body->fileDef, // fileDef
1050 actualStart, // startLine
1051 actualEnd, // endLine
1052 TRUE, // inlineFragment
1053 thisMd, // memberDef
1054 TRUE // show line numbers
1055 );
1056 codeOL.endCodeFragment("DoxyCode");
1057 }
1058 ol.popGeneratorState();
1059 }
1060}
1061
1062static inline MemberVector refMapToVector(const std::unordered_map<std::string,MemberDef *> &map)
1063{
1064 // convert map to a vector of values
1065 MemberVector result;
1066 std::transform(map.begin(),map.end(), // iterate over map
1067 std::back_inserter(result), // add results to vector
1068 [](const auto &item)
1069 { return item.second; } // extract value to add from map Key,Value pair
1070 );
1071 // and sort it
1072 std::stable_sort(result.begin(),result.end(),
1073 [](const auto &m1,const auto &m2) { return genericCompareMembers(m1,m2)<0; });
1074 return result;
1075}
1076
1077/*! Write a reference to the source code fragments in which this
1078 * definition is used.
1079 */
1081 const QCString &text,const std::unordered_map<std::string,MemberDef *> &membersMap,
1082 bool /*funcOnly*/) const
1083{
1084 if (!membersMap.empty())
1085 {
1086 auto members = refMapToVector(membersMap);
1087
1088 auto replaceFunc = [this,&members,scopeName,&ol](size_t entryIndex)
1089 {
1090 bool sourceBrowser = Config_getBool(SOURCE_BROWSER);
1091 bool refLinkSource = Config_getBool(REFERENCES_LINK_SOURCE);
1092 const MemberDef *md=members[entryIndex];
1093 if (md)
1094 {
1095 QCString scope=md->getScopeString();
1096 QCString name=md->name();
1097 //printf("class=%p scope=%s scopeName=%s\n",md->getClassDef(),qPrint(scope),scopeName);
1098 if (!scope.isEmpty() && scope!=scopeName)
1099 {
1100 name.prepend(scope+getLanguageSpecificSeparator(p->lang));
1101 }
1102 if (!md->isObjCMethod() &&
1103 (md->isFunction() || md->isSlot() ||
1104 md->isPrototype() || md->isSignal()
1105 )
1106 )
1107 {
1108 name+="()";
1109 }
1110 if (sourceBrowser &&
1111 !(md->isLinkable() && !refLinkSource) &&
1112 md->getStartBodyLine()!=-1 &&
1113 md->getBodyDef()
1114 )
1115 {
1116 const int maxLineNrStr = 10;
1117 char anchorStr[maxLineNrStr];
1118 qsnprintf(anchorStr,maxLineNrStr,"l%05d",md->getStartBodyLine());
1119 //printf("Write object link to %s\n",qPrint(md->getBodyDef()->getSourceFileBase()));
1120 ol.writeObjectLink(QCString(),md->getBodyDef()->getSourceFileBase(),anchorStr,name);
1121 }
1122 else if (md->isLinkable())
1123 {
1125 md->getOutputFileBase(),
1126 md->anchor(),name);
1127 }
1128 else
1129 {
1130 ol.docify(name);
1131 }
1132 }
1133 };
1134
1135 ol.startParagraph("reference");
1136 ol.parseText(text);
1137 ol.docify(" ");
1138 writeMarkerList(ol,
1139 theTranslator->trWriteList(static_cast<int>(members.size())).str(),
1140 members.size(),
1141 replaceFunc);
1142 ol.writeString(".");
1143 ol.endParagraph();
1144
1145 }
1146}
1147
1149{
1150 _writeSourceRefList(ol,scopeName,theTranslator->trReferencedBy(),p->sourceRefByDict,FALSE);
1151}
1152
1154{
1155 _writeSourceRefList(ol,scopeName,theTranslator->trReferences(),p->sourceRefsDict,TRUE);
1156}
1157
1159{
1160 return !p->sourceRefByDict.empty();
1161}
1162
1164{
1165 return !p->sourceRefsDict.empty();
1166}
1167
1169{
1170 bool extractAll = Config_getBool(EXTRACT_ALL);
1171 //bool sourceBrowser = Config_getBool(SOURCE_BROWSER);
1172 bool hasDocs =
1173 (p->details && !p->details->doc.isEmpty()) || // has detailed docs
1174 (p->brief && !p->brief->doc.isEmpty()) || // has brief description
1175 (p->inbodyDocs && !p->inbodyDocs->doc.isEmpty()) || // has inbody docs
1176 extractAll //|| // extract everything
1177 // (sourceBrowser && p->body &&
1178 // p->body->startLine!=-1 && p->body->fileDef)
1179 ; // link to definition
1180 return hasDocs;
1181}
1182
1184{
1185 bool hasDocs =
1186 (p->details && !p->details->doc.isEmpty()) ||
1187 (p->brief && !p->brief->doc.isEmpty()) ||
1188 (p->inbodyDocs && !p->inbodyDocs->doc.isEmpty());
1189 return hasDocs;
1190}
1191
1193{
1194 if (md)
1195 {
1196 p->sourceRefByDict.emplace(sourceRefName.str(),md);
1197 }
1198}
1199
1201{
1202 if (md)
1203 {
1204 p->sourceRefsDict.emplace(sourceRefName.str(),md);
1205 }
1206}
1207
1209{
1210 return nullptr;
1211}
1212
1214{
1215 err("DefinitionImpl::addInnerCompound() called\n");
1216}
1217
1218static std::recursive_mutex g_qualifiedNameMutex;
1219
1221{
1222 std::lock_guard<std::recursive_mutex> lock(g_qualifiedNameMutex);
1223 if (!p->qualifiedName.isEmpty())
1224 {
1225 return p->qualifiedName;
1226 }
1227
1228 //printf("start %s::qualifiedName() localName=%s\n",qPrint(name()),qPrint(p->localName));
1229 if (p->outerScope==nullptr)
1230 {
1231 if (p->localName=="<globalScope>")
1232 {
1233 return "";
1234 }
1235 else
1236 {
1237 return p->localName;
1238 }
1239 }
1240
1241 if (p->outerScope->name()=="<globalScope>")
1242 {
1243 p->qualifiedName = p->localName;
1244 }
1245 else
1246 {
1247 p->qualifiedName = p->outerScope->qualifiedName()+
1249 p->localName;
1250 }
1251 //printf("end %s::qualifiedName()=%s\n",qPrint(name()),qPrint(p->qualifiedName));
1252 //count--;
1253 return p->qualifiedName;
1254}
1255
1257{
1258 std::lock_guard<std::recursive_mutex> lock(g_qualifiedNameMutex);
1259 //printf("%s::setOuterScope(%s)\n",qPrint(name()),d?qPrint(d->name()):"<none>");
1260 Definition *outerScope = p->outerScope;
1261 bool found=false;
1262 // make sure that we are not creating a recursive scope relation.
1263 while (outerScope && !found)
1264 {
1265 found = (outerScope==d);
1266 outerScope = outerScope->getOuterScope();
1267 }
1268 if (!found)
1269 {
1270 p->qualifiedName.clear(); // flush cached scope name
1271 p->outerScope = d;
1272 }
1273 p->hidden = p->hidden || d->isHidden();
1274 assert(p->def!=p->outerScope);
1275}
1276
1278{
1279 return p->localName;
1280}
1281
1283{
1284 p->partOfGroups.push_back(gd);
1285}
1286
1288{
1289 p->xrefListItems.insert(p->xrefListItems.end(), sli.cbegin(), sli.cend());
1290}
1291
1293{
1294 auto otherXrefList = d->xrefListItems();
1295
1296 // append vectors
1297 p->xrefListItems.reserve(p->xrefListItems.size()+otherXrefList.size());
1298 p->xrefListItems.insert (p->xrefListItems.end(),
1299 otherXrefList.begin(),otherXrefList.end());
1300
1301 // sort results on itemId
1302 std::stable_sort(p->xrefListItems.begin(),p->xrefListItems.end(),
1303 [](RefItem *left,RefItem *right)
1304 { return left->id() <right->id() ||
1305 (left->id()==right->id() &&
1306 left->list()->listName() < right->list()->listName());
1307 });
1308
1309 // filter out duplicates
1310 auto last = std::unique(p->xrefListItems.begin(),p->xrefListItems.end(),
1311 [](const RefItem *left,const RefItem *right)
1312 { return left->id()==right->id() &&
1313 left->list()->listName()==right->list()->listName();
1314 });
1315 p->xrefListItems.erase(last, p->xrefListItems.end());
1316}
1317
1319{
1320 for (const RefItem *item : p->xrefListItems)
1321 {
1322 if (item->list()->listName()==listName)
1323 {
1324 return item->id();
1325 }
1326 }
1327 return -1;
1328}
1329
1331{
1332 return p->xrefListItems;
1333}
1334
1336{
1337 QCString result;
1338 if (p->outerScope && p->outerScope!=Doxygen::globalScope)
1339 {
1340 result = p->outerScope->pathFragment();
1341 }
1342 if (p->def->isLinkable())
1343 {
1344 if (!result.isEmpty()) result+="/";
1345 if (p->def->definitionType()==Definition::TypeGroup &&
1346 !toGroupDef(p->def)->groupTitle().isEmpty())
1347 {
1348 result+=toGroupDef(p->def)->groupTitle();
1349 }
1350 else if (p->def->definitionType()==Definition::TypePage &&
1351 toPageDef(p->def)->hasTitle())
1352 {
1353 result+=toPageDef(p->def)->title();
1354 }
1355 else
1356 {
1357 result+=p->localName;
1358 }
1359 }
1360 else
1361 {
1362 result+=p->localName;
1363 }
1364 return result;
1365}
1366
1367//----------------------------------------------------------------------------------------
1368
1369// TODO: move to htmlgen
1370/*! Returns the string used in the footer for $navpath when
1371 * GENERATE_TREEVIEW is enabled
1372 */
1374{
1375 QCString result;
1376 Definition *outerScope = getOuterScope();
1377 QCString locName = localName();
1378 if (outerScope && outerScope!=Doxygen::globalScope)
1379 {
1380 result+=outerScope->navigationPathAsString();
1381 }
1382 else if (p->def->definitionType()==Definition::TypeFile &&
1383 toFileDef(p->def)->getDirDef())
1384 {
1385 result+=(toFileDef(p->def))->getDirDef()->navigationPathAsString();
1386 }
1387 result+="<li class=\"navelem\">";
1388 if (p->def->isLinkableInProject())
1389 {
1390 QCString fn = p->def->getOutputFileBase();
1392 if (p->def->definitionType()==Definition::TypeGroup &&
1393 !toGroupDef(p->def)->groupTitle().isEmpty())
1394 {
1395 QCString title = parseCommentAsHtml(p->def,nullptr,toGroupDef(p->def)->groupTitle(),
1396 p->def->getDefFileName(),p->def->getDefLine());
1397 result+="<a href=\"$relpath^"+fn+"\">"+title+"</a>";
1398 }
1399 else if (p->def->definitionType()==Definition::TypePage &&
1400 toPageDef(p->def)->hasTitle())
1401 {
1402 QCString title = parseCommentAsHtml(p->def,nullptr,toPageDef(p->def)->title(),
1403 p->def->getDefFileName(),p->def->getDefLine());
1404 result+="<a href=\"$relpath^"+fn+"\">"+title+"</a>";
1405 }
1406 else if (p->def->definitionType()==Definition::TypeClass)
1407 {
1408 QCString name = toClassDef(p->def)->className();
1409 if (name.endsWith("-p"))
1410 {
1411 name = name.left(name.length()-2);
1412 }
1413 result+="<a href=\"$relpath^"+fn;
1414 if (!p->def->anchor().isEmpty()) result+="#"+p->def->anchor();
1415 result+="\">"+convertToHtml(name)+"</a>";
1416 }
1417 else
1418 {
1419 result+="<a href=\"$relpath^"+fn+"\">"+
1420 convertToHtml(locName)+"</a>";
1421 }
1422 }
1423 else
1424 {
1425 result+="<b>"+convertToHtml(locName)+"</b>";
1426 }
1427 result+="</li>";
1428 return result;
1429}
1430
1431// TODO: move to htmlgen
1433{
1434 ol.pushGeneratorState();
1436
1437 QCString navPath;
1438 navPath += "<div id=\"nav-path\" class=\"navpath\">\n"
1439 " <ul>\n";
1440 navPath += navigationPathAsString();
1441 navPath += " </ul>\n"
1442 "</div>\n";
1443 ol.writeNavigationPath(navPath);
1444
1445 ol.popGeneratorState();
1446}
1447
1448void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const
1449{
1450 // first check if we have anything to show or if the outline is already shown on the outline panel
1451 if (p->sectionRefs.empty() || (Config_getBool(GENERATE_TREEVIEW) && Config_getBool(PAGE_OUTLINE_PANEL))) return;
1452 // generate the embedded toc
1453 //ol.writeLocalToc(p->sectionRefs,localToc);
1454
1455 auto generateTocEntries = [this,&ol]()
1456 {
1457 for (const SectionInfo *si : p->sectionRefs)
1458 {
1459 if (si->type().isSection())
1460 {
1461 ol.startTocEntry(si);
1462 const MemberDef *md = p->def->definitionType()==Definition::TypeMember ? toMemberDef(p->def) : nullptr;
1463 const Definition *scope = p->def->definitionType()==Definition::TypeMember ? p->def->getOuterScope() : p->def;
1464 QCString docTitle = si->title();
1465 if (docTitle.isEmpty()) docTitle = si->label();
1466 ol.generateDoc(docFile(),
1468 scope,
1469 md,
1470 docTitle,
1471 DocOptions()
1472 .setIndexWords(true)
1473 .setSingleLine(true)
1474 .setSectionLevel(si->type().level())
1475 );
1476 ol.endTocEntry(si);
1477 }
1478 }
1479 };
1480
1481 if (localToc.isHtmlEnabled())
1482 {
1483 ol.pushGeneratorState();
1485 ol.startLocalToc(localToc.htmlLevel());
1486 generateTocEntries();
1487 ol.endLocalToc();
1488 ol.popGeneratorState();
1489 }
1490 if (localToc.isDocbookEnabled())
1491 {
1492 ol.pushGeneratorState();
1494 ol.startLocalToc(localToc.docbookLevel());
1495 generateTocEntries();
1496 ol.endLocalToc();
1497 ol.popGeneratorState();
1498 }
1499 if (localToc.isLatexEnabled())
1500 {
1501 ol.pushGeneratorState();
1503 ol.startLocalToc(localToc.latexLevel());
1504 // no gneerateTocEntries() needed for LaTeX
1505 ol.endLocalToc();
1506 ol.popGeneratorState();
1507 }
1508}
1509
1510//----------------------------------------------------------------------------------------
1511
1513{
1514 return p->sectionRefs;
1515}
1516
1518{
1519 return p->symbolName;
1520}
1521
1522//----------------------
1523
1525{
1526 return p->details ? p->details->doc : QCString("");
1527}
1528
1530{
1531 return p->details ? p->details->line : p->brief ? p->brief->line : 1;
1532}
1533
1535{
1536 if (p->details && !p->details->file.isEmpty()) return p->details->file;
1537 else if (p->brief && !p->brief->file.isEmpty()) return p->brief->file;
1538 else return "<" + p->name + ">";
1539}
1540
1541//----------------------------------------------------------------------------
1542// strips w from s iff s starts with w
1543static bool stripWord(QCString &s,QCString w)
1544{
1545 bool success=FALSE;
1546 if (s.left(w.length())==w)
1547 {
1548 success=TRUE;
1549 s=s.right(s.length()-w.length());
1550 }
1551 return success;
1552}
1553
1554//----------------------------------------------------------------------------
1555// some quasi intelligent brief description abbreviator :^)
1556static QCString abbreviate(const QCString &s,const QCString &name)
1557{
1558 QCString scopelessName=name;
1559 int i=scopelessName.findRev("::");
1560 if (i!=-1) scopelessName=scopelessName.mid(i+2);
1561 QCString result=s;
1562 result=result.stripWhiteSpace();
1563 // strip trailing .
1564 if (!result.isEmpty() && result.at(result.length()-1)=='.')
1565 result=result.left(result.length()-1);
1566
1567 // strip any predefined prefix
1568 const StringVector &briefDescAbbrev = Config_getList(ABBREVIATE_BRIEF);
1569 for (const auto &p : briefDescAbbrev)
1570 {
1571 QCString str = substitute(p,"$name",scopelessName); // replace $name with entity name
1572 str += " ";
1573 stripWord(result,str);
1574 }
1575
1576 // capitalize first character
1577 if (!result.isEmpty())
1578 {
1579 char c = result[0];
1580 if (c >= 'a' && c <= 'z') result[0] += 'A' - 'a';
1581 }
1582
1583 return result;
1584}
1585
1586
1587//----------------------
1588
1590{
1591 //printf("%s::briefDescription(%d)='%s'\n",qPrint(name()),abbr,p->brief?qPrint(p->brief->doc):"<none>");
1592 return p->brief ?
1593 (abbr ? abbreviate(p->brief->doc,p->def->displayName()) : p->brief->doc) :
1594 QCString("");
1595}
1596
1598{
1599 if (p->brief && p->brief->tooltip.isEmpty() && !p->brief->doc.isEmpty())
1600 {
1601 const MemberDef *md = p->def->definitionType()==Definition::TypeMember ? toMemberDef(p->def) : nullptr;
1602 const Definition *scope = p->def->definitionType()==Definition::TypeMember ? p->def->getOuterScope() : p->def;
1603 p->brief->tooltip = parseCommentAsText(scope,md,
1604 p->brief->doc, p->brief->file, p->brief->line);
1605 }
1606}
1607
1609{
1610 return p->brief ? p->brief->tooltip : QCString();
1611}
1612
1614{
1615 return p->brief ? p->brief->line : 1;
1616}
1617
1619{
1620 return p->brief && !p->brief->file.isEmpty() ? p->brief->file : QCString("<"+p->name+">");
1621}
1622
1623//----------------------
1624
1626{
1627 return p->inbodyDocs ? p->inbodyDocs->doc : QCString("");
1628}
1629
1631{
1632 return p->inbodyDocs ? p->inbodyDocs->line : 1;
1633}
1634
1636{
1637 return p->inbodyDocs && !p->inbodyDocs->file.isEmpty() ? p->inbodyDocs->file : QCString("<"+p->name+">");
1638}
1639
1640
1641//----------------------
1642
1644{
1645 return p->defFileName;
1646}
1647
1649{
1650 return p->defFileExt;
1651}
1652
1654{
1655 return p->hidden;
1656}
1657
1659{
1660 return p->def->isLinkableInProject() && !p->hidden;
1661}
1662
1664{
1665 return p->def->isLinkable() && !p->hidden;
1666}
1667
1669{
1670 return p->isArtificial;
1671}
1672
1674{
1675 return p->isExported;
1676}
1677
1679{
1680 return p->ref;
1681}
1682
1684{
1685 return !p->ref.isEmpty();
1686}
1687
1689{
1690 return p->body ? p->body->defLine : -1;
1691}
1692
1694{
1695 return p->body ? p->body->startLine : -1;
1696}
1697
1699{
1700 return p->body ? p->body->endLine : -1;
1701}
1702
1704{
1705 return p->body ? p->body->fileDef : nullptr;
1706}
1707
1709{
1710 return p->partOfGroups;
1711}
1712
1714{
1715 for (const auto &gd : partOfGroups())
1716 {
1717 if (gd->isLinkable()) return true;
1718 }
1719 return false;
1720}
1721
1723{
1724 return p->outerScope;
1725}
1726
1727static std::mutex g_memberReferenceMutex;
1728
1730{
1731 std::lock_guard<std::mutex> lock(g_memberReferenceMutex);
1732 if (p->referencesMembers.empty() && !p->sourceRefsDict.empty())
1733 {
1734 p->referencesMembers = refMapToVector(p->sourceRefsDict);
1735 }
1736 return p->referencesMembers;
1737}
1738
1740{
1741 std::lock_guard<std::mutex> lock(g_memberReferenceMutex);
1742 if (p->referencedByMembers.empty() && !p->sourceRefByDict.empty())
1743 {
1744 p->referencedByMembers = refMapToVector(p->sourceRefByDict);
1745 }
1746 return p->referencedByMembers;
1747}
1748
1750{
1751 const DefinitionImpl *defImpl = other->toDefinitionImpl_();
1752 if (defImpl)
1753 {
1754 for (const auto &kv : defImpl->p->sourceRefsDict)
1755 {
1756 auto it = p->sourceRefsDict.find(kv.first);
1757 if (it != p->sourceRefsDict.end())
1758 {
1759 p->sourceRefsDict.insert(kv);
1760 }
1761 }
1762 }
1763}
1764
1766{
1767 const DefinitionImpl *defImpl = other->toDefinitionImpl_();
1768 if (defImpl)
1769 {
1770 for (const auto &kv : defImpl->p->sourceRefByDict)
1771 {
1772 auto it = p->sourceRefByDict.find(kv.first);
1773 if (it != p->sourceRefByDict.end())
1774 {
1775 p->sourceRefByDict.emplace(kv.first,kv.second);
1776 }
1777 }
1778 }
1779}
1780
1781
1783{
1784 p->ref=r;
1785}
1786
1788{
1789 return p->lang;
1790}
1791
1793{
1794 p->hidden = p->hidden || b;
1795}
1796
1798{
1799 p->isArtificial = b;
1800}
1801
1803{
1804 p->isExported = b;
1805}
1806
1808{
1809 p->localName=name;
1810}
1811
1813{
1814 p->lang=lang;
1815}
1816
1817
1819{
1820 p->symbolName=name;
1821}
1822
1824{
1825 return p->symbolName;
1826}
1827
1829{
1830 bool briefMemberDesc = Config_getBool(BRIEF_MEMBER_DESC);
1831 return !briefDescription().isEmpty() && briefMemberDesc;
1832}
1833
1835{
1836 QCString ref = getReference();
1837 if (!ref.isEmpty())
1838 {
1839 auto it = Doxygen::tagDestinationMap.find(ref.str());
1841 {
1842 QCString result(it->second);
1843 size_t l = result.length();
1844 if (!relPath.isEmpty() && l>0 && result.at(0)=='.')
1845 { // relative path -> prepend relPath.
1846 result.prepend(relPath);
1847 l+=relPath.length();
1848 }
1849 if (l>0 && result.at(l-1)!='/') result+='/';
1850 return result;
1851 }
1852 }
1853 return relPath;
1854}
1855
1857{
1858 return p->name;
1859}
1860
1862{
1863 return p->isAnonymous;
1864}
1865
1867{
1868 return p->defLine;
1869}
1870
1872{
1873 return p->defColumn;
1874}
1875
1879
1883
1887
1888//---------------------------------------------------------------------------------
1889
1891 : m_def(def), m_scope(scope), m_symbolName(alias->_symbolName())
1892{
1893}
1894
1898
1900{
1901 //printf("%s::addToMap(%s)\n",qPrint(name()),qPrint(alias->name()));
1903 if (m_scope==nullptr)
1904 {
1905 m_qualifiedName = m_def->localName();
1906 }
1907 else
1908 {
1909 m_qualifiedName = m_scope->qualifiedName()+
1910 getLanguageSpecificSeparator(m_scope->getLanguage())+
1911 m_def->localName();
1912 }
1913}
1914
1919
1924
1926{
1927 return m_qualifiedName;
1928}
1929
1930//---------------------------------------------------------------------------------
1931
1933{
1934 return dm ? dm->toDefinition_() : nullptr;
1935}
1936
1938{
1939 return d ? d->toDefinitionMutable_() : nullptr;
1940}
1941
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:131
static NamespaceDefMutable * globalScope
Definition doxygen.h:121
static StringMap tagDestinationMap
Definition doxygen.h:116
static QCString filterDBFileName
Definition doxygen.h:133
static SymbolMap< Definition > * symbolMap
Definition doxygen.h:125
static ClangUsrMap * clangUsrMap
Definition doxygen.h:126
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:1956
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:842
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:482
#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
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:5127
QCString parseCommentAsHtml(const Definition *scope, const MemberDef *member, const QCString &doc, const QCString &fileName, int lineNr)
Definition util.cpp:5341
QCString convertToHtml(const QCString &s, bool keepEntities)
Definition util.cpp:3893
QCString parseCommentAsText(const Definition *scope, const MemberDef *md, const QCString &doc, const QCString &fileName, int lineNr)
Definition util.cpp:5285
bool transcodeCharacterStringToUTF8(std::string &input, const char *inputEncoding)
Definition util.cpp:1394
QCString stripScope(const QCString &name)
Definition util.cpp:3709
int computeQualifiedIndex(const QCString &name)
Return the index of the last :: in the string name that is still before the first <.
Definition util.cpp:6754
QCString convertToXML(const QCString &s, bool keepEntities)
Definition util.cpp:3842
QCString detab(const QCString &s, size_t &refIndent)
Definition util.cpp:6650
QCString getLanguageSpecificSeparator(SrcLangExt lang, bool classScope)
Returns the scope separator to use given the programming language lang.
Definition util.cpp:5829
QCString getEncoding(const FileInfo &fi)
Definition util.cpp:5627
QCString stripLeadingAndTrailingEmptyLines(const QCString &s, int &docLine)
Special version of QCString::stripWhiteSpace() that only strips completely blank lines.
Definition util.cpp:4946
QCString getFileFilter(const QCString &name, bool isSourceCode)
Definition util.cpp:1360
void writeMarkerList(OutputList &ol, const std::string &markerText, size_t numMarkers, std::function< void(size_t)> replaceFunc)
Definition util.cpp:1094
void addHtmlExtensionIfMissing(QCString &fName)
Definition util.cpp:4843
A bunch of utility functions.
bool isId(int c)
Definition util.h:208