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