|
a/src/internfile/htmlparse.h |
|
b/src/internfile/htmlparse.h |
1 |
/* This file was copied from omega-0.8.5 and modified */
|
1 |
/* This file was copied from xapian-omega-1.0.1 and modified */
|
2 |
|
2 |
|
3 |
/* htmlparse.cc: simple HTML parser for omega indexer
|
3 |
/* htmlparse.h: simple HTML parser for omega indexer
|
4 |
*
|
4 |
*
|
5 |
* ----START-LICENCE----
|
|
|
6 |
* Copyright 1999,2000,2001 BrightStation PLC
|
5 |
* Copyright 1999,2000,2001 BrightStation PLC
|
7 |
* Copyright 2002 Olly Betts
|
6 |
* Copyright 2002,2006 Olly Betts
|
8 |
*
|
7 |
*
|
9 |
* This program is free software; you can redistribute it and/or
|
8 |
* This program is free software; you can redistribute it and/or
|
10 |
* modify it under the terms of the GNU General Public License as
|
9 |
* modify it under the terms of the GNU General Public License as
|
11 |
* published by the Free Software Foundation; either version 2 of the
|
10 |
* published by the Free Software Foundation; either version 2 of the
|
12 |
* License, or (at your option) any later version.
|
11 |
* License, or (at your option) any later version.
|
|
... |
|
... |
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
* GNU General Public License for more details.
|
16 |
* GNU General Public License for more details.
|
18 |
*
|
17 |
*
|
19 |
* You should have received a copy of the GNU General Public License
|
18 |
* You should have received a copy of the GNU General Public License
|
20 |
* along with this program; if not, write to the Free Software
|
19 |
* along with this program; if not, write to the Free Software
|
21 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
20 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
|
22 |
* USA
|
21 |
* USA
|
23 |
* -----END-LICENCE-----
|
|
|
24 |
*/
|
22 |
*/
|
|
|
23 |
|
|
|
24 |
#ifndef INCLUDED_HTMLPARSE_H
|
|
|
25 |
#define INCLUDED_HTMLPARSE_H
|
25 |
|
26 |
|
26 |
#include <string>
|
27 |
#include <string>
|
27 |
#include <map>
|
28 |
#include <map>
|
28 |
|
29 |
|
29 |
#ifndef NO_NAMESPACES
|
|
|
30 |
using std::string;
|
30 |
using std::string;
|
31 |
using std::map;
|
31 |
using std::map;
|
32 |
#endif /* NO_NAMESPACES */
|
|
|
33 |
|
32 |
|
34 |
class HtmlParser {
|
33 |
class HtmlParser {
|
35 |
protected:
|
34 |
protected:
|
36 |
void decode_entities(string &s);
|
35 |
void decode_entities(string &s);
|
|
|
36 |
bool in_script;
|
|
|
37 |
string charset;
|
37 |
static map<string, string> named_ents;
|
38 |
static map<string, unsigned int> named_ents;
|
38 |
public:
|
39 |
public:
|
39 |
virtual void process_text(const string &/*text*/) { }
|
40 |
virtual void process_text(const string &/*text*/) { }
|
40 |
virtual void opening_tag(const string &/*tag*/,
|
41 |
virtual void opening_tag(const string &/*tag*/,
|
41 |
const map<string,string> &/*p*/) { }
|
42 |
const map<string,string> &/*p*/) { }
|
42 |
virtual void closing_tag(const string &/*tag*/) { }
|
43 |
virtual void closing_tag(const string &/*tag*/) { }
|
43 |
virtual void parse_html(const string &text);
|
44 |
virtual void parse_html(const string &text);
|
44 |
virtual void do_eof() {}
|
45 |
virtual void do_eof() {}
|
45 |
HtmlParser();
|
46 |
HtmlParser();
|
46 |
virtual ~HtmlParser() { }
|
47 |
virtual ~HtmlParser() { }
|
47 |
};
|
48 |
};
|
|
|
49 |
|
|
|
50 |
#endif
|