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