]> git.saurik.com Git - wxWidgets.git/blame - include/wx/html/htmltag.h
post-merge fix: added chkconf.h to filelist.txt so that make install will install it
[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
97494971 21//-----------------------------------------------------------------------------
5526e819 22// wxHtmlTagsCache
97494971
VS
23// - internal wxHTML class, do not use!
24//-----------------------------------------------------------------------------
5526e819 25
97494971 26struct wxHtmlCacheItem;
5526e819 27
c3952f65 28class WXDLLEXPORT wxHtmlTagsCache : public wxObject
5526e819
VS
29{
30 DECLARE_DYNAMIC_CLASS(wxHtmlTagsCache)
31
97494971
VS
32private:
33 wxHtmlCacheItem *m_Cache;
34 int m_CacheSize;
35 int m_CachePos;
5526e819 36
97494971
VS
37public:
38 wxHtmlTagsCache() : wxObject() {m_CacheSize = 0; m_Cache = NULL;}
39 wxHtmlTagsCache(const wxString& source);
40 ~wxHtmlTagsCache() {free(m_Cache);}
5526e819 41
97494971
VS
42 // Finds parameters for tag starting at at and fills the variables
43 void QueryTag(int at, int* end1, int* end2);
5526e819
VS
44};
45
46
5526e819
VS
47//--------------------------------------------------------------------------------
48// wxHtmlTag
49// This represents single tag. It is used as internal structure
50// by wxHtmlParser.
51//--------------------------------------------------------------------------------
52
53class WXDLLEXPORT wxHtmlTag : public wxObject
54{
55 DECLARE_CLASS(wxHtmlTag)
56
97494971
VS
57public:
58 // constructs wxHtmlTag object based on HTML tag.
59 // The tag begins (with '<' character) at position pos in source
60 // end_pos is position where parsing ends (usually end of document)
61 wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCache* cache);
62
63 // Returns tag's name in uppercase.
64 inline wxString GetName() const {return m_Name;}
65
66 // Returns TRUE if the tag has given parameter. Parameter
67 // should always be in uppercase.
68 // Example : <IMG SRC="test.jpg"> HasParam("SRC") returns TRUE
69 bool HasParam(const wxString& par) const;
70
71 // Returns value of the param. Value is in uppercase unless it is
72 // enclosed with "
73 // Example : <P align=right> GetParam("ALIGN") returns (RIGHT)
74 // <P IMG SRC="WhaT.jpg"> GetParam("SRC") returns (WhaT.jpg)
75 // (or ("WhaT.jpg") if with_commas == TRUE)
76 wxString GetParam(const wxString& par, bool with_commas = FALSE) const;
77
78 // Scans param like scanf() functions family do.
79 // Example : ScanParam("COLOR", "\"#%X\"", &clr);
80 // This is always with with_commas=FALSE
81 // Returns number of scanned values
82 // (like sscanf() does)
83 // NOTE: unlike scanf family, this function only accepts
84 // *one* parameter !
85 int ScanParam(const wxString& par, wxChar *format, void *param) const;
86
87 // Returns string containing all params.
88 inline const wxString& GetAllParams() const {return m_Params;}
89
90 // return TRUE if this is ending tag (</something>) or FALSE
91 // if it isn't (<something>)
92 inline bool IsEnding() const {return m_Ending;}
93
94 // return TRUE if this is ending tag (</something>) or FALSE
95 // if it isn't (<something>)
96 inline bool HasEnding() const {return m_End1 >= 0;}
97
98 // returns beginning position of _internal_ block of text
99 // See explanation (returned value is marked with *):
100 // bla bla bla <MYTAG>* bla bla intenal text</MYTAG> bla bla
101 inline int GetBeginPos() const {return m_Begin;}
102 // returns ending position of _internal_ block of text.
103 // bla bla bla <MYTAG> bla bla intenal text*</MYTAG> bla bla
104 inline int GetEndPos1() const {return m_End1;}
105 // returns end position 2 :
106 // bla bla bla <MYTAG> bla bla internal text</MYTAG>* bla bla
107 inline int GetEndPos2() const {return m_End2;}
108
109private:
110 wxString m_Name, m_Params;
111 int m_Begin, m_End1, m_End2;
112 bool m_Ending;
69941f05 113};
5526e819
VS
114
115
116
117
5526e819
VS
118
119#endif
69941f05
VS
120
121#endif // _WX_HTMLTAG_H_
122