Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4973 right-hear 1
/*
2
    Main HTML parser code.
3
    Copyright (C) 2003 Jarek Pelczar  (jarekp3@wp.pl)
4
 
5
    This program is free software; you can redistribute it and/or modify
6
    it under the terms of the GNU General Public License as published by
7
    the Free Software Foundation; either version 2 of the License, or
8
    (at your option) any later version.
9
 
10
    This program is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
    GNU General Public License for more details.
14
 
15
    You should have received a copy of the GNU General Public License
16
    along with this program; if not, write to the Free Software
17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
*/
19
 
20
#include
21
#include"parser.h"
22
#include
23
#include"HTML.h"
24
 
25
CHTMLParser::CHTMLParser(CParser * par,CPageBuffer * buf)
26
{
27
 parser=par;
28
 pgbuf=buf;
29
 DefaultStyles();
30
 parser->Init();
31
}
32
 
33
CHTMLParser::~CHTMLParser()
34
{
35
 delete parser;
36
}
37
 
38
void CHTMLParser::DefaultStyles()
39
{
40
 text_style.flags=FFLAG_ALIGNLEFT;
41
 text_style.FontName="system";
42
 text_style.FontSize=8;
43
 text_style.color=0;
44
 text_style.next=NULL;
45
 page_style.background=0xffffffff;
46
 page_style.text=0;
47
 page_style.link=0x008000;
48
 page_style.alink=0x000080;
49
 page_style.vlink=0x800000;
50
 page_style.flags=PFLAG_ALIGNLEFT|PFLAG_RAWMODE;
51
 pgbuf->Reset();
52
}
53
 
54
void CHTMLParser::Parse()
55
{
56
 char * tokenbuf;
57
 tokenbuf=new char[1024];
58
 while(!parser->isEOF())
59
 {
60
  parser->SkipWhite();
61
  if(parser->Look=='<')
62
  {
63
   parser->Match('<');
64
   memset(tokenbuf,0,1024);
65
   parser->GetToken(tokenbuf,1020);
66
   parser->Match('>');
67
  }
68
 }
69
 delete tokenbuf;
70
}