#include <searchindex.h>
◆ SearchIndex()
SearchIndex::SearchIndex |
( |
| ) |
|
◆ addWord() [1/2]
void SearchIndex::addWord |
( |
const QCString & |
word, |
|
|
bool |
hiPrio, |
|
|
bool |
recurse |
|
) |
| |
|
private |
在文件 searchindex.cpp 第 199 行定义.
205 if (idx<0 || idx>=
static_cast<int>(
m_index.size()))
return;
211 it =
m_words.insert({ wStr.
str(),
static_cast<int>(
m_index[idx].size())-1 }).first;
229 !((word[i]==
'_' || word[i]==
':' || (word[i]>=
'a' && word[i]<=
'z')) &&
230 (word[i+1]>=
'A' && word[i+1]<=
'Z')))
234 if (word[i]!=0 && i>=1)
引用了 addWord(), charsToIndex(), QCString::data(), FALSE, getPrefixIndex(), QCString::isEmpty(), QCString::lower(), m_index, m_urlIndex, m_words, QCString::str() , 以及 TRUE.
◆ addWord() [2/2]
void SearchIndex::addWord |
( |
const QCString & |
word, |
|
|
bool |
hiPriority |
|
) |
| |
|
overridevirtual |
◆ setCurrentDoc()
void SearchIndex::setCurrentDoc |
( |
const Definition * |
ctx, |
|
|
const QCString & |
anchor, |
|
|
bool |
isSourceFile |
|
) |
| |
|
overridevirtual |
实现了 SearchIndexIntf.
在文件 searchindex.cpp 第 85 行定义.
90 QCString url=isSourceFile ? (
toFileDef(ctx))->getSourceFileBase() : ctx->getOutputFileBase();
94 if (!isSourceFile) baseUrl=url;
引用了 ClassDef::compoundTypeString(), Config_getString, Definition::definitionType(), Definition::getLanguage(), getLanguageSpecificSeparator(), Definition::getOutputFileBase(), GroupDef::groupTitle(), PageDef::hasTitle(), QCString::isEmpty(), m_url2IdMap, m_urlIndex, m_urls, Definition::name(), QCString::prepend(), Definition::qualifiedName(), SrcLangExt_CSharp, SrcLangExt_Fortran, SrcLangExt_Java, QCString::str(), substitute(), theTranslator, PageDef::title(), toClassDef(), toFileDef(), toGroupDef(), toMemberDef(), toPageDef(), Translator::trGroup(), Translator::trMember(), Translator::trModule(), Translator::trNamespace(), Translator::trPackage(), Translator::trPage(), Translator::trSubprogram(), TRUE, Definition::TypeClass, Definition::TypeFile, Definition::TypeGroup, Definition::TypeMember, Definition::TypeNamespace , 以及 Definition::TypePage.
◆ write()
void SearchIndex::write |
( |
const QCString & |
file | ) |
|
|
overridevirtual |
实现了 SearchIndexIntf.
在文件 searchindex.cpp 第 261 行定义.
266 size_t wordsOffset = size;
270 const auto &wlist =
m_index[i];
273 for (
const auto &iw : wlist)
275 int ws = iw.word().length()+1;
284 size_t offset=wordsOffset;
287 const auto &wlist =
m_index[i];
290 indexOffsets[i]=offset;
291 for (
const auto &iw : wlist)
293 offset+= iw.word().length()+1;
303 size_t padding = size;
305 padding = size - padding;
307 std::vector<size_t> wordStatOffsets(
m_words.size());
314 const auto &wlist =
m_index[i];
317 for (
const auto &iw : wlist)
320 wordStatOffsets[count++] = size;
321 size+=4 + iw.urls().size() * 8;
325 std::vector<size_t> urlOffsets(
m_urls.size());
326 for (
const auto &udi :
m_urls)
328 urlOffsets[udi.first]=size;
329 size+=udi.second.name.length()+1+
330 udi.second.url.length()+1;
334 std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary);
338 f.put(
'D'); f.put(
'O'); f.put(
'X'); f.put(
'S');
348 const auto &wlist =
m_index[i];
351 for (
const auto &iw : wlist)
354 writeInt(f,wordStatOffsets[count++]);
360 for (i=0;i<padding;i++) f.put(0);
364 const auto &wlist =
m_index[i];
367 for (
const auto &iw : wlist)
369 size_t numUrls = iw.urls().size();
371 for (
const auto &ui : iw.urls())
373 writeInt(f,urlOffsets[ui.second.urlIdx]);
380 for (
const auto &udi :
m_urls)
引用了 m_index, m_urls, m_words, numIndexEntries, QCString::str(), writeInt() , 以及 writeString().
◆ m_index
std::vector< std::vector< IndexWord> > SearchIndex::m_index |
|
private |
◆ m_url2IdMap
std::unordered_map<std::string,int> SearchIndex::m_url2IdMap |
|
private |
◆ m_urlIndex
int SearchIndex::m_urlIndex = -1 |
|
private |
◆ m_urls
std::map<int,URL> SearchIndex::m_urls |
|
private |
◆ m_words
std::unordered_map<std::string,int> SearchIndex::m_words |
|
private |
该类的文档由以下文件生成:
virtual QCString trSubprogram(bool first_capital, bool singular)=0
const size_t numIndexEntries
GroupDef * toGroupDef(Definition *d)
virtual QCString compoundTypeString() const =0
Returns the type of compound as a string
bool isEmpty() const
Returns TRUE iff the string is empty
std::map< int, URL > m_urls
virtual QCString trPackage(const QCString &name)=0
virtual QCString groupTitle() const =0
MemberDef * toMemberDef(Definition *d)
static void writeInt(std::ostream &f, size_t index)
SrcLangExt
Language as given by extension
static int charsToIndex(const QCString &word)
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
PageDef * toPageDef(Definition *d)
A model of a page symbol.
A model of a group of symbols.
virtual QCString qualifiedName() const =0
A model of a class/file/namespace member symbol.
A abstract class representing of a compound symbol.
Translator * theTranslator
virtual QCString name() const =0
QCString getLanguageSpecificSeparator(SrcLangExt lang, bool classScope)
Returns the scope separator to use given the programming language lang
virtual bool hasTitle() const =0
std::vector< std::vector< IndexWord > > m_index
ClassDef * toClassDef(Definition *d)
std::unordered_map< std::string, int > m_words
void addWord(const QCString &word, bool hiPriority) override
virtual DefType definitionType() const =0
std::unordered_map< std::string, int > m_url2IdMap
int getPrefixIndex(const QCString &name)
virtual QCString trNamespace(bool first_capital, bool singular)=0
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
virtual QCString trPage(bool first_capital, bool singular)=0
virtual QCString trModule(bool first_capital, bool singular)=0
#define Config_getString(name)
static void writeString(std::ostream &f, const QCString &s)
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string
virtual QCString title() const =0
FileDef * toFileDef(Definition *d)
virtual QCString trMember(bool first_capital, bool singular)=0
virtual QCString trGroup(bool first_capital, bool singular)=0
This is an alternative implementation of QCString.