OSDN Git Service

WebGUIのレスポンスが悪かったのを修正
[peercast-im/PeerCastIM.git] / core / common / html.h
1 // ------------------------------------------------
2 // File : html.h
3 // Date: 4-apr-2002
4 // Author: giles
5 // Desc: 
6 //
7 // (c) 2002 peercast.org
8 // ------------------------------------------------
9 // This program is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation; either version 2 of the License, or
12 // (at your option) any later version.
13
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 // GNU General Public License for more details.
18 // ------------------------------------------------
19
20 #ifndef _HTML_H
21 #define _HTML_H
22
23 // ---------------------------------------
24 #include "xml.h"
25 #include "sys.h"
26
27 class FileStream;
28 class WriteBufferStream;
29
30 // ---------------------------------------
31 class HTML 
32 {
33 public:
34         enum 
35         {
36                 MAX_TAGLEVEL = 64,
37                 MAX_TAGLEN = 64
38         };
39
40         enum
41         {
42                 TMPL_UNKNOWN,
43                 TMPL_LOOP,
44                 TMPL_IF,
45                 TMPL_ELSE,
46                 TMPL_END
47         };
48
49         HTML(const char *,Stream &);
50         ~HTML();
51
52         void    startNode(const char *, const char * = NULL);
53         void    addLink(const char *, const char *, bool = false);
54         void    startTag(const char *, const char * = NULL,...);
55         void    startTagEnd(const char *, const char * = NULL,...);
56         void    startSingleTagEnd(const char *,...);
57         void    startTableRow(int);
58         void    end();
59         void    setRefresh(int sec) {refresh = sec;}
60         void    setRefreshURL(const char *u){refreshURL.set(u);}
61         void    addHead();
62         void    startHTML();
63         void    startBody();
64
65         void    locateTo(const char *);
66         void    addContent(const char *);
67
68         void    writeOK(const char *);
69         void    writeTemplate(const char *, const char *);
70         void    writeRawFile(const char *);
71         void    writeVariable(Stream &,const String &,int);
72         int             getIntVariable(const String &,int);
73         bool    getBoolVariable(const String &,int);
74
75
76         void    readIf(Stream &,Stream *,int);
77         void    readLoop(Stream &,Stream *,int);
78         void    readVariable(Stream &,Stream *,int);
79         bool    readTemplate(Stream &,Stream *,int);
80         int             readCmd(Stream &,Stream *,int);
81
82
83         const char *tmplArgs;
84         String  title,refreshURL;
85         char    currTag[MAX_TAGLEVEL][MAX_TAGLEN];
86         int             tagLevel;
87         int             refresh;
88         WriteBufferStream *out;
89 };
90
91 #endif