浏览该文件的文档.
68 auto it =
m_urls.find(idx);
75 if (hiPriority) it->second.freq|=1;
94 if (!isSourceFile) baseUrl=url;
175 m_urls.insert(std::make_pair(it->second,
URL(name,url)));
181 if (word.
length()<2)
return -1;
205 if (idx<0 || idx>=
static_cast<int>(
m_index.size()))
return;
211 it =
m_words.insert({ wStr.
str(),
static_cast<int>(
m_index[idx].size())-1 }).first;
229 !((word[i]==
'_' || word[i]==
':' || (word[i]>=
'a' && word[i]<=
'z')) &&
230 (word[i+1]>=
'A' && word[i+1]<=
'Z')))
234 if (word[i]!=0 && i>=1)
248 f.put(
static_cast<int>(index>>24));
249 f.put(
static_cast<int>((index>>16)&0xff));
250 f.put(
static_cast<int>((index>>8)&0xff));
251 f.put(
static_cast<int>(index&0xff));
257 for (
uint i=0;i<l;i++) f.put(s[i]);
266 size_t wordsOffset = size;
270 const auto &wlist =
m_index[i];
273 for (
const auto &iw : wlist)
275 int ws = iw.word().length()+1;
284 size_t offset=wordsOffset;
287 const auto &wlist =
m_index[i];
290 indexOffsets[i]=offset;
291 for (
const auto &iw : wlist)
293 offset+= iw.word().length()+1;
303 size_t padding = size;
305 padding = size - padding;
307 std::vector<size_t> wordStatOffsets(
m_words.size());
314 const auto &wlist =
m_index[i];
317 for (
const auto &iw : wlist)
320 wordStatOffsets[count++] = size;
321 size+=4 + iw.urls().size() * 8;
325 std::vector<size_t> urlOffsets(
m_urls.size());
326 for (
const auto &udi :
m_urls)
328 urlOffsets[udi.first]=size;
329 size+=udi.second.name.length()+1+
330 udi.second.url.length()+1;
334 std::ofstream f(fileName.
str(),std::ofstream::out | std::ofstream::binary);
338 f.put(
'D'); f.put(
'O'); f.put(
'X'); f.put(
'S');
348 const auto &wlist =
m_index[i];
351 for (
const auto &iw : wlist)
354 writeInt(f,wordStatOffsets[count++]);
360 for (i=0;i<padding;i++) f.put(0);
364 const auto &wlist =
m_index[i];
367 for (
const auto &iw : wlist)
369 size_t numUrls = iw.urls().size();
371 for (
const auto &ui : iw.urls())
373 writeInt(f,urlOffsets[ui.second.urlIdx]);
380 for (
const auto &udi :
m_urls)
449 return (
toClassDef(ctx))->compoundTypeString();
479 auto it =
p->docEntries.find(key.
str());
480 if (it ==
p->docEntries.end())
491 it =
p->docEntries.insert({key.
str(),e}).first;
494 p->current = &it->second;
499 if (word.
isEmpty() || !
isId(word[0]) ||
p->current==0)
return;
500 GrowBuf *pText = hiPriority ? &
p->current->importantText : &
p->current->normalText;
508 std::ofstream t(fileName.
str(),std::ofstream::out | std::ofstream::binary);
511 t <<
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
513 for (
auto &kv :
p->docEntries)
519 t <<
" <field name=\"type\">" << doc.
type <<
"</field>\n";
538 err(
"Failed to open file %s for writing!\n",
qPrint(fileName));
557 for (
size_t i=0;i<s.length();i++)
565 static const char *
hex =
"0123456789ABCDEF";
566 unsigned char uc =
static_cast<unsigned char>(s[i]);
577 #define SEARCH_INDEX_ALL 0
578 #define SEARCH_INDEX_CLASSES 1
579 #define SEARCH_INDEX_INTERFACES 2
580 #define SEARCH_INDEX_STRUCTS 3
581 #define SEARCH_INDEX_EXCEPTIONS 4
582 #define SEARCH_INDEX_NAMESPACES 5
583 #define SEARCH_INDEX_FILES 6
584 #define SEARCH_INDEX_FUNCTIONS 7
585 #define SEARCH_INDEX_VARIABLES 8
586 #define SEARCH_INDEX_TYPEDEFS 9
587 #define SEARCH_INDEX_SEQUENCES 10
588 #define SEARCH_INDEX_DICTIONARIES 11
589 #define SEARCH_INDEX_ENUMS 12
590 #define SEARCH_INDEX_ENUMVALUES 13
591 #define SEARCH_INDEX_PROPERTIES 14
592 #define SEARCH_INDEX_EVENTS 15
593 #define SEARCH_INDEX_RELATED 16
594 #define SEARCH_INDEX_DEFINES 17
595 #define SEARCH_INDEX_GROUPS 18
596 #define SEARCH_INDEX_PAGES 19
597 #define SEARCH_INDEX_CONCEPTS 20
607 {
"namespaces" , []() {
return Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
611 {
"functions" , []() {
return Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
614 {
"variables" , []() {
return Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
633 static bool hideFriendCompounds =
Config_getBool(HIDE_FRIEND_COMPOUNDS);
646 std::string n = md->
name().
str();
650 bool isFriendToHide = hideFriendCompounds &&
654 if (!(md->
isFriend() && isFriendToHide))
695 (md->
isFriend() && !isFriendToHide))
701 else if (isLinkable &&
707 std::string n = md->
name().
str();
757 if (cd->isLinkable())
790 if (nd->isLinkable())
801 if (cd->isLinkable())
811 for (
const auto &fd : *fn)
814 if (fd->isLinkable())
828 for (
const auto &md : *mn)
841 for (
const auto &md : *mn)
851 if (gd->isLinkable())
853 std::string title = gd->groupTitle().str();
866 if (pd->isLinkable())
868 std::string title = pd->title().str();
891 for (
auto &kv : sii.symbolMap)
894 std::sort(kv.second.begin(),
898 int eq = qstricmp(searchName(d1),searchName(d2));
899 return eq==0 ? qstricmp(d1->name(),d2->name())<0 : eq<0;
913 for (
const auto &kv : sii.symbolMap)
917 baseName.
sprintf(
"%s_%x",sii.name.data(),p);
920 QCString dataFileName = searchDirName +
"/"+baseName+
".js";
922 std::ofstream t(fileName.
str(), std::ofstream::out | std::ofstream::binary);
923 std::ofstream ti(dataFileName.
str(), std::ofstream::out | std::ofstream::binary);
924 if (t.is_open() && ti.is_open())
927 t <<
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\""
928 " \"https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
929 t <<
"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
930 t <<
"<head><title></title>\n";
931 t <<
"<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>\n";
932 t <<
"<meta name=\"generator\" content=\"Doxygen " << getDoxygenVersion() <<
"\"/>\n";
933 t <<
"<link rel=\"stylesheet\" type=\"text/css\" href=\"search.css\"/>\n";
934 t <<
"<script type=\"text/javascript\" src=\"" << baseName <<
".js\"></script>\n";
935 t <<
"<script type=\"text/javascript\" src=\"search.js\"></script>\n";
937 t <<
"<body class=\"SRPage\">\n";
938 t <<
"<div id=\"SRIndex\">\n";
940 t <<
"<div id=\"SRResults\"></div>\n";
941 t <<
"<script type=\"text/javascript\">\n";
942 t <<
"/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */\n";
943 t <<
"createResults();\n";
944 t <<
"/* @license-end */\n";
946 t <<
"<div class=\"SRStatus\" id=\"Searching\">"
948 t <<
"<div class=\"SRStatus\" id=\"NoMatches\">"
951 t <<
"<script type=\"text/javascript\">\n";
952 t <<
"/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */\n";
953 t <<
"document.getElementById(\"Loading\").style.display=\"none\";\n";
954 t <<
"document.getElementById(\"NoMatches\").style.display=\"none\";\n";
955 t <<
"var searchResults = new SearchResults(\"searchResults\");\n";
956 t <<
"searchResults.Search();\n";
957 t <<
"window.addEventListener(\"message\", function(event) {\n";
958 t <<
" if (event.data == \"take_focus\") {\n";
959 t <<
" var elem = searchResults.NavNext(0);\n";
960 t <<
" if (elem) elem.focus();\n";
963 t <<
"/* @license-end */\n";
970 ti <<
"var searchData=\n";
982 bool firstEntry=
TRUE;
987 for (
auto it = kv.second.begin(); it!=kv.second.end();)
1002 ti <<
" ['" <<
id <<
"_" << cnt++ <<
"',['" <<
convertToXML(sname) <<
"',[";
1009 const Definition *next = it!=kv.second.end() ? *it : 0;
1023 ti <<
"#" << anchor;
1027 static bool extLinksInWindow =
Config_getBool(EXT_LINKS_IN_WINDOW);
1037 if (lastName!=sname && (next==0 ||
searchName(next)!=sname))
1060 bool overloadedFunction = ((prevScope!=0 && scope==prevScope) ||
1064 if (overloadedFunction)
1092 if (!prefix.
isEmpty()) prefix+=
": ";
1116 ti <<
"'" << name <<
"'";
1131 err(
"Failed to open file '%s' for writing...\n",
qPrint(fileName));
1138 std::ofstream t(searchDirName.
str()+
"/searchdata.js",
1139 std::ofstream::out | std::ofstream::binary);
1142 t <<
"var indexSectionsWithContent =\n";
1147 if (!sii.symbolMap.empty())
1149 if (j>0) t <<
",\n";
1150 t <<
" " << j <<
": \"";
1152 for (
const auto &kv : sii.symbolMap)
1154 if ( kv.first ==
"\"" ) t <<
"\\";
1163 t <<
"var indexSectionNames =\n";
1168 if (!sii.symbolMap.empty())
1170 if (j>0) t <<
",\n";
1171 t <<
" " << j <<
": \"" << sii.name <<
"\"";
1177 t <<
"var indexSectionLabels =\n";
1182 if (!sii.symbolMap.empty())
1184 if (j>0) t <<
",\n";
1185 t <<
" " << j <<
": \"" <<
convertToXML(sii.getText()) <<
"\"";
1197 std::ofstream t(noMatchesFileName.
str(), std::ofstream::out | std::ofstream::binary);
1200 t <<
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" "
1201 "\"https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
1202 t <<
"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
1203 t <<
"<head><title></title>\n";
1204 t <<
"<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>\n";
1205 t <<
"<link rel=\"stylesheet\" type=\"text/css\" href=\"search.css\"/>\n";
1206 t <<
"<script type=\"text/javascript\" src=\"search.js\"></script>\n";
1208 t <<
"<body class=\"SRPage\">\n";
1209 t <<
"<div id=\"SRIndex\">\n";
1210 t <<
"<div class=\"SRStatus\" id=\"NoMatches\">"
1227 it->second.push_back(def);
1231 symbolMap.insert(std::make_pair(letter,std::vector<const Definition*>({def})));
1245 static bool serverBasedSearch =
Config_getBool(SERVER_BASED_SEARCH);
1247 if (searchEngine && serverBasedSearch)
virtual QCString trSubprogram(bool first_capital, bool singular)=0
#define SEARCH_INDEX_EVENTS
bool copyResource(const QCString &name, const QCString &targetDir) const
Copies a registered resource to a given target directory
const size_t numIndexEntries
virtual QCString trConstants()=0
virtual bool isTypedef() const =0
static ResourceMgr & instance()
Returns the one and only instance of this class
#define SEARCH_INDEX_RELATED
GroupDef * toGroupDef(Definition *d)
static std::unique_ptr< PageDef > mainPage
virtual QCString argsString() const =0
std::string convertUTF8ToLower(const std::string &input)
Converts the input string into a lower case version, also taking into account non-ASCII characters th...
The common base class of all entity definitions found in the sources.
virtual bool isSignal() const =0
#define SEARCH_INDEX_FUNCTIONS
An abstract interface of a namespace symbol.
std::unique_ptr< Private > p
void setCurrentDoc(const Definition *ctx, const QCString &anchor, bool isSourceFile) override
#define SEARCH_INDEX_NAMESPACES
void writeJavaScriptSearchIndex()
uint length() const
Returns the length of the string, not counting the 0-terminator.
void addUrlIndex(int, bool)
#define SEARCH_INDEX_CLASSES
static ConceptLinkedMap * conceptLinkedMap
virtual QCString compoundTypeString() const =0
Returns the type of compound as a string
virtual QCString trSequences()=0
#define SEARCH_INDEX_ENUMS
virtual QCString trExceptions()=0
bool isEmpty() const
Returns TRUE iff the string is empty
std::map< int, URL > m_urls
virtual QCString trPackage(const QCString &name)=0
virtual QCString trModules()=0
std::map< std::string, SearchDocEntry > docEntries
static PageLinkedMap * pageLinkedMap
static IndexList * indexList
virtual QCString groupTitle() const =0
#define SEARCH_INDEX_INTERFACES
void addStyleSheetFile(const QCString &name)
virtual QCString trGlobalNamespace()=0
MemberDef * toMemberDef(Definition *d)
void write(const QCString &file) override
static void writeInt(std::ostream &f, size_t index)
SrcLangExt
Language as given by extension
virtual QCString trOperations()=0
static NamespaceDefMutable * globalScope
void write(const QCString &file)
#define SEARCH_INDEX_DICTIONARIES
static int charsToIndex(const QCString &word)
#define SEARCH_INDEX_TYPEDEFS
const std::array< SearchIndexInfo, NUM_SEARCH_INDICES > & getSearchIndices()
#define SEARCH_INDEX_GROUPS
virtual QCString trEnumerationValues()=0
virtual QCString trEvents()=0
virtual QCString trEnumerations()=0
void err(const char *fmt,...)
virtual bool isLinkable() const =0
Text streaming class that buffers data.
virtual QCString trNoMatches()=0
void addStr(const QCString &s)
virtual bool isDictionary() const =0
virtual bool isProperty() const =0
virtual QCString trConcept(bool first_capital, bool singular)=0
void createJavaScriptSearchIndex()
#define SEARCH_INDEX_PAGES
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
virtual bool isSequence() const =0
Class representing a string buffer optimised for growing.
PageDef * toPageDef(Definition *d)
virtual bool isLinkable() const =0
virtual const ClassDef * templateMaster() const =0
Returns the template master of which this class is an instance.
A model of a page symbol.
A model of a group of symbols.
static FileNameLinkedMap * inputNameLinkedMap
#define SEARCH_INDEX_DEFINES
virtual const FileDef * getBodyDef() const =0
#define SEARCH_INDEX_CONCEPTS
virtual QCString qualifiedName() const =0
QCString addHtmlExtensionIfMissing(const QCString &fName)
A model of a class/file/namespace member symbol.
A abstract class representing of a compound symbol.
virtual bool isFriend() const =0
static MemberNameLinkedMap * functionNameLinkedMap
virtual QCString trVariables()=0
virtual bool isDefine() const =0
virtual bool isVariable() const =0
virtual bool isSlot() const =0
QCString searchName(const Definition *d)
virtual QCString trFriends()=0
Translator * theTranslator
virtual QCString name() const =0
static GroupLinkedMap * groupLinkedMap
virtual MemberDef * resolveAlias()=0
virtual const ClassDef * getClassDef() const =0
std::string getUTF8CharAt(const std::string &input, size_t pos)
Returns the UTF8 character found at byte position pos in the input string.
QCString stripPath(const QCString &s)
QCString getLanguageSpecificSeparator(SrcLangExt lang, bool classScope)
Returns the scope separator to use given the programming language lang
virtual bool isFunction() const =0
#define SEARCH_INDEX_STRUCTS
virtual QCString getOutputFileBase() const =0
virtual const NamespaceDef * getNamespaceDef() const =0
virtual QCString trSearching()=0
virtual bool hasTitle() const =0
std::vector< std::vector< IndexWord > > m_index
std::string str() const
Return the contents of the buffer as a std::string object
ClassDef * toClassDef(Definition *d)
QCString searchId(const Definition *d)
std::unordered_map< std::string, int > m_words
virtual QCString trTypedefs()=0
void setCurrentDoc(const Definition *ctx, const QCString &anchor, bool isSourceFile)
void addWord(const QCString &word, bool hiPriority) override
virtual DefType definitionType() const =0
std::unordered_map< std::string, int > m_url2IdMap
virtual bool isForeign() const =0
virtual QCString trSliceInterfaces()=0
static std::array< SearchIndexInfo, NUM_SEARCH_INDICES > g_searchIndexInfo
void addWord(const QCString &word, bool hiPriority)
int getPrefixIndex(const QCString &name)
static QCString definitionToName(const Definition *ctx)
Various UTF8 related helper functions.
virtual bool isLinkable() const =0
virtual QCString getReference() const =0
virtual QCString trProperties()=0
#define SEARCH_INDEX_ENUMVALUES
virtual QCString trNamespace(bool first_capital, bool singular)=0
static SearchIndexIntf * searchIndex
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
virtual QCString trPage(bool first_capital, bool singular)=0
static MemberNameLinkedMap * memberNameLinkedMap
virtual bool isLinkable() const =0
virtual QCString anchor() const =0
#define SEARCH_INDEX_FILES
#define Config_getBool(name)
NamespaceDef * toNamespaceDef(Definition *d)
virtual QCString trDefines()=0
virtual QCString trFile(bool first_capital, bool singular)=0
static QCString htmlFileExtension
virtual bool isEnumerate() const =0
void finalizeSearchIndexer()
virtual Definition * getOuterScope() const =0
virtual bool isEnumValue() const =0
virtual QCString trAll()=0
#define SEARCH_INDEX_SEQUENCES
#define SEARCH_INDEX_EXCEPTIONS
#define SEARCH_INDEX_PROPERTIES
const char * qPrint(const char *s)
virtual QCString trModule(bool first_capital, bool singular)=0
virtual const FileDef * getFileDef() const =0
#define Config_getString(name)
static void writeString(std::ostream &f, const QCString &s)
static NamespaceLinkedMap * namespaceLinkedMap
virtual QCString trClasses()=0
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string
QCString convertToXML(const QCString &s, bool keepEntities)
A model of a file symbol.
virtual QCString title() const =0
FileDef * toFileDef(Definition *d)
virtual QCString trFunctions()=0
virtual QCString trDictionaries()=0
virtual QCString trMember(bool first_capital, bool singular)=0
virtual QCString trStructs()=0
void add(const std::string &letter, const Definition *def)
QCString externalRef(const QCString &relPath, const QCString &ref, bool href)
static ClassLinkedMap * classLinkedMap
virtual bool isRelated() const =0
A bunch of utility functions.
virtual QCString typeString() const =0
virtual QCString localName() const =0
virtual bool isLinkable() const =0
return TRUE iff a link to this class is possible (either within this project, or as a cross-reference...
#define SEARCH_INDEX_VARIABLES
static void addMemberToSearchIndex(const MemberDef *md)
QCString & prepend(const char *s)
virtual bool isEvent() const =0
QCString & sprintf(const char *format,...)
virtual QCString trLoading()=0
virtual const GroupDef * getGroupDef() const =0
virtual QCString trGroup(bool first_capital, bool singular)=0
This is an alternative implementation of QCString.