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 43 of file searchindex_js.cpp.

44{
45 if (std::holds_alternative<const Definition *>(info))
46 {
47 const Definition *def = std::get<const Definition *>(info);
49 title = type==Definition::TypeGroup ? filterTitle(toGroupDef(def)->groupTitle()) :
50 type==Definition::TypePage ? filterTitle(toPageDef(def)->title()) :
51 def->localName();
52 }
53 else if (std::holds_alternative<const SectionInfo *>(info))
54 {
55 title = std::get<const SectionInfo *>(info)->title();
56 }
57 else
58 {
59 assert(false);
60 }
61}
virtual DefType definitionType() const =0
GroupDef * toGroupDef(Definition *d)
PageDef * toPageDef(Definition *d)
Definition pagedef.cpp:467
QCString title
title to show in the output for this search result
QCString filterTitle(const QCString &title)
Definition util.cpp:5921

References Definition::definitionType(), filterTitle(), info, Definition::localName(), 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 63 of file searchindex_js.cpp.

64{
65 TextStream t;
66 for (size_t i=0;i<word.length();i++)
67 {
68 if (isIdJS(word.at(i)))
69 {
70 t << word.at(i);
71 }
72 else // escape non-identifier characters
73 {
74 static const char *hex = "0123456789ABCDEF";
75 unsigned char uc = static_cast<unsigned char>(word.at(i));
76 t << '_';
77 t << hex[uc>>4];
78 t << hex[uc&0xF];
79 }
80 }
81
82 return convertUTF8ToLower(t.str());
83}
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:206

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: