]>
Commit | Line | Data |
---|---|---|
f68e16c5 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/html/styleparams.h | |
3 | // Purpose: wxHtml helper code for extracting style parameters | |
4 | // Author: Nigel Paton | |
f68e16c5 VZ |
5 | // Copyright: wxWidgets team |
6 | // Licence: wxWindows licence | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | #ifndef _WX_HTML_STYLEPARAMS_H_ | |
10 | #define _WX_HTML_STYLEPARAMS_H_ | |
11 | ||
12 | #include "wx/defs.h" | |
13 | ||
14 | #if wxUSE_HTML | |
15 | ||
16 | #include "wx/arrstr.h" | |
17 | ||
18 | class WXDLLIMPEXP_FWD_HTML wxHtmlTag; | |
19 | ||
20 | // This is a private class used by wxHTML to parse "style" attributes of HTML | |
21 | // elements. Currently both parsing and support for the parsed values is pretty | |
22 | // trivial. | |
23 | class WXDLLIMPEXP_HTML wxHtmlStyleParams | |
24 | { | |
25 | public: | |
26 | // Construct a style parameters object corresponding to the style attribute | |
27 | // of the given HTML tag. | |
28 | wxHtmlStyleParams(const wxHtmlTag& tag); | |
29 | ||
30 | // Check whether the named parameter is present or not. | |
31 | bool HasParam(const wxString& par) const | |
32 | { | |
33 | return m_names.Index(par, false /* ignore case */) != wxNOT_FOUND; | |
34 | } | |
35 | ||
36 | // Get the value of the named parameter, return empty string if none. | |
37 | wxString GetParam(const wxString& par) const | |
38 | { | |
39 | int index = m_names.Index(par, false); | |
40 | return index == wxNOT_FOUND ? wxString() : m_values[index]; | |
41 | } | |
42 | ||
43 | private: | |
44 | // Arrays if names and values of the parameters | |
45 | wxArrayString | |
46 | m_names, | |
47 | m_values; | |
48 | }; | |
49 | ||
50 | #endif // wxUSE_HTML | |
51 | ||
52 | #endif // _WX_HTML_STYLEPARAMS_H_ |