My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Private Attributes | List of all members
SearchIndexExternal Class Reference

#include <searchindex.h>

Inheritance diagram for SearchIndexExternal:
SearchIndexIntf

Classes

struct  Private
 

Public Member Functions

 SearchIndexExternal ()
 
 ~SearchIndexExternal ()
 
void setCurrentDoc (Definition *ctx, const char *anchor, bool isSourceFile)
 
void addWord (const char *word, bool hiPriority)
 
void write (const char *file)
 
- Public Member Functions inherited from SearchIndexIntf
 SearchIndexIntf (Kind k)
 
virtual ~SearchIndexIntf ()
 
Kind kind () const
 

Private Attributes

Privatep
 

Additional Inherited Members

- Public Types inherited from SearchIndexIntf
enum  Kind { Internal, External }
 

Detailed Description

Definition at line 100 of file searchindex.h.

Constructor & Destructor Documentation

SearchIndexExternal::SearchIndexExternal ( )
SearchIndexExternal::~SearchIndexExternal ( )

Definition at line 439 of file searchindex.cpp.

References p.

{
//printf("p->docEntries.count()=%d\n",p->docEntries.count());
delete p;
}

Member Function Documentation

void SearchIndexExternal::addWord ( const char *  word,
bool  hiPriority 
)
virtual

Implements SearchIndexIntf.

Definition at line 527 of file searchindex.cpp.

References GrowBuf::addChar(), GrowBuf::addStr(), SearchIndexExternal::Private::current, GrowBuf::getPos(), SearchDocEntry::importantText, isId(), SearchDocEntry::normalText, and p.

{
if (word==0 || !isId(*word) || p->current==0) return;
GrowBuf *pText = hiPriority ? &p->current->importantText : &p->current->normalText;
if (pText->getPos()>0) pText->addChar(' ');
pText->addStr(word);
//printf("addWord %s\n",word);
}
void SearchIndexExternal::setCurrentDoc ( Definition ctx,
const char *  anchor,
bool  isSourceFile 
)
virtual

Implements SearchIndexIntf.

Definition at line 500 of file searchindex.cpp.

References SDict< T >::append(), SearchDocEntry::args, Config_getString, SearchIndexExternal::Private::current, definitionToName(), SearchIndexExternal::Private::docEntries, SearchDocEntry::extId, SDict< T >::find(), Doxygen::htmlFileExtension, SearchDocEntry::name, p, stripPath(), SearchDocEntry::type, DefinitionIntf::TypeMember, and SearchDocEntry::url.

{
QCString extId = stripPath(Config_getString(EXTERNAL_SEARCH_ID));
QCString baseName = isSourceFile ? ((FileDef*)ctx)->getSourceFileBase() : ctx->getOutputFileBase();
QCString url = baseName + Doxygen::htmlFileExtension;
if (anchor) url+=QCString("#")+anchor;
QCString key = extId+";"+url;
//printf("setCurrentDoc(url=%s,isSourceFile=%d) current=%p\n",url.data(),isSourceFile,p->current);
if (!p->current)
{
e->type = isSourceFile ? QCString("source") : definitionToName(ctx);
e->name = ctx->qualifiedName();
{
e->args = ((MemberDef*)ctx)->argsString();
}
e->extId = extId;
e->url = url;
p->current = e;
p->docEntries.append(key,e);
//printf("searchIndexExt %s : %s\n",e->name.data(),e->url.data());
}
}
void SearchIndexExternal::write ( const char *  file)
virtual

Implements SearchIndexIntf.

Definition at line 536 of file searchindex.cpp.

References GrowBuf::addChar(), SearchDocEntry::args, convertToXML(), doc, SearchIndexExternal::Private::docEntries, endl(), err(), SearchDocEntry::extId, GrowBuf::get(), SearchDocEntry::importantText, SearchDocEntry::name, SearchDocEntry::normalText, p, SearchDocEntry::type, and SearchDocEntry::url.

{
QFile f(fileName);
if (f.open(IO_WriteOnly))
{
FTextStream t(&f);
t << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
t << "<add>" << endl;
for (it.toFirst();(doc=it.current());++it)
{
doc->normalText.addChar(0); // make sure buffer ends with a 0 terminator
doc->importantText.addChar(0); // make sure buffer ends with a 0 terminator
t << " <doc>" << endl;
t << " <field name=\"type\">" << doc->type << "</field>" << endl;
t << " <field name=\"name\">" << convertToXML(doc->name) << "</field>" << endl;
if (!doc->args.isEmpty())
{
t << " <field name=\"args\">" << convertToXML(doc->args) << "</field>" << endl;
}
if (!doc->extId.isEmpty())
{
t << " <field name=\"tag\">" << convertToXML(doc->extId) << "</field>" << endl;
}
t << " <field name=\"url\">" << convertToXML(doc->url) << "</field>" << endl;
t << " <field name=\"keywords\">" << convertToXML(doc->importantText.get()) << "</field>" << endl;
t << " <field name=\"text\">" << convertToXML(doc->normalText.get()) << "</field>" << endl;
t << " </doc>" << endl;
}
t << "</add>" << endl;
}
else
{
err("Failed to open file %s for writing!\n",fileName);
}
}

Member Data Documentation

Private* SearchIndexExternal::p
private

The documentation for this class was generated from the following files: