58 m_urls.setAutoDelete(TRUE);
73 if (hiPriority) ui->
freq|=1;
79 m_words(328829), m_index(
numIndexEntries), m_url2IdMap(10007), m_urls(10007), m_urlIndex(-1)
84 m_urls.setAutoDelete(TRUE);
94 QCString url=isSourceFile ? ((
FileDef*)ctx)->getSourceFileBase() : ctx->getOutputFileBase();
96 QCString baseUrl = url;
97 if (anchor) url+=QCString(
"#")+anchor;
98 if (!isSourceFile) baseUrl=url;
99 QCString name=ctx->qualifiedName();
115 switch (ctx->definitionType())
120 if (!pd->
title().isEmpty())
179 m_urls.insert(*pIndex,
new URL(name,url));
185 if (word==0)
return -1;
198 uint c1=((uchar *)word)[0];
199 if (c1==0)
return -1;
200 uint c2=((uchar *)word)[1];
201 if (c2==0)
return -1;
207 static QRegExp nextPart(
"[_a-z:][A-Z]");
208 if (word==0 || word[0]==
'\0')
return;
209 QCString wStr = QCString(word).lower();
229 addWord(word+i,hiPriority,TRUE);
235 if ((i=nextPart.match(word))>=1)
237 addWord(word+i+1,hiPriority,TRUE);
244 addWord(word,hiPriority,FALSE);
249 f.putch(((uint)index)>>24);
250 f.putch((((uint)index)>>16)&0xff);
251 f.putch((((uint)index)>>8)&0xff);
252 f.putch(((uint)index)&0xff);
258 while (*p) f.putch(*p++);
267 int wordsOffset = size;
271 QList<IndexWord> *wlist =
m_index[i];
272 if (!wlist->isEmpty())
274 QListIterator<IndexWord> iwi(*wlist);
276 for (iwi.toFirst();(iw=iwi.current());++iwi)
278 int ws = iw->
word().length()+1;
287 int offset=wordsOffset;
290 QList<IndexWord> *wlist =
m_index[i];
291 if (!wlist->isEmpty())
293 indexOffsets[i]=offset;
294 QListIterator<IndexWord> iwi(*wlist);
296 for (iwi.toFirst();(iw=iwi.current());++iwi)
298 offset+= iw->
word().length()+1;
310 padding = size - padding;
314 int *wordStatOffsets =
new int[
m_words.count()];
321 QList<IndexWord> *wlist =
m_index[i];
322 if (!wlist->isEmpty())
324 QListIterator<IndexWord> iwi(*wlist);
326 for (iwi.toFirst();(iw=iwi.current());++iwi)
329 wordStatOffsets[count++] = size;
330 size+=4+iw->
urls().count()*8;
334 int *urlOffsets =
new int[
m_urls.count()];
336 QIntDictIterator<URL> udi(
m_urls);
338 for (udi.toFirst();(url=udi.current());++udi)
340 urlOffsets[udi.currentKey()]=size;
341 size+=url->
name.length()+1+
346 if (f.open(IO_WriteOnly))
349 f.putch(
'D'); f.putch(
'O'); f.putch(
'X'); f.putch(
'S');
359 QList<IndexWord> *wlist =
m_index[i];
360 if (!wlist->isEmpty())
362 QListIterator<IndexWord> iwi(*wlist);
364 for (iwi.toFirst();(iw=iwi.current());++iwi)
367 writeInt(f,wordStatOffsets[count++]);
373 for (i=0;i<padding;i++) f.putch(0);
377 QList<IndexWord> *wlist =
m_index[i];
378 if (!wlist->isEmpty())
380 QListIterator<IndexWord> iwi(*wlist);
382 for (iwi.toFirst();(iw=iwi.current());++iwi)
384 int numUrls = iw->
urls().count();
386 QIntDictIterator<URLInfo> uli(iw->
urls());
388 for (uli.toFirst();(ui=uli.current());++uli)
397 QIntDictIterator<URL> udi(
m_urls);
399 for (udi.toFirst();(url=udi.current());++udi)
407 delete[] wordStatOffsets;
480 return ((
ClassDef*)ctx)->compoundTypeString();
503 QCString baseName = isSourceFile ? ((
FileDef*)ctx)->getSourceFileBase() : ctx->getOutputFileBase();
505 if (anchor) url+=QCString(
"#")+anchor;
506 QCString key = extId+
";"+url;
514 e->
name = ctx->qualifiedName();
539 if (f.open(IO_WriteOnly))
542 t <<
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" <<
endl;
543 t <<
"<add>" <<
endl;
546 for (it.toFirst();(doc=it.current());++it)
550 t <<
" <doc>" <<
endl;
551 t <<
" <field name=\"type\">" << doc->
type <<
"</field>" <<
endl;
553 if (!doc->
args.isEmpty())
557 if (!doc->
extId.isEmpty())
564 t <<
" </doc>" <<
endl;
566 t <<
"</add>" <<
endl;
570 err(
"Failed to open file %s for writing!\n",fileName);
590 static bool hideFriendCompounds =
Config_getBool(HIDE_FRIEND_COMPOUNDS);
603 QCString n = md->
name();
607 bool isFriendToHide = hideFriendCompounds &&
608 (QCString(md->
typeString())==
"friend class" ||
609 QCString(md->
typeString())==
"friend struct" ||
611 if (!(md->
isFriend() && isFriendToHide))
644 (md->
isFriend() && !isFriendToHide))
650 else if (isLinkable &&
656 QCString n = md->
name();
697 for (i=0;i<s.length();i++)
706 result+=(char)tolower(c);
711 sprintf(val,
"_%02x",(uchar)c);
759 for (;(cd=cli.current());++cli)
772 for (;(nd=nli.current());++nli)
785 for (;(fn=fnli.current());++fnli)
789 for (;(fd=fni.current());++fni)
805 for (mnli.toFirst();(mn=mnli.current());++mnli)
810 for (mni.toFirst();(md=mni.current());++mni)
822 for (fnli.toFirst();(mn=fnli.current());++fnli)
827 for (mni.toFirst();(md=mni.current());++mni)
837 for (gli.toFirst();(gd=gli.current());++gli)
842 if (!title.isEmpty())
844 uchar charCode = title.at(0);
845 uint letter = charCode<128 ? tolower(charCode) : charCode;
858 for (pdi.toFirst();(pd=pdi.current());++pdi)
862 QCString title = pd->
title();
863 if (!title.isEmpty())
865 uchar charCode = title.at(0);
866 uint letter = charCode<128 ? tolower(charCode) : charCode;
878 if (!title.isEmpty())
880 uchar charCode = title.at(0);
881 uint letter = charCode<128 ? tolower(charCode) : charCode;
896 for (it.toFirst();(sl=it.current());++it)
914 for (it.toFirst();(sl=it.current());++it,++p)
917 baseName.sprintf(
"%s_%x",g_searchIndexInfo[i].name.data(),p);
919 QCString fileName = searchDirName +
"/"+baseName+
".html";
920 QCString dataFileName = searchDirName +
"/"+baseName+
".js";
922 QFile outFile(fileName);
923 QFile dataOutFile(dataFileName);
924 if (outFile.open(IO_WriteOnly) && dataOutFile.open(IO_WriteOnly))
929 t <<
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\""
930 " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" <<
endl;
931 t <<
"<html><head><title></title>" <<
endl;
932 t <<
"<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>" <<
endl;
933 t <<
"<meta name=\"generator\" content=\"Doxygen " <<
versionString <<
"\"/>" <<
endl;
934 t <<
"<link rel=\"stylesheet\" type=\"text/css\" href=\"search.css\"/>" <<
endl;
935 t <<
"<script type=\"text/javascript\" src=\"" << baseName <<
".js\"></script>" <<
endl;
936 t <<
"<script type=\"text/javascript\" src=\"search.js\"></script>" <<
endl;
937 t <<
"</head>" <<
endl;
938 t <<
"<body class=\"SRPage\">" <<
endl;
939 t <<
"<div id=\"SRIndex\">" <<
endl;
941 t <<
"<div id=\"SRResults\"></div>" <<
endl;
942 t <<
"<script type=\"text/javascript\"><!--" <<
endl;
943 t <<
"createResults();" <<
endl;
944 t <<
"--></script>" <<
endl;
945 t <<
"<div class=\"SRStatus\" id=\"Searching\">"
947 t <<
"<div class=\"SRStatus\" id=\"NoMatches\">"
950 t <<
"<script type=\"text/javascript\"><!--" <<
endl;
951 t <<
"document.getElementById(\"Loading\").style.display=\"none\";" <<
endl;
952 t <<
"document.getElementById(\"NoMatches\").style.display=\"none\";" <<
endl;
953 t <<
"var searchResults = new SearchResults(\"searchResults\");" <<
endl;
954 t <<
"searchResults.Search();" <<
endl;
955 t <<
"--></script>" <<
endl;
956 t <<
"</div>" <<
endl;
957 t <<
"</body>" <<
endl;
958 t <<
"</html>" <<
endl;
962 ti <<
"var searchData=" <<
endl;
974 bool firstEntry=TRUE;
979 for (li.toFirst();(dl=li.current());++li)
996 QCString anchor = d->
anchor();
1000 if (!anchor.isEmpty())
1002 ti <<
"#" << anchor;
1006 static bool extLinksInWindow =
Config_getBool(EXT_LINKS_IN_WINDOW);
1037 QListIterator<Definition> di(*dl);
1038 bool overloadedFunction = FALSE;
1041 for (di.toFirst();(d=di.current());)
1051 QCString anchor = d->
anchor();
1059 if (!anchor.isEmpty())
1061 ti <<
"#" << anchor;
1065 static bool extLinksInWindow =
Config_getBool(EXT_LINKS_IN_WINDOW);
1075 overloadedFunction = ((prevScope!=0 && scope==prevScope) ||
1076 (scope && scope==nextScope)
1081 if (overloadedFunction)
1109 if (!prefix.isEmpty()) prefix+=
": ";
1133 ti <<
"'" << name <<
"'";
1154 err(
"Failed to open file '%s' for writing...\n",fileName.data());
1160 QFile f(searchDirName+
"/searchdata.js");
1161 if (f.open(IO_WriteOnly))
1164 t <<
"var indexSectionsWithContent =" <<
endl;
1170 if (g_searchIndexInfo[i].symbolList.count()>0)
1172 if (!first) t <<
"," <<
endl;
1173 t <<
" " << j <<
": \"";
1177 for (it.toFirst();(sl=it.current());++it)
1179 t << QString( QChar( sl->
letter() ) ).utf8();
1186 if (!first) t <<
"\n";
1187 t <<
"};" << endl <<
endl;
1188 t <<
"var indexSectionNames =" <<
endl;
1194 if (g_searchIndexInfo[i].symbolList.count()>0)
1196 if (!first) t <<
"," <<
endl;
1197 t <<
" " << j <<
": \"" << g_searchIndexInfo[i].
name <<
"\"";
1202 if (!first) t <<
"\n";
1203 t <<
"};" << endl <<
endl;
1204 t <<
"var indexSectionLabels =" <<
endl;
1210 if (g_searchIndexInfo[i].symbolList.count()>0)
1212 if (!first) t <<
"," <<
endl;
1213 t <<
" " << j <<
": \"" <<
convertToXML(g_searchIndexInfo[i].text) <<
"\"";
1218 if (!first) t <<
"\n";
1219 t <<
"};" << endl <<
endl;
1224 QFile f(searchDirName+
"/nomatches.html");
1225 if (f.open(IO_WriteOnly))
1228 t <<
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" "
1229 "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" <<
endl;
1230 t <<
"<html><head><title></title>" <<
endl;
1231 t <<
"<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>" <<
endl;
1232 t <<
"<link rel=\"stylesheet\" type=\"text/css\" href=\"search.css\"/>" <<
endl;
1233 t <<
"<script type=\"text/javascript\" src=\"search.js\"></script>" <<
endl;
1234 t <<
"</head>" <<
endl;
1235 t <<
"<body class=\"SRPage\">" <<
endl;
1236 t <<
"<div id=\"SRIndex\">" <<
endl;
1237 t <<
"<div class=\"SRStatus\" id=\"NoMatches\">"
1239 t <<
"</div>" <<
endl;
1240 t <<
"</body>" <<
endl;
1241 t <<
"</html>" <<
endl;
1272 dispName = ((
GroupDef*)d)->groupTitle();
1276 dispName = ((
PageDef*)d)->title();
1291 QCString n1 = md1->getFirst()->localName();
1292 QCString n2 = md2->getFirst()->localName();
1293 return qstricmp(n1.data(),n2.data());
1301 static bool serverBasedSearch =
Config_getBool(SERVER_BASED_SEARCH);
1303 if (searchEngine && serverBasedSearch)