Doxygen
Loading...
Searching...
No Matches
searchindex.cpp File Reference
#include <ctype.h>
#include <assert.h>
#include <mutex>
#include <map>
#include <unordered_map>
#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 "groupdef.h"
#include "filedef.h"
#include "portable.h"
+ Include dependency graph for searchindex.cpp:

Go to the source code of this file.

Functions

static int charsToIndex (const QCString &word)
 
static void writeInt (std::ostream &f, size_t index)
 
static void writeString (std::ostream &f, const QCString &s)
 
static QCString definitionToName (const Definition *ctx)
 
void initSearchIndexer ()
 
void finalizeSearchIndexer ()
 

Variables

const size_t numIndexEntries = 256*256
 
static std::mutex g_searchIndexMutex
 

Function Documentation

◆ charsToIndex()

static int charsToIndex ( const QCString & word)
static

Definition at line 175 of file searchindex.cpp.

176{
177 if (word.length()<2) return -1;
178
179 // Fast string hashing algorithm
180 //register uint16_t h=0;
181 //const char *k = word;
182 //uint16_t mask=0xfc00;
183 //while ( *k )
184 //{
185 // h = (h&mask)^(h<<6)^(*k++);
186 //}
187 //return h;
188
189 // Simple hashing that allows for substring searching
190 uint32_t c1=static_cast<uint8_t>(word[0]);
191 uint32_t c2=static_cast<uint8_t>(word[1]);
192 return c1*256+c2;
193}
std::string_view word
Definition util.cpp:980

References word.

Referenced by SearchIndex::addWordRec().

◆ definitionToName()

static QCString definitionToName ( const Definition * ctx)
static

Definition at line 391 of file searchindex.cpp.

392{
393 if (ctx && ctx->definitionType()==Definition::TypeMember)
394 {
395 const MemberDef *md = toMemberDef(ctx);
396 if (md->isFunction())
397 return "function";
398 else if (md->isSlot())
399 return "slot";
400 else if (md->isSignal())
401 return "signal";
402 else if (md->isVariable())
403 return "variable";
404 else if (md->isTypedef())
405 return "typedef";
406 else if (md->isEnumerate())
407 return "enum";
408 else if (md->isEnumValue())
409 return "enumvalue";
410 else if (md->isProperty())
411 return "property";
412 else if (md->isEvent())
413 return "event";
414 else if (md->isRelated() || md->isForeign())
415 return "related";
416 else if (md->isFriend())
417 return "friend";
418 else if (md->isDefine())
419 return "define";
420 }
421 else if (ctx)
422 {
423 switch(ctx->definitionType())
424 {
426 return (toClassDef(ctx))->compoundTypeString();
428 return "file";
430 return "namespace";
432 return "concept";
434 return "group";
436 return "package";
438 return "page";
440 return "dir";
442 return "module";
443 default:
444 break;
445 }
446 }
447 return "unknown";
448}
virtual DefType definitionType() const =0
A model of a class/file/namespace member symbol.
Definition memberdef.h:48
virtual bool isSignal() const =0
virtual bool isFriend() const =0
virtual bool isForeign() const =0
virtual bool isRelated() const =0
virtual bool isTypedef() const =0
virtual bool isSlot() const =0
virtual bool isEvent() const =0
virtual bool isFunction() const =0
virtual bool isDefine() const =0
virtual bool isEnumerate() const =0
virtual bool isVariable() const =0
virtual bool isEnumValue() const =0
virtual bool isProperty() const =0
ClassDef * toClassDef(Definition *d)
MemberDef * toMemberDef(Definition *d)

References Definition::definitionType(), MemberDef::isDefine(), MemberDef::isEnumerate(), MemberDef::isEnumValue(), MemberDef::isEvent(), MemberDef::isForeign(), MemberDef::isFriend(), MemberDef::isFunction(), MemberDef::isProperty(), MemberDef::isRelated(), MemberDef::isSignal(), MemberDef::isSlot(), MemberDef::isTypedef(), MemberDef::isVariable(), toClassDef(), toMemberDef(), Definition::TypeClass, Definition::TypeConcept, Definition::TypeDir, Definition::TypeFile, Definition::TypeGroup, Definition::TypeMember, Definition::TypeModule, Definition::TypeNamespace, Definition::TypePackage, and Definition::TypePage.

Referenced by SearchIndexExternal::setCurrentDoc().

◆ finalizeSearchIndexer()

void finalizeSearchIndexer ( )

Cleanup the search indexer

Definition at line 551 of file searchindex.cpp.

552{
554}
static SearchIndexIntf searchIndex
Definition doxygen.h:124

References SearchIndexIntf::Disabled, and Doxygen::searchIndex.

Referenced by generateOutput().

◆ initSearchIndexer()

void initSearchIndexer ( )

Initialize the search indexer

Definition at line 540 of file searchindex.cpp.

541{
542 bool searchEngine = Config_getBool(SEARCHENGINE);
543 bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
544 bool externalSearch = Config_getBool(EXTERNAL_SEARCH);
545 if (searchEngine && serverBasedSearch)
546 {
548 }
549}
#define Config_getBool(name)
Definition config.h:33

References Config_getBool, SearchIndexIntf::External, SearchIndexIntf::Internal, and Doxygen::searchIndex.

Referenced by parseInput().

◆ writeInt()

static void writeInt ( std::ostream & f,
size_t index )
static

Definition at line 242 of file searchindex.cpp.

243{
244 f.put(static_cast<int>((index>>24)&0xff));
245 f.put(static_cast<int>((index>>16)&0xff));
246 f.put(static_cast<int>((index>>8)&0xff));
247 f.put(static_cast<int>(index&0xff));
248}

Referenced by SearchIndex::write().

◆ writeString()

static void writeString ( std::ostream & f,
const QCString & s )
static

Definition at line 250 of file searchindex.cpp.

251{
252 size_t l = s.length();
253 for (size_t i=0;i<l;i++) f.put(s[i]);
254 f.put(0);
255}
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153

References QCString::length().

Referenced by SearchIndex::write().

Variable Documentation

◆ g_searchIndexMutex

std::mutex g_searchIndexMutex
static

◆ numIndexEntries

const size_t numIndexEntries = 256*256

Definition at line 48 of file searchindex.cpp.

Referenced by SearchIndex::SearchIndex(), and SearchIndex::write().