Doxygen
Toggle main menu visibility
Loading...
Searching...
No Matches
searchindex_js.h
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
* Copyright (C) 1997-2022 by Dimitri van Heesch.
4
*
5
* Permission to use, copy, modify, and distribute this software and its
6
* documentation under the terms of the GNU General Public License is hereby
7
* granted. No representations are made about the suitability of this software
8
* for any purpose. It is provided "as is" without express or implied warranty.
9
* See the GNU General Public License for more details.
10
*
11
* Documents produced by Doxygen are derivative works derived from the
12
* input used in their production; they are not affected by this license.
13
*
14
*/
15
16
/** @file
17
* @brief Javascript based search engine.
18
*/
19
20
#ifndef SEARCHINDEX_JS_H
21
#define SEARCHINDEX_JS_H
22
23
#include <array>
24
#include <vector>
25
#include <map>
26
#include <string>
27
#include <functional>
28
#include <variant>
29
30
#include "
qcstring.h
"
31
#include "
utf8.h
"
32
33
#define NUM_SEARCH_INDICES 22
34
35
class
SectionInfo
;
36
class
Definition
;
37
38
//QCString searchId(const Definition *d);
39
QCString
searchName
(
const
Definition
*d);
40
41
//! Searchable term
42
struct
SearchTerm
43
{
44
using
LinkInfo
= std::variant<std::monostate,const Definition *,const SectionInfo *>;
45
SearchTerm
(
const
QCString
&w,
const
Definition
*d) :
word
(w.str()),
info
(d) {
makeTitle
(); }
46
SearchTerm
(
const
QCString
&w,
const
SectionInfo
*s) :
word
(w.str()),
info
(s) {
makeTitle
(); }
47
QCString
word
;
//!< lower case word that is indexed (e.g. name of a symbol, or word from a title)
48
QCString
title
;
//!< title to show in the output for this search result
49
LinkInfo
info
;
//!< definition to link to
50
QCString
termEncoded
()
const
;
//!< encoded version of the search term
51
private
:
52
void
makeTitle
();
53
};
54
55
//! List of search terms
56
using
SearchIndexList
= std::vector<SearchTerm>;
57
58
//! Map of search terms for a given starting letter
59
using
SearchIndexMap
= std::map<std::string,SearchIndexList>;
// key is starting letter of a term (UTF-8).
60
61
//! Table entry to allow filtering the search results per category
62
struct
SearchIndexInfo
63
{
64
void
add
(
const
SearchTerm
&
term
);
65
QCString
name
;
66
std::function<
QCString
()>
getText
;
67
SearchIndexMap
symbolMap
;
68
};
69
70
void
createJavaScriptSearchIndex
();
71
void
writeJavaScriptSearchIndex
();
72
const
std::array<SearchIndexInfo,NUM_SEARCH_INDICES> &
getSearchIndices
();
73
74
#endif
Definition
The common base class of all entity definitions found in the sources.
Definition
definition.h:77
QCString
This is an alternative implementation of QCString.
Definition
qcstring.h:101
SectionInfo
class that provide information about a section.
Definition
section.h:58
term
#define term(fmt,...)
Definition
message.h:137
qcstring.h
createJavaScriptSearchIndex
void createJavaScriptSearchIndex()
Definition
searchindex_js.cpp:330
SearchIndexList
std::vector< SearchTerm > SearchIndexList
List of search terms.
Definition
searchindex_js.h:56
SearchIndexMap
std::map< std::string, SearchIndexList > SearchIndexMap
Map of search terms for a given starting letter.
Definition
searchindex_js.h:59
searchName
QCString searchName(const Definition *d)
getSearchIndices
const std::array< SearchIndexInfo, NUM_SEARCH_INDICES > & getSearchIndices()
Definition
searchindex_js.cpp:866
writeJavaScriptSearchIndex
void writeJavaScriptSearchIndex()
Definition
searchindex_js.cpp:795
SearchIndexInfo
Table entry to allow filtering the search results per category.
Definition
searchindex_js.h:63
SearchIndexInfo::add
void add(const SearchTerm &term)
Definition
searchindex_js.cpp:859
SearchIndexInfo::symbolMap
SearchIndexMap symbolMap
Definition
searchindex_js.h:67
SearchIndexInfo::name
QCString name
Definition
searchindex_js.h:65
SearchIndexInfo::getText
std::function< QCString()> getText
Definition
searchindex_js.h:66
SearchTerm
Searchable term.
Definition
searchindex_js.h:43
SearchTerm::SearchTerm
SearchTerm(const QCString &w, const SectionInfo *s)
Definition
searchindex_js.h:46
SearchTerm::SearchTerm
SearchTerm(const QCString &w, const Definition *d)
Definition
searchindex_js.h:45
SearchTerm::title
QCString title
title to show in the output for this search result
Definition
searchindex_js.h:48
SearchTerm::LinkInfo
std::variant< std::monostate, const Definition *, const SectionInfo * > LinkInfo
Definition
searchindex_js.h:44
SearchTerm::word
QCString word
lower case word that is indexed (e.g. name of a symbol, or word from a title)
Definition
searchindex_js.h:47
SearchTerm::info
LinkInfo info
definition to link to
Definition
searchindex_js.h:49
SearchTerm::makeTitle
void makeTitle()
Definition
searchindex_js.cpp:41
SearchTerm::termEncoded
QCString termEncoded() const
encoded version of the search term
Definition
searchindex_js.cpp:62
utf8.h
Various UTF8 related helper functions.
src
searchindex_js.h
Generated by
1.17.0