Skip to content

Commit

Permalink
Added javascript search engine data to the template context
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitri van Heesch committed Aug 27, 2015
1 parent cfac082 commit 6bb0d29
Show file tree
Hide file tree
Showing 14 changed files with 1,000 additions and 212 deletions.
502 changes: 502 additions & 0 deletions src/context.cpp

Large diffs are not rendered by default.

172 changes: 171 additions & 1 deletion src/context.h
Expand Up @@ -52,7 +52,10 @@ class MemberGroup;
class MemberGroupSDict;
class MemberGroupList;
class DotNode;
class DotGfxHierarchyTable;
class DotGfxHierarchyTable;
struct SearchIndexInfo;
class SearchIndexList;
class SearchDefinitionList;

//----------------------------------------------------

Expand Down Expand Up @@ -1154,6 +1157,173 @@ class ArgumentListContext : public RefCountedContext, public TemplateListIntf

//----------------------------------------------------

class SymbolContext : public RefCountedContext, public TemplateStructIntf
{
public:
static SymbolContext *alloc(const Definition *def,const Definition *prev,const Definition *next)
{ return new SymbolContext(def,prev,next); }

// TemplateStructIntf methods
virtual TemplateVariant get(const char *name) const;
virtual int addRef() { return RefCountedContext::addRef(); }
virtual int release() { return RefCountedContext::release(); }

private:
SymbolContext(const Definition *def,const Definition *prev,const Definition *next);
~SymbolContext();
class Private;
Private *p;
};

//----------------------------------------------------

class SymbolListContext : public RefCountedContext, public TemplateListIntf
{
public:
static SymbolListContext *alloc(const SearchDefinitionList *sdl)
{ return new SymbolListContext(sdl); }

// TemplateListIntf
virtual int count() const;
virtual TemplateVariant at(int index) const;
virtual TemplateListIntf::ConstIterator *createIterator() const;
virtual int addRef() { return RefCountedContext::addRef(); }
virtual int release() { return RefCountedContext::release(); }

private:
SymbolListContext(const SearchDefinitionList *sdl);
~SymbolListContext();
class Private;
Private *p;
};

//----------------------------------------------------

class SymbolGroupContext : public RefCountedContext, public TemplateStructIntf
{
public:
static SymbolGroupContext *alloc(const SearchDefinitionList *sdl)
{ return new SymbolGroupContext(sdl); }

// TemplateStructIntf methods
virtual TemplateVariant get(const char *name) const;
virtual int addRef() { return RefCountedContext::addRef(); }
virtual int release() { return RefCountedContext::release(); }

private:
SymbolGroupContext(const SearchDefinitionList *sdl);
~SymbolGroupContext();
class Private;
Private *p;
};

//----------------------------------------------------

class SymbolGroupListContext : public RefCountedContext, public TemplateListIntf
{
public:
static SymbolGroupListContext *alloc(const SearchIndexList *sil)
{ return new SymbolGroupListContext(sil); }

// TemplateListIntf
virtual int count() const;
virtual TemplateVariant at(int index) const;
virtual TemplateListIntf::ConstIterator *createIterator() const;
virtual int addRef() { return RefCountedContext::addRef(); }
virtual int release() { return RefCountedContext::release(); }

private:
SymbolGroupListContext(const SearchIndexList *sil);
~SymbolGroupListContext();
class Private;
Private *p;
};

//----------------------------------------------------

class SymbolIndexContext : public RefCountedContext, public TemplateStructIntf
{
public:
static SymbolIndexContext *alloc(const SearchIndexList *sl,const QCString &name)
{ return new SymbolIndexContext(sl,name); }

// TemplateStructIntf methods
virtual TemplateVariant get(const char *name) const;
virtual int addRef() { return RefCountedContext::addRef(); }
virtual int release() { return RefCountedContext::release(); }

private:
SymbolIndexContext(const SearchIndexList *sl,const QCString &name);
~SymbolIndexContext();
class Private;
Private *p;
};

//----------------------------------------------------

class SymbolIndicesContext : public RefCountedContext, public TemplateListIntf
{
public:
static SymbolIndicesContext *alloc(const SearchIndexInfo *info)
{ return new SymbolIndicesContext(info); }

// TemplateListIntf
virtual int count() const;
virtual TemplateVariant at(int index) const;
virtual TemplateListIntf::ConstIterator *createIterator() const;
virtual int addRef() { return RefCountedContext::addRef(); }
virtual int release() { return RefCountedContext::release(); }

private:
SymbolIndicesContext(const SearchIndexInfo *info);
~SymbolIndicesContext();
class Private;
Private *p;
};

//----------------------------------------------------

class SearchIndexContext : public RefCountedContext, public TemplateStructIntf
{
public:
static SearchIndexContext *alloc(const SearchIndexInfo *info)
{ return new SearchIndexContext(info); }

// TemplateStructIntf methods
virtual TemplateVariant get(const char *name) const;
virtual int addRef() { return RefCountedContext::addRef(); }
virtual int release() { return RefCountedContext::release(); }

private:
SearchIndexContext(const SearchIndexInfo *info);
~SearchIndexContext();
class Private;
Private *p;
};

//----------------------------------------------------

class SearchIndicesContext : public RefCountedContext, public TemplateListIntf
{
public:
static SearchIndicesContext *alloc() { return new SearchIndicesContext; }

// TemplateListIntf
virtual int count() const;
virtual TemplateVariant at(int index) const;
virtual TemplateListIntf::ConstIterator *createIterator() const;
virtual int addRef() { return RefCountedContext::addRef(); }
virtual int release() { return RefCountedContext::release(); }

private:
SearchIndicesContext();
~SearchIndicesContext();
class Private;
Private *p;
};

//----------------------------------------------------

void generateOutputViaTemplate();

#endif
9 changes: 7 additions & 2 deletions src/doxygen.cpp
Expand Up @@ -11484,12 +11484,17 @@ void generateOutput()
static bool searchEngine = Config_getBool("SEARCHENGINE");
static bool serverBasedSearch = Config_getBool("SERVER_BASED_SEARCH");

g_s.begin("Generating search indices...\n");
if (searchEngine && !serverBasedSearch && (generateHtml || g_useOutputTemplate))
{
createJavascriptSearchIndex();
}

// generate search indices (need to do this before writing other HTML
// pages as these contain a drop down menu with options depending on
// what categories we find in this function.
if (generateHtml && searchEngine)
{
g_s.begin("Generating search indices...\n");
QCString searchDirName = Config_getString("HTML_OUTPUT")+"/search";
QDir searchDir(searchDirName);
if (!searchDir.exists() && !searchDir.mkdir(searchDirName))
Expand All @@ -11503,8 +11508,8 @@ void generateOutput()
{
writeJavascriptSearchIndex();
}
g_s.end();
}
g_s.end();

g_s.begin("Generating example documentation...\n");
generateExampleDocs();
Expand Down

0 comments on commit 6bb0d29

Please sign in to comment.