-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathHelpIndex.h
55 lines (51 loc) · 1.7 KB
/
HelpIndex.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* Quincy IDE for the Pawn scripting language
*
* Copyright ITB CompuPhase, 2009-2016
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Version: $Id: HelpIndex.h 5689 2017-06-05 14:05:58Z thiadmer $
*/
#ifndef _HELPINDEX_H
#define _HELPINDEX_H
#include <map>
class CPageRef {
public:
CPageRef(int id = 0, int page = 0)
{ m_id = id; m_page = page; }
void Set(int id, int page)
{ m_id = id; m_page = page; }
int GetPage() const
{ return m_page; }
int GetId() const
{ return m_id; }
int Valid() const
{ return m_id >0 && m_page > 0; }
private:
int m_page;
int m_id;
};
class CHelpIndex {
public:
CHelpIndex();
~CHelpIndex();
void AddPage(const char *key, int id, int page);
void AddFile(const char *filename, int id);
bool ScanFile(const char *indexfile, int id, const char *docfile = NULL);
std::map<const char*,int> *LookUp(const char *key); // returns filename/page pairs
const char *LookUp(int id); // returns filename
private:
std::multimap<std::string, CPageRef> m_index;
std::multimap<int, std::string> m_filetable;
};
#endif /* _HELPINDEX_H */