58 auto ast {
validatingParseDoc(*parser.get(),fileName,lineNr,scope,
nullptr,title,
false,
false,
60 auto astImpl =
dynamic_cast<const DocNodeAST*
>(ast.get());
68 std::visit(visitor,astImpl->root);
82 if (std::holds_alternative<const Definition *>(
info))
90 else if (std::holds_alternative<const SectionInfo *>(
info))
104 for (
size_t i=0;i<
word.length();i++)
112 static const char *
hex =
"0123456789ABCDEF";
113 unsigned char uc =
static_cast<unsigned char>(
word.at(i));
133 bool lastIsSpace=
true;
134 for (
size_t si=0; si<title.
length(); si++)
136 char c = title.
at(si);
137 if (c==
'@' || c==
'\\')
143 while (si<title.
length() && (
isId(c) || c==
':')) c = title.
at(++si);
151 for (
size_t tsi = si; tsi<title.
length(); ++tsi)
153 if (title.
at(tsi)==
'>')
161 else if (
isId(c) || c==
':')
167 else if (!lastIsSpace)
174 if (di>0 && title.
at(di-1)==
' ') di--;
180 while ((i=title.
find(
' ',p))!=-1)
183 indices.push_back(p);
186 if (p<
static_cast<int>(title.
length()))
189 indices.push_back(p);
195#define SEARCH_INDEX_ALL 0
196#define SEARCH_INDEX_CLASSES 1
197#define SEARCH_INDEX_INTERFACES 2
198#define SEARCH_INDEX_STRUCTS 3
199#define SEARCH_INDEX_EXCEPTIONS 4
200#define SEARCH_INDEX_NAMESPACES 5
201#define SEARCH_INDEX_FILES 6
202#define SEARCH_INDEX_FUNCTIONS 7
203#define SEARCH_INDEX_VARIABLES 8
204#define SEARCH_INDEX_TYPEDEFS 9
205#define SEARCH_INDEX_SEQUENCES 10
206#define SEARCH_INDEX_DICTIONARIES 11
207#define SEARCH_INDEX_ENUMS 12
208#define SEARCH_INDEX_ENUMVALUES 13
209#define SEARCH_INDEX_PROPERTIES 14
210#define SEARCH_INDEX_EVENTS 15
211#define SEARCH_INDEX_RELATED 16
212#define SEARCH_INDEX_DEFINES 17
213#define SEARCH_INDEX_GROUPS 18
214#define SEARCH_INDEX_PAGES 19
215#define SEARCH_INDEX_CONCEPTS 20
216#define SEARCH_INDEX_MODULES 21
222 {
"classes" , []() {
return theTranslator->trClasses(); }, {} },
223 {
"interfaces" , []() {
return theTranslator->trSliceInterfaces(); }, {} },
224 {
"structs" , []() {
return theTranslator->trStructs(); }, {} },
225 {
"exceptions" , []() {
return theTranslator->trExceptions(); }, {} },
226 {
"namespaces" , []() {
return Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
230 {
"functions" , []() {
return Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
233 {
"variables" , []() {
return Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
236 {
"typedefs" , []() {
return theTranslator->trTypedefs(); }, {} },
237 {
"sequences" , []() {
return theTranslator->trSequences(); }, {} },
238 {
"dictionaries", []() {
return theTranslator->trDictionaries(); }, {} },
239 {
"enums" , []() {
return theTranslator->trEnumerations(); }, {} },
240 {
"enumvalues" , []() {
return theTranslator->trEnumerationValues(); }, {} },
241 {
"properties" , []() {
return theTranslator->trProperties(); }, {} },
242 {
"events" , []() {
return theTranslator->trEvents(); }, {} },
243 {
"related" , []() {
return theTranslator->trFriends(); }, {} },
244 {
"defines" , []() {
return theTranslator->trDefines(); }, {} },
247 {
"concepts" , []() {
return theTranslator->trConcept(
true,
false); }, {} },
248 {
"modules" , []() {
return theTranslator->trModule(
true,
false); }, {} }
269 bool isFriendToHide = hideFriendCompounds &&
273 if (!(md->
isFriend() && isFriendToHide))
314 (md->
isFriend() && !isFriendToHide))
320 else if (isLinkable &&
374 if (cd->isLinkable())
407 if (nd->isLinkable())
418 if (cd->isLinkable())
429 if (mod->isLinkable() && mod->isPrimaryInterface())
440 for (
const auto &fd : *fn)
443 if (fd->isLinkable())
457 for (
const auto &md : *mn)
470 for (
const auto &md : *mn)
480 if (gd->isLinkable())
485 for (
int index : tokenIndices)
496 if (pd->isLinkable())
501 for (
int index : tokenIndices)
515 for (
int index : tokenIndices)
524 for (
const auto §ionInfo : sm)
526 if (sectionInfo->level()>0)
532 for (
int index : tokenIndices)
543 for (
auto &[name,symList] : sii.symbolMap)
550 std::stable_sort(symList.begin(),
552 [](
const auto &t1,
const auto &t2)
554 int eq = qstricmp_sort(t1.word,t2.word);
555 return eq==0 ? qstricmp_sort(t1.title,t2.title)<0 : eq<0;
566 t <<
"var indexSectionsWithContent =\n";
571 if (!sii.symbolMap.empty())
574 t <<
" " << j <<
": \"";
576 std::string previous_letter;
577 for (
const auto &[letter,list] : sii.symbolMap)
579 if (letter != previous_letter)
581 if ( letter ==
"\"" ) t <<
"\\";
583 previous_letter = letter;
592 t <<
"var indexSectionNames =\n";
597 if (!sii.symbolMap.empty())
600 t <<
" " << j <<
": \"" << sii.name <<
"\"";
606 t <<
"var indexSectionLabels =\n";
611 if (!sii.symbolMap.empty())
614 t <<
" " << j <<
": \"" <<
convertToXML(sii.getText()) <<
"\"";
627 return std::holds_alternative<const Definition *>(info);
631 return isDef(info) ? std::get<const Definition *>(info) :
nullptr;
635 return std::holds_alternative<const SectionInfo *>(info);
639 return isSection(info) ? std::get<const SectionInfo *>(info) :
nullptr;
646 err(
"Failed to open file '{}' for writing...\n",dataFileName);
650 ti <<
"var searchData=\n";
663 bool firstEntry=
TRUE;
668 for (
auto it = list.begin(); it!=list.end();)
692 ti <<
" ['" <<
id <<
"_" << cnt++ <<
"',['";
721 if (!extLinksInWindow || ref.
isEmpty())
753 bool overloadedFunction = ((prevScope!=
nullptr && scope==prevScope) || (scope && scope==nextScope)) &&
757 if (overloadedFunction)
816 ti <<
"'" << name <<
"'";
837 std::size_t numThreads =
static_cast<std::size_t
>(
Config_getInt(NUM_PROC_THREADS));
841 std::vector< std::future<int> > results;
845 for (
const auto &[letter,symList] : sii.symbolMap)
848 baseName.
sprintf(
"%s_%x",sii.name.data(),p);
849 QCString dataFileName = searchDirName +
"/"+baseName+
".js";
850 auto &list = symList;
851 auto processFile = [p,baseName,dataFileName,&list]()
856 results.emplace_back(threadPool.
queue(processFile));
861 for (
auto &f : results) f.get();
868 for (
const auto &[letter,symList] : sii.symbolMap)
871 baseName.
sprintf(
"%s_%x",sii.name.data(),p);
872 QCString dataFileName = searchDirName +
"/"+baseName+
".js";
900 list.push_back(
term);
A abstract class representing of a compound symbol.
virtual bool isImplicitTemplateInstance() const =0
The common base class of all entity definitions found in the sources.
virtual const QCString & localName() const =0
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
virtual QCString getDefFileName() const =0
virtual bool isLinkable() const =0
virtual int getDefLine() const =0
virtual DefType definitionType() const =0
virtual QCString anchor() const =0
virtual const FileDef * getBodyDef() const =0
virtual QCString getReference() const =0
virtual QCString qualifiedName() const =0
virtual QCString getOutputFileBase() const =0
virtual Definition * getOuterScope() const =0
virtual const QCString & name() const =0
Class representing the abstract syntax tree of a documentation block.
static NamespaceLinkedMap * namespaceLinkedMap
static ConceptLinkedMap * conceptLinkedMap
static std::unique_ptr< PageDef > mainPage
static FileNameLinkedMap * inputNameLinkedMap
static ClassLinkedMap * classLinkedMap
static MemberNameLinkedMap * functionNameLinkedMap
static NamespaceDefMutable * globalScope
static IndexList * indexList
static PageLinkedMap * pageLinkedMap
static MemberNameLinkedMap * memberNameLinkedMap
static GroupLinkedMap * groupLinkedMap
A model of a file symbol.
A model of a group of symbols.
Generator for HTML code fragments.
Concrete visitor implementation for HTML output.
A model of a class/file/namespace member symbol.
virtual QCString typeString() const =0
virtual bool isSignal() const =0
virtual bool isFriend() const =0
virtual bool isForeign() const =0
virtual bool isRelated() const =0
virtual bool isSequence() const =0
virtual const ClassDef * getClassDef() const =0
virtual GroupDef * getGroupDef()=0
virtual bool isTypedef() const =0
virtual bool isSlot() const =0
virtual const FileDef * getFileDef() const =0
virtual bool isEvent() const =0
virtual bool isFunction() const =0
virtual bool isDictionary() const =0
virtual MemberDef * resolveAlias()=0
virtual bool isDefine() const =0
virtual const NamespaceDef * getNamespaceDef() const =0
virtual bool isEnumerate() const =0
virtual bool isVariable() const =0
virtual QCString argsString() const =0
virtual bool isCallable() const =0
virtual bool isEnumValue() const =0
virtual bool isProperty() const =0
static ModuleManager & instance()
An abstract interface of a namespace symbol.
Class representing a list of different code generators.
void add(OutputCodeIntfPtr &&p)
This is an alternative implementation of QCString.
int find(char c, int index=0, bool cs=TRUE) const
size_t length() const
Returns the length of the string, not counting the 0-terminator.
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
char & at(size_t i)
Returns a reference to the character at index i.
bool isEmpty() const
Returns TRUE iff the string is empty.
void resize(size_t newlen)
const std::string & str() const
QCString & sprintf(const char *format,...)
static ResourceMgr & instance()
Returns the one and only instance of this class.
class that provide information about a section.
Definition * definition() const
QCString fileName() const
static SectionManager & instance()
returns a reference to the singleton
Text streaming class that buffers data.
std::string str() const
Return the contents of the buffer as a std::string object.
Class managing a pool of worker threads.
auto queue(F &&f, Args &&... args) -> std::future< decltype(f(args...))>
Queue the callable function f for the threads to execute.
ClassDef * toClassDef(Definition *d)
#define Config_getInt(name)
#define Config_getBool(name)
#define Config_getString(name)
std::vector< int > IntVector
static constexpr auto hex
IDocParserPtr createDocParser()
factory function to create a parser
IDocNodeASTPtr validatingParseDoc(IDocParser &parserIntf, const QCString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const QCString &input, bool indexWords, bool isExample, const QCString &exampleName, bool singleLine, bool linkFromIndex, bool markdownSupport)
GroupDef * toGroupDef(Definition *d)
Translator * theTranslator
MemberDef * toMemberDef(Definition *d)
std::ofstream openOutputStream(const QCString &name, bool append=false)
NamespaceDef * toNamespaceDef(Definition *d)
PageDef * toPageDef(Definition *d)
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
static void addMemberToSearchIndex(const MemberDef *md)
#define SEARCH_INDEX_TYPEDEFS
#define SEARCH_INDEX_STRUCTS
static void splitSearchTokens(QCString &title, IntVector &indices)
#define SEARCH_INDEX_NAMESPACES
void createJavaScriptSearchIndex()
#define SEARCH_INDEX_CONCEPTS
#define SEARCH_INDEX_EVENTS
static std::array< SearchIndexInfo, NUM_SEARCH_INDICES > g_searchIndexInfo
#define SEARCH_INDEX_DEFINES
#define SEARCH_INDEX_ENUMS
static QCString convertTitleToHtml(const Definition *scope, const QCString &fileName, int lineNr, const QCString &title)
#define SEARCH_INDEX_FILES
#define SEARCH_INDEX_DICTIONARIES
#define SEARCH_INDEX_PAGES
static void writeJavasScriptSearchDataPage(const QCString &baseName, const QCString &dataFileName, const SearchIndexList &list)
static void writeJavascriptSearchData(const QCString &searchDirName)
#define SEARCH_INDEX_GROUPS
#define SEARCH_INDEX_INTERFACES
const std::array< SearchIndexInfo, NUM_SEARCH_INDICES > & getSearchIndices()
#define SEARCH_INDEX_SEQUENCES
#define SEARCH_INDEX_PROPERTIES
#define SEARCH_INDEX_ENUMVALUES
#define SEARCH_INDEX_FUNCTIONS
#define SEARCH_INDEX_VARIABLES
#define SEARCH_INDEX_MODULES
#define SEARCH_INDEX_CLASSES
static std::unordered_map< std::string, QCString > g_titleCache
#define SEARCH_INDEX_RELATED
void writeJavaScriptSearchIndex()
#define SEARCH_INDEX_EXCEPTIONS
static std::mutex g_titleCacheMutex
Javascript based search engine.
std::vector< SearchTerm > SearchIndexList
List of search terms.
void add(const SearchTerm &term)
QCString title
title to show in the output for this search result
std::variant< std::monostate, const Definition *, const SectionInfo * > LinkInfo
QCString word
lower case word that is indexed (e.g. name of a symbol, or word from a title)
LinkInfo info
definition to link to
QCString termEncoded() const
encoded version of the search term
std::string convertUTF8ToLower(const std::string &input)
Converts the input string into a lower case version, also taking into account non-ASCII characters th...
std::string getUTF8CharAt(const std::string &input, size_t pos)
Returns the UTF8 character found at byte position pos in the input string.
QCString externalRef(const QCString &relPath, const QCString &ref, bool href)
QCString filterTitle(const QCString &title)
QCString convertToXML(const QCString &s, bool keepEntities)
QCString getLanguageSpecificSeparator(SrcLangExt lang, bool classScope)
Returns the scope separator to use given the programming language lang.
void addHtmlExtensionIfMissing(QCString &fName)
A bunch of utility functions.