]> git.saurik.com Git - wxWidgets.git/blame - include/wx/html/htmltag.h
added new files to be included in the installer
[wxWidgets.git] / include / wx / html / htmltag.h
CommitLineData
5526e819
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: htmltag.h
3// Purpose: wxHtmlTag class (represents single tag)
4// Author: Vaclav Slavik
69941f05 5// RCS-ID: $Id$
5526e819
VS
6// Copyright: (c) 1999 Vaclav Slavik
7// Licence: wxWindows Licence
8/////////////////////////////////////////////////////////////////////////////
9
10
69941f05
VS
11#ifndef _WX_HTMLTAG_H_
12#define _WX_HTMLTAG_H_
5526e819
VS
13
14#ifdef __GNUG__
97494971 15#pragma interface "htmltag.h"
5526e819
VS
16#endif
17
18#include "wx/defs.h"
19#if wxUSE_HTML
20
8bd72d90
VS
21class WXDLLEXPORT wxHtmlEntitiesParser;
22
97494971 23//-----------------------------------------------------------------------------
5526e819 24// wxHtmlTagsCache
97494971
VS
25// - internal wxHTML class, do not use!
26//-----------------------------------------------------------------------------
5526e819 27
97494971 28struct wxHtmlCacheItem;
5526e819 29
c3952f65 30class WXDLLEXPORT wxHtmlTagsCache : public wxObject
5526e819
VS
31{
32 DECLARE_DYNAMIC_CLASS(wxHtmlTagsCache)
33
97494971
VS
34private:
35 wxHtmlCacheItem *m_Cache;
36 int m_CacheSize;
37 int m_CachePos;
5526e819 38
97494971
VS
39public:
40 wxHtmlTagsCache() : wxObject() {m_CacheSize = 0; m_Cache = NULL;}
41 wxHtmlTagsCache(const wxString& source);
42 ~wxHtmlTagsCache() {free(m_Cache);}
5526e819 43
97494971
VS
44 // Finds parameters for tag starting at at and fills the variables
45 void QueryTag(int at, int* end1, int* end2);
5526e819
VS
46};
47
48
5526e819
VS
49//--------------------------------------------------------------------------------
50// wxHtmlTag
51// This represents single tag. It is used as internal structure
52// by wxHtmlParser.
53//--------------------------------------------------------------------------------
54
55class WXDLLEXPORT wxHtmlTag : public wxObject
56{
57 DECLARE_CLASS(wxHtmlTag)
58
97494971
VS
59public:
60 // constructs wxHtmlTag object based on HTML tag.
61 // The tag begins (with '<' character) at position pos in source
62 // end_pos is position where parsing ends (usually end of document)
8bd72d90
VS
63 wxHtmlTag(const wxString& source, int pos, int end_pos,
64 wxHtmlTagsCache *cache,
65 wxHtmlEntitiesParser *entParser = NULL);
97494971
VS
66
67 // Returns tag's name in uppercase.
68 inline wxString GetName() const {return m_Name;}
69
70 // Returns TRUE if the tag has given parameter. Parameter
71 // should always be in uppercase.
72 // Example : <IMG SRC="test.jpg"> HasParam("SRC") returns TRUE
73 bool HasParam(const wxString& par) const;
74
75 // Returns value of the param. Value is in uppercase unless it is
76 // enclosed with "
77 // Example : <P align=right> GetParam("ALIGN") returns (RIGHT)
78 // <P IMG SRC="WhaT.jpg"> GetParam("SRC") returns (WhaT.jpg)
79 // (or ("WhaT.jpg") if with_commas == TRUE)
80 wxString GetParam(const wxString& par, bool with_commas = FALSE) const;
81
8bd72d90
VS
82 // Convenience functions:
83 bool GetParamAsColour(const wxString& par, wxColour *clr) const;
84 bool GetParamAsInt(const wxString& par, int *clr) const;
85
86 // Scans param like scanf() functions family does.
97494971
VS
87 // Example : ScanParam("COLOR", "\"#%X\"", &clr);
88 // This is always with with_commas=FALSE
89 // Returns number of scanned values
90 // (like sscanf() does)
91 // NOTE: unlike scanf family, this function only accepts
92 // *one* parameter !
93 int ScanParam(const wxString& par, wxChar *format, void *param) const;
94
95 // Returns string containing all params.
8bd72d90 96 wxString GetAllParams() const;
97494971
VS
97
98 // return TRUE if this is ending tag (</something>) or FALSE
99 // if it isn't (<something>)
100 inline bool IsEnding() const {return m_Ending;}
101
102 // return TRUE if this is ending tag (</something>) or FALSE
103 // if it isn't (<something>)
104 inline bool HasEnding() const {return m_End1 >= 0;}
105
106 // returns beginning position of _internal_ block of text
107 // See explanation (returned value is marked with *):
108 // bla bla bla <MYTAG>* bla bla intenal text</MYTAG> bla bla
109 inline int GetBeginPos() const {return m_Begin;}
110 // returns ending position of _internal_ block of text.
111 // bla bla bla <MYTAG> bla bla intenal text*</MYTAG> bla bla
112 inline int GetEndPos1() const {return m_End1;}
113 // returns end position 2 :
114 // bla bla bla <MYTAG> bla bla internal text</MYTAG>* bla bla
115 inline int GetEndPos2() const {return m_End2;}
116
117private:
8bd72d90 118 wxString m_Name;
97494971
VS
119 int m_Begin, m_End1, m_End2;
120 bool m_Ending;
8bd72d90 121 wxArrayString m_ParamNames, m_ParamValues;
69941f05 122};
5526e819
VS
123
124
125
126
5526e819
VS
127
128#endif
69941f05
VS
129
130#endif // _WX_HTMLTAG_H_
131