summaryrefslogtreecommitdiffstats
path: root/src/searchindex.h
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-12-29 18:34:33 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2020-12-29 18:34:33 (GMT)
commit03cfc3d6eb95d2454c6d155c1ce8cb3d3bad3621 (patch)
tree8c2e813092956bbbdfabcdc3b55bd5340de5a4e1 /src/searchindex.h
parent3a85975d792ac667f3e0cca7eb8c96342a788432 (diff)
downloadDoxygen-03cfc3d6eb95d2454c6d155c1ce8cb3d3bad3621.zip
Doxygen-03cfc3d6eb95d2454c6d155c1ce8cb3d3bad3621.tar.gz
Doxygen-03cfc3d6eb95d2454c6d155c1ce8cb3d3bad3621.tar.bz2
Refactoring: Modernise client side part of searchindex
Diffstat (limited to 'src/searchindex.h')
-rw-r--r--src/searchindex.h76
1 files changed, 16 insertions, 60 deletions
diff --git a/src/searchindex.h b/src/searchindex.h
index 71c1ce1..9039f00 100644
--- a/src/searchindex.h
+++ b/src/searchindex.h
@@ -1,8 +1,6 @@
/******************************************************************************
*
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
@@ -15,25 +13,20 @@
*
*/
-#ifndef _SEARCHINDEX_H
-#define _SEARCHINDEX_H
+#ifndef SEARCHINDEX_H
+#define SEARCHINDEX_H
#include <memory>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
+#include <array>
+#include <functional>
-#include <qintdict.h>
-#include <qlist.h>
-#include <qintdict.h>
-#include "sortdict.h"
-#include "definition.h"
-#include "util.h"
+#include <qcstring.h>
-class FTextStream;
class Definition;
-class MemberDef;
/*! Initialize the search indexer */
void initSearchIndexer();
@@ -116,61 +109,24 @@ class SearchIndexExternal : public SearchIndexIntf
//------- client side search index ----------------------
-#define SEARCH_INDEX_ALL 0
-#define SEARCH_INDEX_CLASSES 1
-#define SEARCH_INDEX_INTERFACES 2
-#define SEARCH_INDEX_STRUCTS 3
-#define SEARCH_INDEX_EXCEPTIONS 4
-#define SEARCH_INDEX_NAMESPACES 5
-#define SEARCH_INDEX_FILES 6
-#define SEARCH_INDEX_FUNCTIONS 7
-#define SEARCH_INDEX_VARIABLES 8
-#define SEARCH_INDEX_TYPEDEFS 9
-#define SEARCH_INDEX_SEQUENCES 10
-#define SEARCH_INDEX_DICTIONARIES 11
-#define SEARCH_INDEX_ENUMS 12
-#define SEARCH_INDEX_ENUMVALUES 13
-#define SEARCH_INDEX_PROPERTIES 14
-#define SEARCH_INDEX_EVENTS 15
-#define SEARCH_INDEX_RELATED 16
-#define SEARCH_INDEX_DEFINES 17
-#define SEARCH_INDEX_GROUPS 18
-#define SEARCH_INDEX_PAGES 19
-#define NUM_SEARCH_INDICES 20
-
-class SearchDefinitionList : public QList<Definition>
-{
- public:
- SearchDefinitionList(const QCString &id,const QCString &name) : m_id(id), m_name(name) {}
- QCString id() const { return m_id; }
- QCString name() const { return m_name; }
- private:
- QCString m_id;
- QCString m_name;
-};
+#define NUM_SEARCH_INDICES 20
-class SearchIndexList : public SDict< SearchDefinitionList >
-{
- public:
- typedef const Definition ElementType;
- SearchIndexList(uint letter);
- ~SearchIndexList();
- void append(const Definition *d);
- uint letter() const;
- private:
- int compareValues(const SearchDefinitionList *md1, const SearchDefinitionList *md2) const;
- uint m_letter;
-};
+QCString searchId(const Definition *d);
+QCString searchName(const Definition *d);
+
+using SearchIndexList = std::vector<const Definition *>;
+using SearchIndexMap = std::map<std::string,SearchIndexList>;
struct SearchIndexInfo
{
- LetterToIndexMap<SearchIndexList> symbolList;
+ void add(const std::string &letter,const Definition *def);
QCString name;
- QCString text;
+ std::function<QCString()> getText;
+ SearchIndexMap symbolMap;
};
void createJavaScriptSearchIndex();
void writeJavaScriptSearchIndex();
-const SearchIndexInfo *getSearchIndices();
+const std::array<SearchIndexInfo,NUM_SEARCH_INDICES> &getSearchIndices();
#endif