Doxygen
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
35class SectionInfo;
36class Definition;
37
38//QCString searchId(const Definition *d);
40
41//! Searchable term
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
51private:
52 void makeTitle();
53};
54
55//! List of search terms
56using SearchIndexList = std::vector<SearchTerm>;
57
58//! Map of search terms for a given starting letter
59using 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
63{
64 void add(const SearchTerm &term);
66 std::function<QCString()> getText;
68};
69
72const std::array<SearchIndexInfo,NUM_SEARCH_INDICES> &getSearchIndices();
73
74#endif
The common base class of all entity definitions found in the sources.
Definition definition.h:76
This is an alternative implementation of QCString.
Definition qcstring.h:101
class that provide information about a section.
Definition section.h:57
#define term(fmt,...)
Definition message.h:94
void createJavaScriptSearchIndex()
std::vector< SearchTerm > SearchIndexList
List of search terms.
std::map< std::string, SearchIndexList > SearchIndexMap
Map of search terms for a given starting letter.
QCString searchName(const Definition *d)
const std::array< SearchIndexInfo, NUM_SEARCH_INDICES > & getSearchIndices()
void writeJavaScriptSearchIndex()
Table entry to allow filtering the search results per category.
void add(const SearchTerm &term)
SearchIndexMap symbolMap
std::function< QCString()> getText
Searchable term.
SearchTerm(const QCString &w, const SectionInfo *s)
SearchTerm(const QCString &w, const Definition *d)
QCString title
title to show in the output for this search result
std::variant< std::monostate, const Definition *, const SectionInfo * > LinkInfo
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
QCString termEncoded() const
encoded version of the search term
Various UTF8 related helper functions.