Classes | Functions | Variables
searchindex.cpp File Reference
#include <ctype.h>
#include <assert.h>
#include <qfile.h>
#include <qregexp.h>
#include "searchindex.h"
#include "config.h"
#include "util.h"
#include "doxygen.h"
#include "language.h"
#include "pagedef.h"
#include "growbuf.h"
#include "message.h"
#include "version.h"
#include "groupdef.h"
#include "classlist.h"
#include "filedef.h"
#include "memberdef.h"
#include "filename.h"
#include "membername.h"
#include "resourcemgr.h"
#include "namespacedef.h"
#include "classdef.h"

Go to the source code of this file.

Classes

struct  SearchDocEntry
 
struct  SearchIndexExternal::Private
 

Functions

static int charsToIndex (const char *word)
 
static void writeInt (QFile &f, int index)
 
static void writeString (QFile &f, const char *s)
 
static QCString definitionToName (Definition *ctx)
 
static void addMemberToSearchIndex (MemberDef *md)
 
static QCString searchId (const QCString &s)
 
void createJavascriptSearchIndex ()
 
void writeJavascriptSearchIndex ()
 
const SearchIndexInfogetSearchIndices ()
 
void initSearchIndexer ()
 
void finializeSearchIndexer ()
 

Variables

const int numIndexEntries = 256*256
 
static SearchIndexInfo g_searchIndexInfo [NUM_SEARCH_INDICES]
 

Function Documentation

static void addMemberToSearchIndex ( MemberDef md)
static

Definition at line 588 of file searchindex.cpp.

589 {
590  static bool hideFriendCompounds = Config_getBool("HIDE_FRIEND_COMPOUNDS");
591  bool isLinkable = md->isLinkable();
592  ClassDef *cd=0;
593  NamespaceDef *nd=0;
594  FileDef *fd=0;
595  GroupDef *gd=0;
596  if (isLinkable &&
597  (
598  ((cd=md->getClassDef()) && cd->isLinkable() && cd->templateMaster()==0) ||
599  ((gd=md->getGroupDef()) && gd->isLinkable())
600  )
601  )
602  {
603  QCString n = md->name();
604  if (!n.isEmpty())
605  {
606  uint letter = getUtf8CodeToLower(n,0);
607  bool isFriendToHide = hideFriendCompounds &&
608  (QCString(md->typeString())=="friend class" ||
609  QCString(md->typeString())=="friend struct" ||
610  QCString(md->typeString())=="friend union");
611  if (!(md->isFriend() && isFriendToHide))
612  {
614  }
615  if (md->isFunction() || md->isSlot() || md->isSignal())
616  {
618  }
619  else if (md->isVariable())
620  {
622  }
623  else if (md->isTypedef())
624  {
626  }
627  else if (md->isEnumerate())
628  {
630  }
631  else if (md->isEnumValue())
632  {
634  }
635  else if (md->isProperty())
636  {
638  }
639  else if (md->isEvent())
640  {
642  }
643  else if (md->isRelated() || md->isForeign() ||
644  (md->isFriend() && !isFriendToHide))
645  {
647  }
648  }
649  }
650  else if (isLinkable &&
651  (((nd=md->getNamespaceDef()) && nd->isLinkable()) ||
652  ((fd=md->getFileDef()) && fd->isLinkable())
653  )
654  )
655  {
656  QCString n = md->name();
657  if (!n.isEmpty())
658  {
659  uint letter = getUtf8CodeToLower(n,0);
661 
662  if (md->isFunction())
663  {
665  }
666  else if (md->isVariable())
667  {
669  }
670  else if (md->isTypedef())
671  {
673  }
674  else if (md->isEnumerate())
675  {
677  }
678  else if (md->isEnumValue())
679  {
681  }
682  else if (md->isDefine())
683  {
685  }
686  }
687  }
688 }
bool isProperty() const
Definition: memberdef.cpp:4185
bool isLinkable() const
Definition: groupdef.cpp:1645
bool isLinkable() const
Definition: filedef.h:117
bool isEmpty() const
Definition: qcstring.h:189
bool isFriend() const
Definition: memberdef.cpp:4175
#define SEARCH_INDEX_EVENTS
Definition: searchindex.h:125
bool isEvent() const
Definition: memberdef.cpp:4190
#define SEARCH_INDEX_PROPERTIES
Definition: searchindex.h:124
#define SEARCH_INDEX_VARIABLES
Definition: searchindex.h:120
bool isDefine() const
Definition: memberdef.cpp:4170
uint getUtf8CodeToLower(const QCString &s, int idx)
Returns one unicode character as an unsigned integer from utf-8 string, making the character lower ca...
Definition: util.cpp:8276
bool isSignal() const
Definition: memberdef.cpp:4130
bool isSlot() const
Definition: memberdef.cpp:4135
#define SEARCH_INDEX_ALL
Definition: searchindex.h:115
bool isVariable() const
Definition: memberdef.cpp:4140
#define SEARCH_INDEX_RELATED
Definition: searchindex.h:126
FileDef * getFileDef() const
Definition: memberdef.cpp:4075
ClassDef * templateMaster() const
Definition: classdef.cpp:4439
const char * typeString() const
Definition: memberdef.cpp:4035
const QCString & name() const
Definition: definition.h:114
bool isEnumValue() const
Definition: memberdef.cpp:4150
std::void_t< T > n
bool isForeign() const
Definition: memberdef.cpp:4200
bool isLinkable() const
#define SEARCH_INDEX_ENUMS
Definition: searchindex.h:122
static SearchIndexInfo g_searchIndexInfo[NUM_SEARCH_INDICES]
bool isLinkable() const
Definition: classdef.cpp:2729
#define Config_getBool(val)
Definition: config.cpp:664
ClassDef * getClassDef() const
Definition: memberdef.cpp:4070
#define SEARCH_INDEX_TYPEDEFS
Definition: searchindex.h:121
GroupDef * getGroupDef() const
Definition: memberdef.cpp:4095
void append(uint letter, typename T::ElementType *elem)
Definition: util.h:100
#define SEARCH_INDEX_DEFINES
Definition: searchindex.h:127
#define SEARCH_INDEX_FUNCTIONS
Definition: searchindex.h:119
NamespaceDef * getNamespaceDef() const
Definition: memberdef.cpp:4080
bool isFunction() const
Definition: memberdef.cpp:4160
LetterToIndexMap< SearchIndexList > symbolList
Definition: searchindex.h:158
bool isRelated() const
Definition: memberdef.cpp:4195
#define SEARCH_INDEX_ENUMVALUES
Definition: searchindex.h:123
bool isTypedef() const
Definition: memberdef.cpp:4155
unsigned uint
Definition: qglobal.h:351
bool isLinkable() const
Definition: memberdef.cpp:1161
bool isEnumerate() const
Definition: memberdef.cpp:4145
static int charsToIndex ( const char *  word)
static

Definition at line 183 of file searchindex.cpp.

184 {
185  if (word==0) return -1;
186 
187  // Fast string hashing algorithm
188  //register ushort h=0;
189  //const char *k = word;
190  //ushort mask=0xfc00;
191  //while ( *k )
192  //{
193  // h = (h&mask)^(h<<6)^(*k++);
194  //}
195  //return h;
196 
197  // Simple hashing that allows for substring searching
198  uint c1=((uchar *)word)[0];
199  if (c1==0) return -1;
200  uint c2=((uchar *)word)[1];
201  if (c2==0) return -1;
202  return c1*256+c2;
203 }
unsigned char uchar
Definition: nybbler.cc:11
unsigned uint
Definition: qglobal.h:351
union ptb::content::word::word word
void createJavascriptSearchIndex ( )

Definition at line 718 of file searchindex.cpp.

719 {
720  // set index names
736 
737  // set index texts
753 
754  // add symbols to letter -> symbol list map
755 
756  // index classes
758  ClassDef *cd;
759  for (;(cd=cli.current());++cli)
760  {
761  uint letter = getUtf8CodeToLower(cd->localName(),0);
762  if (cd->isLinkable() && isId(letter))
763  {
766  }
767  }
768 
769  // index namespaces
771  NamespaceDef *nd;
772  for (;(nd=nli.current());++nli)
773  {
774  uint letter = getUtf8CodeToLower(nd->name(),0);
775  if (nd->isLinkable() && isId(letter))
776  {
779  }
780  }
781 
782  // index files
784  FileName *fn;
785  for (;(fn=fnli.current());++fnli)
786  {
787  FileNameIterator fni(*fn);
788  FileDef *fd;
789  for (;(fd=fni.current());++fni)
790  {
791  uint letter = getUtf8CodeToLower(fd->name(),0);
792  if (fd->isLinkable() && isId(letter))
793  {
796  }
797  }
798  }
799 
800  // index class members
801  {
803  MemberName *mn;
804  // for each member name
805  for (mnli.toFirst();(mn=mnli.current());++mnli)
806  {
807  MemberDef *md;
808  MemberNameIterator mni(*mn);
809  // for each member definition
810  for (mni.toFirst();(md=mni.current());++mni)
811  {
813  }
814  }
815  }
816 
817  // index file/namespace members
818  {
820  MemberName *mn;
821  // for each member name
822  for (fnli.toFirst();(mn=fnli.current());++fnli)
823  {
824  MemberDef *md;
825  MemberNameIterator mni(*mn);
826  // for each member definition
827  for (mni.toFirst();(md=mni.current());++mni)
828  {
830  }
831  }
832  }
833 
834  // index groups
836  GroupDef *gd;
837  for (gli.toFirst();(gd=gli.current());++gli)
838  {
839  if (gd->isLinkable())
840  {
841  QCString title = gd->groupTitle();
842  if (!title.isEmpty()) // TODO: able searching for all word in the title
843  {
844  uchar charCode = title.at(0);
845  uint letter = charCode<128 ? tolower(charCode) : charCode;
846  if (isId(letter))
847  {
850  }
851  }
852  }
853  }
854 
855  // index pages
857  PageDef *pd=0;
858  for (pdi.toFirst();(pd=pdi.current());++pdi)
859  {
860  if (pd->isLinkable())
861  {
862  QCString title = pd->title();
863  if (!title.isEmpty())
864  {
865  uchar charCode = title.at(0);
866  uint letter = charCode<128 ? tolower(charCode) : charCode;
867  if (isId(letter))
868  {
871  }
872  }
873  }
874  }
875  if (Doxygen::mainPage)
876  {
877  QCString title = Doxygen::mainPage->title();
878  if (!title.isEmpty())
879  {
880  uchar charCode = title.at(0);
881  uint letter = charCode<128 ? tolower(charCode) : charCode;
882  if (isId(letter))
883  {
886  }
887  }
888  }
889 
890  // sort all lists
891  int i;
892  for (i=0;i<NUM_SEARCH_INDICES;i++)
893  {
895  SearchIndexList *sl;
896  for (it.toFirst();(sl=it.current());++it)
897  {
898  sl->sort();
899  }
900  }
901 }
virtual QCString trTypedefs()=0
static GroupSDict * groupSDict
Definition: doxygen.h:119
static MemberNameSDict * functionNameSDict
Definition: doxygen.h:116
bool isLinkable() const
Definition: groupdef.cpp:1645
virtual QCString trClasses()=0
virtual QCString trFile(bool first_capital, bool singular)=0
bool isLinkable() const
Definition: filedef.h:117
bool isEmpty() const
Definition: qcstring.h:189
QCString title() const
Definition: pagedef.h:54
#define SEARCH_INDEX_EVENTS
Definition: searchindex.h:125
virtual QCString trEnumerationValues()=0
virtual QCString trFriends()=0
char & at(uint i) const
Definition: qcstring.h:326
const bool FALSE
Definition: qglobal.h:370
static FileNameList * inputNameList
Definition: doxygen.h:109
#define SEARCH_INDEX_PROPERTIES
Definition: searchindex.h:124
static void addMemberToSearchIndex(MemberDef *md)
#define SEARCH_INDEX_VARIABLES
Definition: searchindex.h:120
#define SEARCH_INDEX_GROUPS
Definition: searchindex.h:128
uint getUtf8CodeToLower(const QCString &s, int idx)
Returns one unicode character as an unsigned integer from utf-8 string, making the character lower ca...
Definition: util.cpp:8276
#define SEARCH_INDEX_ALL
Definition: searchindex.h:115
const char * groupTitle() const
Definition: groupdef.h:54
unsigned char uchar
Definition: nybbler.cc:11
#define SEARCH_INDEX_RELATED
Definition: searchindex.h:126
static NamespaceSDict * namespaceSDict
Definition: doxygen.h:120
def cli(ctx)
Definition: main.py:7
QAsciiDict< Entry > fn
const QCString & name() const
Definition: definition.h:114
QCString name() const
Definition: filedef.cpp:1193
virtual QCString trVariables()=0
virtual QCString trFunctions()=0
#define SEARCH_INDEX_PAGES
Definition: searchindex.h:129
bool isLinkable() const
#define SEARCH_INDEX_FILES
Definition: searchindex.h:118
static PageSDict * pageSDict
Definition: doxygen.h:102
#define SEARCH_INDEX_ENUMS
Definition: searchindex.h:122
static SearchIndexInfo g_searchIndexInfo[NUM_SEARCH_INDICES]
bool isLinkable() const
Definition: classdef.cpp:2729
virtual QCString trGroup(bool first_capital, bool singular)=0
#define SEARCH_INDEX_NAMESPACES
Definition: searchindex.h:117
#define SEARCH_INDEX_TYPEDEFS
Definition: searchindex.h:121
virtual QCString trEnumerations()=0
virtual QCString trAll()=0
bool isLinkable() const
Definition: pagedef.h:45
virtual QCString trPage(bool first_capital, bool singular)=0
virtual QCString trEvents()=0
void sort()
Definition: sortdict.h:188
#define NUM_SEARCH_INDICES
Definition: searchindex.h:130
static MemberNameSDict * memberNameSDict
Definition: doxygen.h:115
A model of a page symbol.
Definition: pagedef.h:29
void append(uint letter, typename T::ElementType *elem)
Definition: util.h:100
virtual QCString trNamespace(bool first_capital, bool singular)=0
#define SEARCH_INDEX_DEFINES
Definition: searchindex.h:127
#define SEARCH_INDEX_FUNCTIONS
Definition: searchindex.h:119
Translator * theTranslator
Definition: language.cpp:157
bool isId(int c)
Definition: util.h:224
friend class Iterator
Definition: sortdict.h:289
virtual QCString trProperties()=0
LetterToIndexMap< SearchIndexList > symbolList
Definition: searchindex.h:158
#define SEARCH_INDEX_ENUMVALUES
Definition: searchindex.h:123
#define SEARCH_INDEX_CLASSES
Definition: searchindex.h:116
unsigned uint
Definition: qglobal.h:351
static ClassSDict * classSDict
Definition: doxygen.h:99
static PageDef * mainPage
Definition: doxygen.h:103
QCString localName() const
const bool TRUE
Definition: qglobal.h:371
virtual QCString trDefines()=0
static QCString definitionToName ( Definition ctx)
static

Definition at line 445 of file searchindex.cpp.

446 {
447  if (ctx && ctx->definitionType()==Definition::TypeMember)
448  {
449  MemberDef *md = (MemberDef*)ctx;
450  if (md->isFunction())
451  return "function";
452  else if (md->isSlot())
453  return "slot";
454  else if (md->isSignal())
455  return "signal";
456  else if (md->isVariable())
457  return "variable";
458  else if (md->isTypedef())
459  return "typedef";
460  else if (md->isEnumerate())
461  return "enum";
462  else if (md->isEnumValue())
463  return "enumvalue";
464  else if (md->isProperty())
465  return "property";
466  else if (md->isEvent())
467  return "event";
468  else if (md->isRelated() || md->isForeign())
469  return "related";
470  else if (md->isFriend())
471  return "friend";
472  else if (md->isDefine())
473  return "define";
474  }
475  else if (ctx)
476  {
477  switch(ctx->definitionType())
478  {
479  case Definition::TypeClass:
480  return ((ClassDef*)ctx)->compoundTypeString();
482  return "file";
484  return "namespace";
486  return "group";
488  return "package";
490  return "page";
491  case Definition::TypeDir:
492  return "dir";
493  default:
494  break;
495  }
496  }
497  return "unknown";
498 }
bool isProperty() const
Definition: memberdef.cpp:4185
bool isFriend() const
Definition: memberdef.cpp:4175
bool isEvent() const
Definition: memberdef.cpp:4190
bool isDefine() const
Definition: memberdef.cpp:4170
bool isSignal() const
Definition: memberdef.cpp:4130
bool isSlot() const
Definition: memberdef.cpp:4135
bool isVariable() const
Definition: memberdef.cpp:4140
virtual DefType definitionType() const =0
bool isEnumValue() const
Definition: memberdef.cpp:4150
bool isForeign() const
Definition: memberdef.cpp:4200
bool isFunction() const
Definition: memberdef.cpp:4160
bool isRelated() const
Definition: memberdef.cpp:4195
bool isTypedef() const
Definition: memberdef.cpp:4155
bool isEnumerate() const
Definition: memberdef.cpp:4145
void finializeSearchIndexer ( )

Cleanup the search indexer

Definition at line 1320 of file searchindex.cpp.

1321 {
1322  delete Doxygen::searchIndex;
1323 }
static SearchIndexIntf * searchIndex
Definition: doxygen.h:133
const SearchIndexInfo* getSearchIndices ( )

Definition at line 1247 of file searchindex.cpp.

1248 {
1249  return g_searchIndexInfo;
1250 }
static SearchIndexInfo g_searchIndexInfo[NUM_SEARCH_INDICES]
void initSearchIndexer ( )

Initialize the search indexer

Definition at line 1298 of file searchindex.cpp.

1299 {
1300  static bool searchEngine = Config_getBool("SEARCHENGINE");
1301  static bool serverBasedSearch = Config_getBool("SERVER_BASED_SEARCH");
1302  static bool externalSearch = Config_getBool("EXTERNAL_SEARCH");
1303  if (searchEngine && serverBasedSearch)
1304  {
1305  if (externalSearch) // external tools produce search index and engine
1306  {
1308  }
1309  else // doxygen produces search index and engine
1310  {
1312  }
1313  }
1314  else // no search engine or pure javascript based search function
1315  {
1317  }
1318 }
static SearchIndexIntf * searchIndex
Definition: doxygen.h:133
#define Config_getBool(val)
Definition: config.cpp:664
static QCString searchId ( const QCString s)
static

Definition at line 692 of file searchindex.cpp.

693 {
694  int c;
695  uint i;
697  for (i=0;i<s.length();i++)
698  {
699  c=s.at(i);
700  if (c>0x7f || c<0) // part of multibyte character
701  {
702  result+=(char)c;
703  }
704  else if (isalnum(c)) // simply alpha numerical character
705  {
706  result+=(char)tolower(c);
707  }
708  else // other 'unprintable' characters
709  {
710  char val[4];
711  sprintf(val,"_%02x",(uchar)c);
712  result+=val;
713  }
714  }
715  return result;
716 }
static QCString result
uint length() const
Definition: qcstring.h:195
char & at(uint i) const
Definition: qcstring.h:326
unsigned char uchar
Definition: nybbler.cc:11
unsigned uint
Definition: qglobal.h:351
static void writeInt ( QFile f,
int  index 
)
static

Definition at line 247 of file searchindex.cpp.

248 {
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);
253 }
int putch(int)
Definition: qfile.cpp:386
unsigned uint
Definition: qglobal.h:351
void writeJavascriptSearchIndex ( )

Definition at line 903 of file searchindex.cpp.

904 {
905  int i;
906  // write index files
907  QCString searchDirName = Config_getString("HTML_OUTPUT")+"/search";
908 
909  for (i=0;i<NUM_SEARCH_INDICES;i++) // for each index
910  {
912  SearchIndexList *sl;
913  int p=0;
914  for (it.toFirst();(sl=it.current());++it,++p) // for each letter
915  {
917  baseName.sprintf("%s_%x",g_searchIndexInfo[i].name.data(),p);
918 
919  QCString fileName = searchDirName + "/"+baseName+".html";
920  QCString dataFileName = searchDirName + "/"+baseName+".js";
921 
922  QFile outFile(fileName);
923  QFile dataOutFile(dataFileName);
924  if (outFile.open(IO_WriteOnly) && dataOutFile.open(IO_WriteOnly))
925  {
926  {
928 
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;
940  t << "<div class=\"SRStatus\" id=\"Loading\">" << theTranslator->trLoading() << "</div>" << endl;
941  t << "<div id=\"SRResults\"></div>" << endl; // here the results will be inserted
942  t << "<script type=\"text/javascript\"><!--" << endl;
943  t << "createResults();" << endl; // this function will insert the results
944  t << "--></script>" << endl;
945  t << "<div class=\"SRStatus\" id=\"Searching\">"
946  << theTranslator->trSearching() << "</div>" << endl;
947  t << "<div class=\"SRStatus\" id=\"NoMatches\">"
948  << theTranslator->trNoMatches() << "</div>" << endl;
949 
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; // SRIndex
957  t << "</body>" << endl;
958  t << "</html>" << endl;
959  }
960  FTextStream ti(&dataOutFile);
961 
962  ti << "var searchData=" << endl;
963  // format
964  // searchData[] = array of items
965  // searchData[x][0] = id
966  // searchData[x][1] = [ name + child1 + child2 + .. ]
967  // searchData[x][1][0] = name as shown
968  // searchData[x][1][y+1] = info for child y
969  // searchData[x][1][y+1][0] = url
970  // searchData[x][1][y+1][1] = 1 => target="_parent"
971  // searchData[x][1][y+1][2] = scope
972 
973  ti << "[" << endl;
974  bool firstEntry=TRUE;
975 
978  int itemCount=0;
979  for (li.toFirst();(dl=li.current());++li)
980  {
981  Definition *d = dl->getFirst();
982 
983  if (!firstEntry)
984  {
985  ti << "," << endl;
986  }
987  firstEntry=FALSE;
988 
989  ti << " ['" << dl->id() << "',['" << convertToXML(dl->name()) << "',[";
990 
991  if (dl->count()==1) // item with a unique name
992  {
993  MemberDef *md = 0;
994  bool isMemberDef = d->definitionType()==Definition::TypeMember;
995  if (isMemberDef) md = (MemberDef*)d;
996  QCString anchor = d->anchor();
997 
998  ti << "'" << externalRef("../",d->getReference(),TRUE)
1000  if (!anchor.isEmpty())
1001  {
1002  ti << "#" << anchor;
1003  }
1004  ti << "',";
1005 
1006  static bool extLinksInWindow = Config_getBool("EXT_LINKS_IN_WINDOW");
1007  if (!extLinksInWindow || d->getReference().isEmpty())
1008  {
1009  ti << "1,";
1010  }
1011  else
1012  {
1013  ti << "0,";
1014  }
1015 
1017  {
1018  ti << "'" << convertToXML(d->getOuterScope()->name()) << "'";
1019  }
1020  else if (md)
1021  {
1022  FileDef *fd = md->getBodyDef();
1023  if (fd==0) fd = md->getFileDef();
1024  if (fd)
1025  {
1026  ti << "'" << convertToXML(fd->localName()) << "'";
1027  }
1028  }
1029  else
1030  {
1031  ti << "''";
1032  }
1033  ti << "]]";
1034  }
1035  else // multiple items with the same name
1036  {
1037  QListIterator<Definition> di(*dl);
1038  bool overloadedFunction = FALSE;
1039  Definition *prevScope = 0;
1040  int childCount=0;
1041  for (di.toFirst();(d=di.current());)
1042  {
1043  ++di;
1044  Definition *scope = d->getOuterScope();
1045  Definition *next = di.current();
1046  Definition *nextScope = 0;
1047  MemberDef *md = 0;
1048  bool isMemberDef = d->definitionType()==Definition::TypeMember;
1049  if (isMemberDef) md = (MemberDef*)d;
1050  if (next) nextScope = next->getOuterScope();
1051  QCString anchor = d->anchor();
1052 
1053  if (childCount>0)
1054  {
1055  ti << "],[";
1056  }
1057  ti << "'" << externalRef("../",d->getReference(),TRUE)
1059  if (!anchor.isEmpty())
1060  {
1061  ti << "#" << anchor;
1062  }
1063  ti << "',";
1064 
1065  static bool extLinksInWindow = Config_getBool("EXT_LINKS_IN_WINDOW");
1066  if (!extLinksInWindow || d->getReference().isEmpty())
1067  {
1068  ti << "1,";
1069  }
1070  else
1071  {
1072  ti << "0,";
1073  }
1074  bool found=FALSE;
1075  overloadedFunction = ((prevScope!=0 && scope==prevScope) ||
1076  (scope && scope==nextScope)
1077  ) && md &&
1078  (md->isFunction() || md->isSlot());
1079  QCString prefix;
1080  if (md) prefix=convertToXML(md->localName());
1081  if (overloadedFunction) // overloaded member function
1082  {
1083  prefix+=convertToXML(md->argsString());
1084  // show argument list to disambiguate overloaded functions
1085  }
1086  else if (md) // unique member function
1087  {
1088  prefix+="()"; // only to show it is a function
1089  }
1090  QCString name;
1092  {
1093  name = convertToXML(((ClassDef*)d)->displayName());
1094  found = TRUE;
1095  }
1097  {
1098  name = convertToXML(((NamespaceDef*)d)->displayName());
1099  found = TRUE;
1100  }
1101  else if (scope==0 || scope==Doxygen::globalScope) // in global scope
1102  {
1103  if (md)
1104  {
1105  FileDef *fd = md->getBodyDef();
1106  if (fd==0) fd = md->getFileDef();
1107  if (fd)
1108  {
1109  if (!prefix.isEmpty()) prefix+=":&#160;";
1110  name = prefix + convertToXML(fd->localName());
1111  found = TRUE;
1112  }
1113  }
1114  }
1115  else if (md && (md->getClassDef() || md->getNamespaceDef()))
1116  // member in class or namespace scope
1117  {
1118  SrcLangExt lang = md->getLanguage();
1119  name = convertToXML(d->getOuterScope()->qualifiedName())
1121  found = TRUE;
1122  }
1123  else if (scope) // some thing else? -> show scope
1124  {
1125  name = prefix + convertToXML(scope->name());
1126  found = TRUE;
1127  }
1128  if (!found) // fallback
1129  {
1130  name = prefix + "("+theTranslator->trGlobalNamespace()+")";
1131  }
1132 
1133  ti << "'" << name << "'";
1134 
1135  prevScope = scope;
1136  childCount++;
1137  }
1138 
1139  ti << "]]";
1140  }
1141  ti << "]";
1142  itemCount++;
1143  }
1144  if (!firstEntry)
1145  {
1146  ti << endl;
1147  }
1148 
1149  ti << "];" << endl;
1150 
1151  }
1152  else
1153  {
1154  err("Failed to open file '%s' for writing...\n",fileName.data());
1155  }
1156  }
1157  }
1158 
1159  {
1160  QFile f(searchDirName+"/searchdata.js");
1161  if (f.open(IO_WriteOnly))
1162  {
1163  FTextStream t(&f);
1164  t << "var indexSectionsWithContent =" << endl;
1165  t << "{" << endl;
1166  bool first=TRUE;
1167  int j=0;
1168  for (i=0;i<NUM_SEARCH_INDICES;i++)
1169  {
1170  if (g_searchIndexInfo[i].symbolList.count()>0)
1171  {
1172  if (!first) t << "," << endl;
1173  t << " " << j << ": \"";
1174 
1176  SearchIndexList *sl;
1177  for (it.toFirst();(sl=it.current());++it) // for each letter
1178  {
1179  t << QString( QChar( sl->letter() ) ).utf8();
1180  }
1181  t << "\"";
1182  first=FALSE;
1183  j++;
1184  }
1185  }
1186  if (!first) t << "\n";
1187  t << "};" << endl << endl;
1188  t << "var indexSectionNames =" << endl;
1189  t << "{" << endl;
1190  first=TRUE;
1191  j=0;
1192  for (i=0;i<NUM_SEARCH_INDICES;i++)
1193  {
1194  if (g_searchIndexInfo[i].symbolList.count()>0)
1195  {
1196  if (!first) t << "," << endl;
1197  t << " " << j << ": \"" << g_searchIndexInfo[i].name << "\"";
1198  first=FALSE;
1199  j++;
1200  }
1201  }
1202  if (!first) t << "\n";
1203  t << "};" << endl << endl;
1204  t << "var indexSectionLabels =" << endl;
1205  t << "{" << endl;
1206  first=TRUE;
1207  j=0;
1208  for (i=0;i<NUM_SEARCH_INDICES;i++)
1209  {
1210  if (g_searchIndexInfo[i].symbolList.count()>0)
1211  {
1212  if (!first) t << "," << endl;
1213  t << " " << j << ": \"" << convertToXML(g_searchIndexInfo[i].text) << "\"";
1214  first=FALSE;
1215  j++;
1216  }
1217  }
1218  if (!first) t << "\n";
1219  t << "};" << endl << endl;
1220  }
1221  ResourceMgr::instance().copyResource("search.js",searchDirName);
1222  }
1223  {
1224  QFile f(searchDirName+"/nomatches.html");
1225  if (f.open(IO_WriteOnly))
1226  {
1227  FTextStream t(&f);
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\">"
1238  << theTranslator->trNoMatches() << "</div>" << endl;
1239  t << "</div>" << endl;
1240  t << "</body>" << endl;
1241  t << "</html>" << endl;
1242  }
1243  }
1244  Doxygen::indexList->addStyleSheetFile("search/search.js");
1245 }
static QCString name
Definition: declinfo.cpp:673
QCString convertToXML(const char *s)
Definition: util.cpp:5717
static QCString scope
Definition: declinfo.cpp:668
virtual QCString getReference() const
bool isEmpty() const
Definition: qcstring.h:189
#define IO_WriteOnly
Definition: qiodevice.h:62
static QCString htmlFileExtension
Definition: doxygen.h:130
virtual QCString trNoMatches()=0
FileDef * getBodyDef() const
const bool FALSE
Definition: qglobal.h:370
bool copyResource(const char *name, const char *targetDir) const
static ResourceMgr & instance()
Definition: resourcemgr.cpp:35
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
TFile * outFile
Definition: makeDST.cxx:36
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
bool isSlot() const
Definition: memberdef.cpp:4135
virtual QCString getOutputFileBase() const =0
The QChar class provides a light-weight Unicode character.
Definition: qstring.h:56
SrcLangExt
Definition: types.h:41
virtual QCString trLoading()=0
QCString id() const
Definition: searchindex.h:136
FileDef * getFileDef() const
Definition: memberdef.cpp:4075
static NamespaceDef * globalScope
Definition: doxygen.h:128
virtual QCString trGlobalNamespace()=0
virtual DefType definitionType() const =0
Definition: sortdict.h:73
QCString getLanguageSpecificSeparator(SrcLangExt lang, bool classScope)
Definition: util.cpp:8065
uint count() const
Definition: qlist.h:66
const QCString & name() const
Definition: definition.h:114
fileName
Definition: dumpTree.py:9
SrcLangExt getLanguage() const
void addStyleSheetFile(const char *name)
Definition: index.h:149
char versionString[]
Definition: version.cpp:1
p
Definition: test.py:223
const char * data() const
Definition: qcstring.h:207
static SearchIndexInfo g_searchIndexInfo[NUM_SEARCH_INDICES]
#define Config_getString(val)
Definition: config.cpp:660
#define Config_getBool(val)
Definition: config.cpp:664
ClassDef * getClassDef() const
Definition: memberdef.cpp:4070
type * getFirst() const
Definition: qlist.h:95
virtual QCString qualifiedName() const
void err(const char *fmt,...)
Definition: message.cpp:226
The QFile class is an I/O device that operates on files.
Definition: qfile.h:50
QCString & sprintf(const char *format,...)
Definition: qcstring.cpp:27
virtual Definition * getOuterScope() const
uint letter() const
#define NUM_SEARCH_INDICES
Definition: searchindex.h:130
NamespaceDef * getNamespaceDef() const
Definition: memberdef.cpp:4080
Translator * theTranslator
Definition: language.cpp:157
bool isFunction() const
Definition: memberdef.cpp:4160
static QCString baseName
Definition: scanner.cpp:10890
virtual QCString trSearching()=0
const char * argsString() const
Definition: memberdef.cpp:4040
QCString utf8() const
Definition: qstring.cpp:14507
QCString localName() const
const bool TRUE
Definition: qglobal.h:371
static IndexList * indexList
Definition: doxygen.h:149
virtual QCString anchor() const =0
QTextStream & endl(QTextStream &s)
QCString externalRef(const QCString &relPath, const QCString &ref, bool href)
Definition: util.cpp:7856
QCString name() const
Definition: searchindex.h:137
static void writeString ( QFile f,
const char *  s 
)
static

Definition at line 255 of file searchindex.cpp.

256 {
257  const char *p = s;
258  while (*p) f.putch(*p++);
259  f.putch(0);
260 }
int putch(int)
Definition: qfile.cpp:386
p
Definition: test.py:223
static QCString * s
Definition: config.cpp:1042

Variable Documentation

SearchIndexInfo g_searchIndexInfo[NUM_SEARCH_INDICES]
static

Definition at line 586 of file searchindex.cpp.

const int numIndexEntries = 256*256

Definition at line 52 of file searchindex.cpp.