45 if (std::holds_alternative<const Definition *>(
info))
53 else if (std::holds_alternative<const SectionInfo *>(
info))
55 title = std::get<const SectionInfo *>(
info)->title();
66 for (
size_t i=0;i<
word.length();i++)
74 static const char *
hex =
"0123456789ABCDEF";
75 unsigned char uc =
static_cast<unsigned char>(
word.at(i));
95 bool lastIsSpace=
true;
96 for (
size_t si=0; si<title.
length(); si++)
98 char c = title.
at(si);
99 if (
isId(c) || c==
':')
105 else if (!lastIsSpace)
112 if (di>0 && title.
at(di-1)==
' ') di--;
118 while ((i=title.
find(
' ',p))!=-1)
121 indices.push_back(p);
124 if (p<
static_cast<int>(title.
length()))
127 indices.push_back(p);
133#define SEARCH_INDEX_ALL 0
134#define SEARCH_INDEX_CLASSES 1
135#define SEARCH_INDEX_INTERFACES 2
136#define SEARCH_INDEX_STRUCTS 3
137#define SEARCH_INDEX_EXCEPTIONS 4
138#define SEARCH_INDEX_NAMESPACES 5
139#define SEARCH_INDEX_FILES 6
140#define SEARCH_INDEX_FUNCTIONS 7
141#define SEARCH_INDEX_VARIABLES 8
142#define SEARCH_INDEX_TYPEDEFS 9
143#define SEARCH_INDEX_SEQUENCES 10
144#define SEARCH_INDEX_DICTIONARIES 11
145#define SEARCH_INDEX_ENUMS 12
146#define SEARCH_INDEX_ENUMVALUES 13
147#define SEARCH_INDEX_PROPERTIES 14
148#define SEARCH_INDEX_EVENTS 15
149#define SEARCH_INDEX_RELATED 16
150#define SEARCH_INDEX_DEFINES 17
151#define SEARCH_INDEX_GROUPS 18
152#define SEARCH_INDEX_PAGES 19
153#define SEARCH_INDEX_CONCEPTS 20
154#define SEARCH_INDEX_MODULES 21
160 {
"classes" , []() {
return theTranslator->trClasses(); }, {} },
161 {
"interfaces" , []() {
return theTranslator->trSliceInterfaces(); }, {} },
162 {
"structs" , []() {
return theTranslator->trStructs(); }, {} },
163 {
"exceptions" , []() {
return theTranslator->trExceptions(); }, {} },
164 {
"namespaces" , []() {
return Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
168 {
"functions" , []() {
return Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
171 {
"variables" , []() {
return Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
174 {
"typedefs" , []() {
return theTranslator->trTypedefs(); }, {} },
175 {
"sequences" , []() {
return theTranslator->trSequences(); }, {} },
176 {
"dictionaries", []() {
return theTranslator->trDictionaries(); }, {} },
177 {
"enums" , []() {
return theTranslator->trEnumerations(); }, {} },
178 {
"enumvalues" , []() {
return theTranslator->trEnumerationValues(); }, {} },
179 {
"properties" , []() {
return theTranslator->trProperties(); }, {} },
180 {
"events" , []() {
return theTranslator->trEvents(); }, {} },
181 {
"related" , []() {
return theTranslator->trFriends(); }, {} },
182 {
"defines" , []() {
return theTranslator->trDefines(); }, {} },
185 {
"concepts" , []() {
return theTranslator->trConcept(
true,
false); }, {} },
186 {
"modules" , []() {
return theTranslator->trModule(
true,
false); }, {} }
207 bool isFriendToHide = hideFriendCompounds &&
211 if (!(md->
isFriend() && isFriendToHide))
252 (md->
isFriend() && !isFriendToHide))
258 else if (isLinkable &&
312 if (cd->isLinkable())
345 if (nd->isLinkable())
356 if (cd->isLinkable())
367 if (mod->isLinkable() && mod->isPrimaryInterface())
378 for (
const auto &fd : *fn)
381 if (fd->isLinkable())
395 for (
const auto &md : *mn)
408 for (
const auto &md : *mn)
418 if (gd->isLinkable())
423 for (
int index : tokenIndices)
434 if (pd->isLinkable())
439 for (
int index : tokenIndices)
453 for (
int index : tokenIndices)
462 for (
const auto §ionInfo : sm)
464 if (sectionInfo->level()>0)
469 for (
int index : tokenIndices)
479 for (
auto &[name,symList] : sii.symbolMap)
486 std::stable_sort(symList.begin(),
488 [](
const auto &t1,
const auto &t2)
490 int eq = qstricmp_sort(t1.word,t2.word);
491 return eq==0 ? qstricmp_sort(t1.title,t2.title)<0 : eq<0;
502 t <<
"var indexSectionsWithContent =\n";
507 if (!sii.symbolMap.empty())
510 t <<
" " << j <<
": \"";
512 std::string previous_letter;
513 for (
const auto &[letter,list] : sii.symbolMap)
515 if (letter != previous_letter)
517 if ( letter ==
"\"" ) t <<
"\\";
519 previous_letter = letter;
528 t <<
"var indexSectionNames =\n";
533 if (!sii.symbolMap.empty())
536 t <<
" " << j <<
": \"" << sii.name <<
"\"";
542 t <<
"var indexSectionLabels =\n";
547 if (!sii.symbolMap.empty())
550 t <<
" " << j <<
": \"" <<
convertToXML(sii.getText()) <<
"\"";
563 return std::holds_alternative<const Definition *>(info);
567 return isDef(info) ? std::get<const Definition *>(info) :
nullptr;
571 return std::holds_alternative<const SectionInfo *>(info);
575 return isSection(info) ? std::get<const SectionInfo *>(info) :
nullptr;
582 err(
"Failed to open file '%s' for writing...\n",
qPrint(dataFileName));
586 ti <<
"var searchData=\n";
599 bool firstEntry=
TRUE;
604 for (
auto it = list.begin(); it!=list.end();)
628 ti <<
" ['" <<
id <<
"_" << cnt++ <<
"',['";
657 if (!extLinksInWindow || ref.
isEmpty())
689 bool overloadedFunction = ((prevScope!=
nullptr && scope==prevScope) || (scope && scope==nextScope)) &&
693 if (overloadedFunction)
752 ti <<
"'" << name <<
"'";
773 std::size_t numThreads =
static_cast<std::size_t
>(
Config_getInt(NUM_PROC_THREADS));
777 std::vector< std::future<int> > results;
781 for (
const auto &[letter,symList] : sii.symbolMap)
784 baseName.
sprintf(
"%s_%x",sii.name.data(),p);
785 QCString dataFileName = searchDirName +
"/"+baseName+
".js";
786 auto &list = symList;
787 auto processFile = [p,baseName,dataFileName,&list]()
792 results.emplace_back(threadPool.
queue(processFile));
797 for (
auto &f : results) f.get();
804 for (
const auto &[letter,symList] : sii.symbolMap)
807 baseName.
sprintf(
"%s_%x",sii.name.data(),p);
808 QCString dataFileName = searchDirName +
"/"+baseName+
".js";
836 list.push_back(
term);
A abstract class representing of a compound symbol.
virtual const ClassDef * templateMaster() const =0
Returns the template master of which this class is an instance.
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 bool isLinkable() 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
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.
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.
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.
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
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
const char * qPrint(const char *s)
static void addMemberToSearchIndex(const MemberDef *md)
#define SEARCH_INDEX_TYPEDEFS
#define SEARCH_INDEX_STRUCTS
static void splitSearchTokens(QCString &title, IntVector &indices)
helper function to simplify the given title string, and fill a list of start positions for the start ...
#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
#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
#define SEARCH_INDEX_RELATED
void writeJavaScriptSearchIndex()
#define SEARCH_INDEX_EXCEPTIONS
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
SrcLangExt
Language as given by extension.
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.