Doxygen
Loading...
Searching...
No Matches
SearchTerm Struct Reference

Searchable term. More...

#include <src/searchindex_js.h>

Collaboration diagram for SearchTerm:

Public Types

using LinkInfo = std::variant<std::monostate,const Definition *,const SectionInfo *>

Public Member Functions

 SearchTerm (const QCString &w, const Definition *d)
 SearchTerm (const QCString &w, const SectionInfo *s)
QCString termEncoded () const
 encoded version of the search term

Public Attributes

QCString word
 lower case word that is indexed (e.g. name of a symbol, or word from a title)
QCString title
 title to show in the output for this search result
LinkInfo info
 definition to link to

Private Member Functions

void makeTitle ()

Detailed Description

Searchable term.

Definition at line 42 of file searchindex_js.h.

Member Typedef Documentation

◆ LinkInfo

using SearchTerm::LinkInfo = std::variant<std::monostate,const Definition *,const SectionInfo *>

Definition at line 44 of file searchindex_js.h.

Constructor & Destructor Documentation

◆ SearchTerm() [1/2]

SearchTerm::SearchTerm ( const QCString & w,
const Definition * d )
inline

Definition at line 45 of file searchindex_js.h.

45: word(w.str()), info(d) { makeTitle(); }
const std::string & str() const
Definition qcstring.h:537
QCString word
lower case word that is indexed (e.g. name of a symbol, or word from a title)
LinkInfo info
definition to link to

References info, makeTitle(), and word.

◆ SearchTerm() [2/2]

SearchTerm::SearchTerm ( const QCString & w,
const SectionInfo * s )
inline

Definition at line 46 of file searchindex_js.h.

46: word(w.str()), info(s) { makeTitle(); }

References info, makeTitle(), and word.

Member Function Documentation

◆ makeTitle()

void SearchTerm::makeTitle ( )
private

Definition at line 41 of file searchindex_js.cpp.

42{
43 if (std::holds_alternative<const Definition *>(info))
44 {
45 const Definition *def = std::get<const Definition *>(info);
47 title = type==Definition::TypeGroup ? parseCommentAsHtml(def,nullptr,toGroupDef(def)->groupTitle(),def->getDefFileName(),def->getDefLine()) :
48 type==Definition::TypePage ? parseCommentAsHtml(def,nullptr,toPageDef(def)->title(),def->getDefFileName(),def->getDefLine()) :
49 def->localName();
50 }
51 else if (std::holds_alternative<const SectionInfo *>(info))
52 {
53 const SectionInfo *si = std::get<const SectionInfo *>(info);
54 title = parseCommentAsHtml(si->definition(),nullptr,si->title(),si->fileName(),si->lineNr());
55 }
56 else
57 {
58 assert(false);
59 }
60}
virtual QCString getDefFileName() const =0
virtual int getDefLine() const =0
virtual DefType definitionType() const =0
Definition * definition() const
Definition section.h:76
QCString fileName() const
Definition section.h:73
int lineNr() const
Definition section.h:72
QCString title() const
Definition section.h:69
GroupDef * toGroupDef(Definition *d)
PageDef * toPageDef(Definition *d)
Definition pagedef.cpp:490
QCString title
title to show in the output for this search result
QCString parseCommentAsHtml(const Definition *scope, const MemberDef *member, const QCString &doc, const QCString &fileName, int lineNr)
Definition util.cpp:5927

References SectionInfo::definition(), Definition::definitionType(), SectionInfo::fileName(), Definition::getDefFileName(), Definition::getDefLine(), info, SectionInfo::lineNr(), Definition::localName(), parseCommentAsHtml(), title, SectionInfo::title(), toGroupDef(), toPageDef(), Definition::TypeGroup, and Definition::TypePage.

Referenced by SearchTerm(), and SearchTerm().

◆ termEncoded()

QCString SearchTerm::termEncoded ( ) const

encoded version of the search term

Definition at line 62 of file searchindex_js.cpp.

63{
64 TextStream t;
65 for (size_t i=0;i<word.length();i++)
66 {
67 if (isIdJS(word.at(i)))
68 {
69 t << word.at(i);
70 }
71 else // escape non-identifier characters
72 {
73 static const char *hex = "0123456789ABCDEF";
74 unsigned char uc = static_cast<unsigned char>(word.at(i));
75 t << '_';
76 t << hex[uc>>4];
77 t << hex[uc&0xF];
78 }
79 }
80
81 return convertUTF8ToLower(t.str());
82}
std::string str() const
Return the contents of the buffer as a std::string object.
Definition textstream.h:229
static constexpr auto hex
std::string convertUTF8ToLower(const std::string &input)
Converts the input string into a lower case version, also taking into account non-ASCII characters th...
Definition utf8.cpp:187
bool isIdJS(int c)
Definition util.h:212

References convertUTF8ToLower(), hex, isIdJS(), TextStream::str(), and word.

Member Data Documentation

◆ info

LinkInfo SearchTerm::info

definition to link to

Definition at line 49 of file searchindex_js.h.

Referenced by makeTitle(), SearchTerm(), and SearchTerm().

◆ title

QCString SearchTerm::title

title to show in the output for this search result

Definition at line 48 of file searchindex_js.h.

Referenced by makeTitle().

◆ word

QCString SearchTerm::word

lower case word that is indexed (e.g. name of a symbol, or word from a title)

Definition at line 47 of file searchindex_js.h.

Referenced by SearchTerm(), SearchTerm(), and termEncoded().


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